diff --git a/librfm95.c b/librfm95.c index 062d89f..8f68ff7 100644 --- a/librfm95.c +++ b/librfm95.c @@ -74,7 +74,7 @@ } } -static bool initFSK(uint8_t node) { +static bool initFSK(uint8_t node, uint8_t cast) { // bit rate 9.6 kBit/s // regWrite(BITRATE_MSB, 0x0d); // regWrite(BITRATE_LSB, 0x05); @@ -138,7 +138,7 @@ // node and broadcast address regWrite(RFM_FSK_NODE_ADDR, node); - regWrite(RFM_FSK_CAST_ADDR, RFM_CAST_ADDRESS); + regWrite(RFM_FSK_CAST_ADDR, cast); // set TX start condition to "at least one byte in FIFO" regWrite(RFM_FSK_FIFO_THRESH, 0x8f); @@ -191,7 +191,7 @@ return true; } -bool rfmInit(uint64_t freq, uint8_t node, bool _lora) { +bool rfmInit(uint64_t freq, uint8_t node, uint8_t cast, bool _lora) { lora = _lora; // wait a bit after power on @@ -234,7 +234,7 @@ // FSK mode, FSK modulation, high frequency mode, sleep mode regWrite(RFM_OP_MODE, 0x00); - return initFSK(node); + return initFSK(node, cast); } } diff --git a/librfm95.h b/librfm95.h index 07708ba..4032bf1 100644 --- a/librfm95.h +++ b/librfm95.h @@ -108,7 +108,6 @@ #define RFM_MASK_MODE 0x07 #define RFM_F_STEP 61035 -#define RFM_CAST_ADDRESS 0x84 #define RFM_DBM_MIN 2 #define RFM_DBM_MAX 17 @@ -168,12 +167,16 @@ /** * Initializes the radio module in FSK or LoRa mode with the given carrier - * frequency in kilohertz and node address. Returns true on success, - * false otherwise. + * frequency in kilohertz and node and brodcast address. + * Returns true on success, false otherwise. * + * @param freq carrier frequency + * @param node address + * @param broadcast address + * @param lora LoRa or FSK mode * @return success */ -bool rfmInit(uint64_t freq, uint8_t node, bool lora); +bool rfmInit(uint64_t freq, uint8_t node, uint8_t cast, bool lora); /** * Reads interrupt flags. Should be called when any interrupt occurs