diff options
| author | Sadeep Madurange <sadeep@asciimx.com> | 2024-12-07 20:10:20 +0800 |
|---|---|---|
| committer | Sadeep Madurange <sadeep@asciimx.com> | 2024-12-07 20:10:20 +0800 |
| commit | 4bbcee2a8cadb65e2268474b2908cae1e5840e24 (patch) | |
| tree | 6d17da0b719264d8d1d0ff609e0dd69619c39b5d /rf_test | |
| parent | f25e6c86d8597610c1b6f408f9a7fe1ce2a8458f (diff) | |
| download | smart-home-4bbcee2a8cadb65e2268474b2908cae1e5840e24.tar.gz | |
Add license info.
Diffstat (limited to 'rf_test')
| -rw-r--r-- | rf_test/radio.c | 32 | ||||
| -rw-r--r-- | 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 <stdlib.h> #include <avr/io.h> @@ -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); |
