From 4bbcee2a8cadb65e2268474b2908cae1e5840e24 Mon Sep 17 00:00:00 2001 From: Sadeep Madurange Date: Sat, 7 Dec 2024 20:10:20 +0800 Subject: Add license info. --- rf_test/radio.c | 32 +++++++++++++++++++++++++++++++- rf_test/radio.h | 2 +- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/rf_test/radio.c b/rf_test/radio.c index fa5a482..5ad1055 100644 --- a/rf_test/radio.c +++ b/rf_test/radio.c @@ -1,3 +1,29 @@ +// ********************************************************************************** +// Driver definition for HopeRF RFM69W/RFM69HW/RFM69CW/RFM69HCW, Semtech SX1231/1231H +// ********************************************************************************** +// Copyright LowPowerLab LLC 2018, https://www.LowPowerLab.com/contact +// ********************************************************************************** +// License +// ********************************************************************************** +// This program is free software; you can redistribute it +// and/or modify it under the terms of the GNU General +// Public License as published by the Free Software +// Foundation; either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will +// be useful, but WITHOUT ANY WARRANTY; without even the +// implied warranty of MERCHANTABILITY or FITNESS FOR A +// PARTICULAR PURPOSE. See the GNU General Public +// License for more details. +// +// Licence can be viewed at +// http://www.gnu.org/licenses/gpl-3.0.txt +// +// Please maintain this license information along with authorship +// and copyright notices in any redistribution of this code +// ********************************************************************************** + #include #include @@ -58,10 +84,14 @@ static inline void set_power_level(uint8_t pwl) write_reg(0x11, (pa_mask | pwl)); } -void radio_send(const char *data, uint8_t n) +void radio_sendto(uint8_t addr, const char *data, uint8_t n) { uint8_t i; + // force the receiver into WAIT mode + write_reg(0x3D, ((read_reg(0x3D) & 0xFB) | 0x04)); + + // STDBY + ListenAbort write_reg(0x01, 0x04); while ((read_reg(0x27) >> 7) != 1) diff --git a/rf_test/radio.h b/rf_test/radio.h index 719af14..6a006e2 100644 --- a/rf_test/radio.h +++ b/rf_test/radio.h @@ -10,7 +10,7 @@ struct radio_cfg { void radio_init(struct radio_cfg *cfg); -void radio_send(const char *data, uint8_t n); +void radio_sendto(uint8_t addr, const char *data, uint8_t n); uint8_t radio_recv(char *buf, uint8_t n); -- cgit v1.2.3