[RF69] General reformatting
This commit is contained in:
parent
c62bb74f9d
commit
9be1cdfa41
2 changed files with 652 additions and 761 deletions
|
@ -3,17 +3,17 @@
|
||||||
#if !defined(RADIOLIB_EXCLUDE_RF69)
|
#if !defined(RADIOLIB_EXCLUDE_RF69)
|
||||||
|
|
||||||
RF69::RF69(Module* module) : PhysicalLayer(RADIOLIB_RF69_FREQUENCY_STEP_SIZE, RADIOLIB_RF69_MAX_PACKET_LENGTH) {
|
RF69::RF69(Module* module) : PhysicalLayer(RADIOLIB_RF69_FREQUENCY_STEP_SIZE, RADIOLIB_RF69_MAX_PACKET_LENGTH) {
|
||||||
_mod = module;
|
this->mod = module;
|
||||||
}
|
}
|
||||||
|
|
||||||
Module* RF69::getMod() {
|
Module* RF69::getMod() {
|
||||||
return(_mod);
|
return(this->mod);
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t RF69::begin(float freq, float br, float freqDev, float rxBw, int8_t power, uint8_t preambleLen) {
|
int16_t RF69::begin(float freq, float br, float freqDev, float rxBw, int8_t power, uint8_t preambleLen) {
|
||||||
// set module properties
|
// set module properties
|
||||||
_mod->init();
|
this->mod->init();
|
||||||
_mod->hal->pinMode(_mod->getIrq(), _mod->hal->GpioModeInput);
|
this->mod->hal->pinMode(this->mod->getIrq(), this->mod->hal->GpioModeInput);
|
||||||
|
|
||||||
// try to find the RF69 chip
|
// try to find the RF69 chip
|
||||||
uint8_t i = 0;
|
uint8_t i = 0;
|
||||||
|
@ -28,14 +28,14 @@ int16_t RF69::begin(float freq, float br, float freqDev, float rxBw, int8_t powe
|
||||||
flagFound = true;
|
flagFound = true;
|
||||||
} else {
|
} else {
|
||||||
RADIOLIB_DEBUG_PRINTLN("RF69 not found! (%d of 10 tries) RADIOLIB_RF69_REG_VERSION == 0x%04X, expected 0x0024", i + 1, version);
|
RADIOLIB_DEBUG_PRINTLN("RF69 not found! (%d of 10 tries) RADIOLIB_RF69_REG_VERSION == 0x%04X, expected 0x0024", i + 1, version);
|
||||||
_mod->hal->delay(10);
|
this->mod->hal->delay(10);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!flagFound) {
|
if(!flagFound) {
|
||||||
RADIOLIB_DEBUG_PRINTLN("No RF69 found!");
|
RADIOLIB_DEBUG_PRINTLN("No RF69 found!");
|
||||||
_mod->term();
|
this->mod->term();
|
||||||
return(RADIOLIB_ERR_CHIP_NOT_FOUND);
|
return(RADIOLIB_ERR_CHIP_NOT_FOUND);
|
||||||
} else {
|
} else {
|
||||||
RADIOLIB_DEBUG_PRINTLN("M\tRF69");
|
RADIOLIB_DEBUG_PRINTLN("M\tRF69");
|
||||||
|
@ -50,7 +50,7 @@ int16_t RF69::begin(float freq, float br, float freqDev, float rxBw, int8_t powe
|
||||||
RADIOLIB_ASSERT(state);
|
RADIOLIB_ASSERT(state);
|
||||||
|
|
||||||
// configure bitrate
|
// configure bitrate
|
||||||
_rxBw = rxBw;
|
this->rxBandwidth = rxBw;
|
||||||
state = setBitRate(br);
|
state = setBitRate(br);
|
||||||
RADIOLIB_ASSERT(state);
|
RADIOLIB_ASSERT(state);
|
||||||
|
|
||||||
|
@ -95,27 +95,27 @@ int16_t RF69::begin(float freq, float br, float freqDev, float rxBw, int8_t powe
|
||||||
}
|
}
|
||||||
|
|
||||||
void RF69::reset() {
|
void RF69::reset() {
|
||||||
_mod->hal->pinMode(_mod->getRst(), _mod->hal->GpioModeOutput);
|
this->mod->hal->pinMode(this->mod->getRst(), this->mod->hal->GpioModeOutput);
|
||||||
_mod->hal->digitalWrite(_mod->getRst(), _mod->hal->GpioLevelHigh);
|
this->mod->hal->digitalWrite(this->mod->getRst(), this->mod->hal->GpioLevelHigh);
|
||||||
_mod->hal->delay(1);
|
this->mod->hal->delay(1);
|
||||||
_mod->hal->digitalWrite(_mod->getRst(), _mod->hal->GpioLevelLow);
|
this->mod->hal->digitalWrite(this->mod->getRst(), this->mod->hal->GpioLevelLow);
|
||||||
_mod->hal->delay(10);
|
this->mod->hal->delay(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t RF69::transmit(uint8_t* data, size_t len, uint8_t addr) {
|
int16_t RF69::transmit(uint8_t* data, size_t len, uint8_t addr) {
|
||||||
// calculate timeout (5ms + 500 % of expected time-on-air)
|
// calculate timeout (5ms + 500 % of expected time-on-air)
|
||||||
uint32_t timeout = 5000000 + (uint32_t)((((float)(len * 8)) / (_br * 1000.0)) * 5000000.0);
|
uint32_t timeout = 5000000 + (uint32_t)((((float)(len * 8)) / (this->bitRate * 1000.0)) * 5000000.0);
|
||||||
|
|
||||||
// start transmission
|
// start transmission
|
||||||
int16_t state = startTransmit(data, len, addr);
|
int16_t state = startTransmit(data, len, addr);
|
||||||
RADIOLIB_ASSERT(state);
|
RADIOLIB_ASSERT(state);
|
||||||
|
|
||||||
// wait for transmission end or timeout
|
// wait for transmission end or timeout
|
||||||
uint32_t start = _mod->hal->micros();
|
uint32_t start = this->mod->hal->micros();
|
||||||
while(!_mod->hal->digitalRead(_mod->getIrq())) {
|
while(!this->mod->hal->digitalRead(this->mod->getIrq())) {
|
||||||
_mod->hal->yield();
|
this->mod->hal->yield();
|
||||||
|
|
||||||
if(_mod->hal->micros() - start > timeout) {
|
if(this->mod->hal->micros() - start > timeout) {
|
||||||
finishTransmit();
|
finishTransmit();
|
||||||
return(RADIOLIB_ERR_TX_TIMEOUT);
|
return(RADIOLIB_ERR_TX_TIMEOUT);
|
||||||
}
|
}
|
||||||
|
@ -126,18 +126,18 @@ int16_t RF69::transmit(uint8_t* data, size_t len, uint8_t addr) {
|
||||||
|
|
||||||
int16_t RF69::receive(uint8_t* data, size_t len) {
|
int16_t RF69::receive(uint8_t* data, size_t len) {
|
||||||
// calculate timeout (500 ms + 400 full 64-byte packets at current bit rate)
|
// calculate timeout (500 ms + 400 full 64-byte packets at current bit rate)
|
||||||
uint32_t timeout = 500000 + (1.0/(_br*1000.0))*(RADIOLIB_RF69_MAX_PACKET_LENGTH*400.0);
|
uint32_t timeout = 500000 + (1.0/(this->bitRate*1000.0))*(RADIOLIB_RF69_MAX_PACKET_LENGTH*400.0);
|
||||||
|
|
||||||
// start reception
|
// start reception
|
||||||
int16_t state = startReceive();
|
int16_t state = startReceive();
|
||||||
RADIOLIB_ASSERT(state);
|
RADIOLIB_ASSERT(state);
|
||||||
|
|
||||||
// wait for packet reception or timeout
|
// wait for packet reception or timeout
|
||||||
uint32_t start = _mod->hal->micros();
|
uint32_t start = this->mod->hal->micros();
|
||||||
while(!_mod->hal->digitalRead(_mod->getIrq())) {
|
while(!this->mod->hal->digitalRead(this->mod->getIrq())) {
|
||||||
_mod->hal->yield();
|
this->mod->hal->yield();
|
||||||
|
|
||||||
if(_mod->hal->micros() - start > timeout) {
|
if(this->mod->hal->micros() - start > timeout) {
|
||||||
standby();
|
standby();
|
||||||
clearIRQFlags();
|
clearIRQFlags();
|
||||||
return(RADIOLIB_ERR_RX_TIMEOUT);
|
return(RADIOLIB_ERR_RX_TIMEOUT);
|
||||||
|
@ -150,7 +150,7 @@ int16_t RF69::receive(uint8_t* data, size_t len) {
|
||||||
|
|
||||||
int16_t RF69::sleep() {
|
int16_t RF69::sleep() {
|
||||||
// set RF switch (if present)
|
// set RF switch (if present)
|
||||||
_mod->setRfSwitchState(Module::MODE_IDLE);
|
this->mod->setRfSwitchState(Module::MODE_IDLE);
|
||||||
|
|
||||||
// set module to sleep
|
// set module to sleep
|
||||||
return(setMode(RADIOLIB_RF69_SLEEP));
|
return(setMode(RADIOLIB_RF69_SLEEP));
|
||||||
|
@ -158,7 +158,7 @@ int16_t RF69::sleep() {
|
||||||
|
|
||||||
int16_t RF69::standby() {
|
int16_t RF69::standby() {
|
||||||
// set RF switch (if present)
|
// set RF switch (if present)
|
||||||
_mod->setRfSwitchState(Module::MODE_IDLE);
|
this->mod->setRfSwitchState(Module::MODE_IDLE);
|
||||||
|
|
||||||
// set module to standby
|
// set module to standby
|
||||||
return(setMode(RADIOLIB_RF69_STANDBY));
|
return(setMode(RADIOLIB_RF69_STANDBY));
|
||||||
|
@ -171,13 +171,13 @@ int16_t RF69::standby(uint8_t mode) {
|
||||||
|
|
||||||
int16_t RF69::transmitDirect(uint32_t frf) {
|
int16_t RF69::transmitDirect(uint32_t frf) {
|
||||||
// set RF switch (if present)
|
// set RF switch (if present)
|
||||||
_mod->setRfSwitchState(Module::MODE_TX);
|
this->mod->setRfSwitchState(Module::MODE_TX);
|
||||||
|
|
||||||
// user requested to start transmitting immediately (required for RTTY)
|
// user requested to start transmitting immediately (required for RTTY)
|
||||||
if(frf != 0) {
|
if(frf != 0) {
|
||||||
_mod->SPIwriteRegister(RADIOLIB_RF69_REG_FRF_MSB, (frf & 0xFF0000) >> 16);
|
this->mod->SPIwriteRegister(RADIOLIB_RF69_REG_FRF_MSB, (frf & 0xFF0000) >> 16);
|
||||||
_mod->SPIwriteRegister(RADIOLIB_RF69_REG_FRF_MID, (frf & 0x00FF00) >> 8);
|
this->mod->SPIwriteRegister(RADIOLIB_RF69_REG_FRF_MID, (frf & 0x00FF00) >> 8);
|
||||||
_mod->SPIwriteRegister(RADIOLIB_RF69_REG_FRF_LSB, frf & 0x0000FF);
|
this->mod->SPIwriteRegister(RADIOLIB_RF69_REG_FRF_LSB, frf & 0x0000FF);
|
||||||
|
|
||||||
return(setMode(RADIOLIB_RF69_TX));
|
return(setMode(RADIOLIB_RF69_TX));
|
||||||
}
|
}
|
||||||
|
@ -192,7 +192,7 @@ int16_t RF69::transmitDirect(uint32_t frf) {
|
||||||
|
|
||||||
int16_t RF69::receiveDirect() {
|
int16_t RF69::receiveDirect() {
|
||||||
// set RF switch (if present)
|
// set RF switch (if present)
|
||||||
_mod->setRfSwitchState(Module::MODE_RX);
|
this->mod->setRfSwitchState(Module::MODE_RX);
|
||||||
|
|
||||||
// activate direct mode
|
// activate direct mode
|
||||||
int16_t state = directMode();
|
int16_t state = directMode();
|
||||||
|
@ -208,31 +208,31 @@ int16_t RF69::directMode() {
|
||||||
RADIOLIB_ASSERT(state);
|
RADIOLIB_ASSERT(state);
|
||||||
|
|
||||||
// set DIO mapping
|
// set DIO mapping
|
||||||
state = _mod->SPIsetRegValue(RADIOLIB_RF69_REG_DIO_MAPPING_1, RADIOLIB_RF69_DIO1_CONT_DCLK | RADIOLIB_RF69_DIO2_CONT_DATA, 5, 2);
|
state = this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_DIO_MAPPING_1, RADIOLIB_RF69_DIO1_CONT_DCLK | RADIOLIB_RF69_DIO2_CONT_DATA, 5, 2);
|
||||||
RADIOLIB_ASSERT(state);
|
RADIOLIB_ASSERT(state);
|
||||||
|
|
||||||
// set continuous mode
|
// set continuous mode
|
||||||
if(_bitSync) {
|
if(this->bitSync) {
|
||||||
return(_mod->SPIsetRegValue(RADIOLIB_RF69_REG_DATA_MODUL, RADIOLIB_RF69_CONTINUOUS_MODE_WITH_SYNC, 6, 5));
|
return(this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_DATA_MODUL, RADIOLIB_RF69_CONTINUOUS_MODE_WITH_SYNC, 6, 5));
|
||||||
} else {
|
} else {
|
||||||
return(_mod->SPIsetRegValue(RADIOLIB_RF69_REG_DATA_MODUL, RADIOLIB_RF69_CONTINUOUS_MODE, 6, 5));
|
return(this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_DATA_MODUL, RADIOLIB_RF69_CONTINUOUS_MODE, 6, 5));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t RF69::packetMode() {
|
int16_t RF69::packetMode() {
|
||||||
return(_mod->SPIsetRegValue(RADIOLIB_RF69_REG_DATA_MODUL, RADIOLIB_RF69_PACKET_MODE, 6, 5));
|
return(this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_DATA_MODUL, RADIOLIB_RF69_PACKET_MODE, 6, 5));
|
||||||
}
|
}
|
||||||
|
|
||||||
void RF69::setAESKey(uint8_t* key) {
|
void RF69::setAESKey(uint8_t* key) {
|
||||||
_mod->SPIwriteRegisterBurst(RADIOLIB_RF69_REG_AES_KEY_1, key, 16);
|
this->mod->SPIwriteRegisterBurst(RADIOLIB_RF69_REG_AES_KEY_1, key, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t RF69::enableAES() {
|
int16_t RF69::enableAES() {
|
||||||
return(_mod->SPIsetRegValue(RADIOLIB_RF69_REG_PACKET_CONFIG_2, RADIOLIB_RF69_AES_ON, 0, 0));
|
return(this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_PACKET_CONFIG_2, RADIOLIB_RF69_AES_ON, 0, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t RF69::disableAES() {
|
int16_t RF69::disableAES() {
|
||||||
return(_mod->SPIsetRegValue(RADIOLIB_RF69_REG_PACKET_CONFIG_2, RADIOLIB_RF69_AES_OFF, 0, 0));
|
return(this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_PACKET_CONFIG_2, RADIOLIB_RF69_AES_OFF, 0, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t RF69::startReceive() {
|
int16_t RF69::startReceive() {
|
||||||
|
@ -241,21 +241,21 @@ int16_t RF69::startReceive() {
|
||||||
RADIOLIB_ASSERT(state);
|
RADIOLIB_ASSERT(state);
|
||||||
|
|
||||||
// set RX timeouts and DIO pin mapping
|
// set RX timeouts and DIO pin mapping
|
||||||
state = _mod->SPIsetRegValue(RADIOLIB_RF69_REG_DIO_MAPPING_1, RADIOLIB_RF69_DIO0_PACK_PAYLOAD_READY, 7, 4);
|
state = this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_DIO_MAPPING_1, RADIOLIB_RF69_DIO0_PACK_PAYLOAD_READY, 7, 4);
|
||||||
state |= _mod->SPIsetRegValue(RADIOLIB_RF69_REG_RX_TIMEOUT_1, RADIOLIB_RF69_TIMEOUT_RX_START);
|
state |= this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_RX_TIMEOUT_1, RADIOLIB_RF69_TIMEOUT_RX_START);
|
||||||
state |= _mod->SPIsetRegValue(RADIOLIB_RF69_REG_RX_TIMEOUT_2, RADIOLIB_RF69_TIMEOUT_RSSI_THRESH);
|
state |= this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_RX_TIMEOUT_2, RADIOLIB_RF69_TIMEOUT_RSSI_THRESH);
|
||||||
RADIOLIB_ASSERT(state);
|
RADIOLIB_ASSERT(state);
|
||||||
|
|
||||||
// clear interrupt flags
|
// clear interrupt flags
|
||||||
clearIRQFlags();
|
clearIRQFlags();
|
||||||
|
|
||||||
// set RF switch (if present)
|
// set RF switch (if present)
|
||||||
_mod->setRfSwitchState(Module::MODE_RX);
|
this->mod->setRfSwitchState(Module::MODE_RX);
|
||||||
|
|
||||||
// set mode to receive
|
// set mode to receive
|
||||||
state = _mod->SPIsetRegValue(RADIOLIB_RF69_REG_OCP, RADIOLIB_RF69_OCP_ON | RADIOLIB_RF69_OCP_TRIM);
|
state = this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_OCP, RADIOLIB_RF69_OCP_ON | RADIOLIB_RF69_OCP_TRIM);
|
||||||
state |= _mod->SPIsetRegValue(RADIOLIB_RF69_REG_TEST_PA1, RADIOLIB_RF69_PA1_NORMAL);
|
state |= this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_TEST_PA1, RADIOLIB_RF69_PA1_NORMAL);
|
||||||
state |= _mod->SPIsetRegValue(RADIOLIB_RF69_REG_TEST_PA2, RADIOLIB_RF69_PA2_NORMAL);
|
state |= this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_TEST_PA2, RADIOLIB_RF69_PA2_NORMAL);
|
||||||
RADIOLIB_ASSERT(state);
|
RADIOLIB_ASSERT(state);
|
||||||
|
|
||||||
state = setMode(RADIOLIB_RF69_RX);
|
state = setMode(RADIOLIB_RF69_RX);
|
||||||
|
@ -272,37 +272,37 @@ int16_t RF69::startReceive(uint32_t timeout, uint16_t irqFlags, uint16_t irqMask
|
||||||
}
|
}
|
||||||
|
|
||||||
void RF69::setDio0Action(void (*func)(void)) {
|
void RF69::setDio0Action(void (*func)(void)) {
|
||||||
_mod->hal->attachInterrupt(_mod->hal->pinToInterrupt(_mod->getIrq()), func, _mod->hal->GpioInterruptRising);
|
this->mod->hal->attachInterrupt(this->mod->hal->pinToInterrupt(this->mod->getIrq()), func, this->mod->hal->GpioInterruptRising);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RF69::clearDio0Action() {
|
void RF69::clearDio0Action() {
|
||||||
_mod->hal->detachInterrupt(_mod->hal->pinToInterrupt(_mod->getIrq()));
|
this->mod->hal->detachInterrupt(this->mod->hal->pinToInterrupt(this->mod->getIrq()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void RF69::setDio1Action(void (*func)(void)) {
|
void RF69::setDio1Action(void (*func)(void)) {
|
||||||
if(_mod->getGpio() == RADIOLIB_NC) {
|
if(this->mod->getGpio() == RADIOLIB_NC) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_mod->hal->pinMode(_mod->getGpio(), _mod->hal->GpioModeInput);
|
this->mod->hal->pinMode(this->mod->getGpio(), this->mod->hal->GpioModeInput);
|
||||||
_mod->hal->attachInterrupt(_mod->hal->pinToInterrupt(_mod->getGpio()), func, _mod->hal->GpioInterruptRising);
|
this->mod->hal->attachInterrupt(this->mod->hal->pinToInterrupt(this->mod->getGpio()), func, this->mod->hal->GpioInterruptRising);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RF69::clearDio1Action() {
|
void RF69::clearDio1Action() {
|
||||||
if(_mod->getGpio() == RADIOLIB_NC) {
|
if(this->mod->getGpio() == RADIOLIB_NC) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_mod->hal->detachInterrupt(_mod->hal->pinToInterrupt(_mod->getGpio()));
|
this->mod->hal->detachInterrupt(this->mod->hal->pinToInterrupt(this->mod->getGpio()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void RF69::setFifoEmptyAction(void (*func)(void)) {
|
void RF69::setFifoEmptyAction(void (*func)(void)) {
|
||||||
// set DIO1 to the FIFO empty event (the register setting is done in startTransmit)
|
// set DIO1 to the FIFO empty event (the register setting is done in startTransmit)
|
||||||
if(_mod->getGpio() == RADIOLIB_NC) {
|
if(this->mod->getGpio() == RADIOLIB_NC) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_mod->hal->pinMode(_mod->getGpio(), _mod->hal->GpioModeInput);
|
this->mod->hal->pinMode(this->mod->getGpio(), this->mod->hal->GpioModeInput);
|
||||||
|
|
||||||
// we need to invert the logic here (as compared to setDio1Action), since we are using the "FIFO not empty interrupt"
|
// we need to invert the logic here (as compared to setDio1Action), since we are using the "FIFO not empty interrupt"
|
||||||
_mod->hal->attachInterrupt(_mod->hal->pinToInterrupt(_mod->getGpio()), func, _mod->hal->GpioInterruptFalling);
|
this->mod->hal->attachInterrupt(this->mod->hal->pinToInterrupt(this->mod->getGpio()), func, this->mod->hal->GpioInterruptFalling);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RF69::clearFifoEmptyAction() {
|
void RF69::clearFifoEmptyAction() {
|
||||||
|
@ -311,8 +311,8 @@ void RF69::clearFifoEmptyAction() {
|
||||||
|
|
||||||
void RF69::setFifoFullAction(void (*func)(void)) {
|
void RF69::setFifoFullAction(void (*func)(void)) {
|
||||||
// set the interrupt
|
// set the interrupt
|
||||||
_mod->SPIsetRegValue(RADIOLIB_RF69_REG_FIFO_THRESH, RADIOLIB_RF69_FIFO_THRESH, 6, 0);
|
this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_FIFO_THRESH, RADIOLIB_RF69_FIFO_THRESH, 6, 0);
|
||||||
_mod->SPIsetRegValue(RADIOLIB_RF69_REG_DIO_MAPPING_1, RADIOLIB_RF69_DIO1_PACK_FIFO_LEVEL, 5, 4);
|
this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_DIO_MAPPING_1, RADIOLIB_RF69_DIO1_PACK_FIFO_LEVEL, 5, 4);
|
||||||
|
|
||||||
// set DIO1 to the FIFO full event
|
// set DIO1 to the FIFO full event
|
||||||
setDio1Action(func);
|
setDio1Action(func);
|
||||||
|
@ -320,7 +320,7 @@ void RF69::setFifoFullAction(void (*func)(void)) {
|
||||||
|
|
||||||
void RF69::clearFifoFullAction() {
|
void RF69::clearFifoFullAction() {
|
||||||
clearDio1Action();
|
clearDio1Action();
|
||||||
_mod->SPIsetRegValue(RADIOLIB_RF69_REG_DIO_MAPPING_1, 0x00, 5, 4);
|
this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_DIO_MAPPING_1, 0x00, 5, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RF69::fifoAdd(uint8_t* data, int totalLen, int* remLen) {
|
bool RF69::fifoAdd(uint8_t* data, int totalLen, int* remLen) {
|
||||||
|
@ -340,7 +340,7 @@ bool RF69::fifoAdd(uint8_t* data, int totalLen, int* remLen) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// copy the bytes to the FIFO
|
// copy the bytes to the FIFO
|
||||||
_mod->SPIwriteRegisterBurst(RADIOLIB_RF69_REG_FIFO, &data[totalLen - *remLen], len);
|
this->mod->SPIwriteRegisterBurst(RADIOLIB_RF69_REG_FIFO, &data[totalLen - *remLen], len);
|
||||||
|
|
||||||
// we're not done yet
|
// we're not done yet
|
||||||
return(false);
|
return(false);
|
||||||
|
@ -358,7 +358,7 @@ bool RF69::fifoGet(volatile uint8_t* data, int totalLen, volatile int* rcvLen) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the data
|
// get the data
|
||||||
_mod->SPIreadRegisterBurst(RADIOLIB_RF69_REG_FIFO, len, dataPtr);
|
this->mod->SPIreadRegisterBurst(RADIOLIB_RF69_REG_FIFO, len, dataPtr);
|
||||||
(*rcvLen) += (len);
|
(*rcvLen) += (len);
|
||||||
|
|
||||||
// check if we're done
|
// check if we're done
|
||||||
|
@ -378,47 +378,47 @@ int16_t RF69::startTransmit(uint8_t* data, size_t len, uint8_t addr) {
|
||||||
|
|
||||||
// set DIO mapping
|
// set DIO mapping
|
||||||
if(len > RADIOLIB_RF69_MAX_PACKET_LENGTH) {
|
if(len > RADIOLIB_RF69_MAX_PACKET_LENGTH) {
|
||||||
state = _mod->SPIsetRegValue(RADIOLIB_RF69_REG_DIO_MAPPING_1, RADIOLIB_RF69_DIO1_PACK_FIFO_NOT_EMPTY, 5, 4);
|
state = this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_DIO_MAPPING_1, RADIOLIB_RF69_DIO1_PACK_FIFO_NOT_EMPTY, 5, 4);
|
||||||
} else {
|
} else {
|
||||||
state = _mod->SPIsetRegValue(RADIOLIB_RF69_REG_DIO_MAPPING_1, RADIOLIB_RF69_DIO0_PACK_PACKET_SENT, 7, 6);
|
state = this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_DIO_MAPPING_1, RADIOLIB_RF69_DIO0_PACK_PACKET_SENT, 7, 6);
|
||||||
}
|
}
|
||||||
RADIOLIB_ASSERT(state);
|
RADIOLIB_ASSERT(state);
|
||||||
|
|
||||||
// optionally write packet length
|
// optionally write packet length
|
||||||
if (_packetLengthConfig == RADIOLIB_RF69_PACKET_FORMAT_VARIABLE) {
|
if (this->packetLengthConfig == RADIOLIB_RF69_PACKET_FORMAT_VARIABLE) {
|
||||||
_mod->SPIwriteRegister(RADIOLIB_RF69_REG_FIFO, len);
|
this->mod->SPIwriteRegister(RADIOLIB_RF69_REG_FIFO, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
// check address filtering
|
// check address filtering
|
||||||
uint8_t filter = _mod->SPIgetRegValue(RADIOLIB_RF69_REG_PACKET_CONFIG_1, 2, 1);
|
uint8_t filter = this->mod->SPIgetRegValue(RADIOLIB_RF69_REG_PACKET_CONFIG_1, 2, 1);
|
||||||
if((filter == RADIOLIB_RF69_ADDRESS_FILTERING_NODE) || (filter == RADIOLIB_RF69_ADDRESS_FILTERING_NODE_BROADCAST)) {
|
if((filter == RADIOLIB_RF69_ADDRESS_FILTERING_NODE) || (filter == RADIOLIB_RF69_ADDRESS_FILTERING_NODE_BROADCAST)) {
|
||||||
_mod->SPIwriteRegister(RADIOLIB_RF69_REG_FIFO, addr);
|
this->mod->SPIwriteRegister(RADIOLIB_RF69_REG_FIFO, addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
// write packet to FIFO
|
// write packet to FIFO
|
||||||
size_t packetLen = len;
|
size_t packetLen = len;
|
||||||
if(len > RADIOLIB_RF69_MAX_PACKET_LENGTH) {
|
if(len > RADIOLIB_RF69_MAX_PACKET_LENGTH) {
|
||||||
packetLen = RADIOLIB_RF69_FIFO_THRESH - 1;
|
packetLen = RADIOLIB_RF69_FIFO_THRESH - 1;
|
||||||
_mod->SPIsetRegValue(RADIOLIB_RF69_REG_FIFO_THRESH, RADIOLIB_RF69_TX_START_CONDITION_FIFO_NOT_EMPTY, 7, 7);
|
this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_FIFO_THRESH, RADIOLIB_RF69_TX_START_CONDITION_FIFO_NOT_EMPTY, 7, 7);
|
||||||
}
|
}
|
||||||
_mod->SPIwriteRegisterBurst(RADIOLIB_RF69_REG_FIFO, data, packetLen);
|
this->mod->SPIwriteRegisterBurst(RADIOLIB_RF69_REG_FIFO, data, packetLen);
|
||||||
|
|
||||||
// this is a hack, but it seems than in Stream mode, Rx FIFO level is getting triggered 1 byte before it should
|
// this is a hack, but it seems than in Stream mode, Rx FIFO level is getting triggered 1 byte before it should
|
||||||
// just add a padding byte that can be dropped without consequence
|
// just add a padding byte that can be dropped without consequence
|
||||||
if(len > RADIOLIB_RF69_MAX_PACKET_LENGTH) {
|
if(len > RADIOLIB_RF69_MAX_PACKET_LENGTH) {
|
||||||
_mod->SPIwriteRegister(RADIOLIB_RF69_REG_FIFO, '/');
|
this->mod->SPIwriteRegister(RADIOLIB_RF69_REG_FIFO, '/');
|
||||||
}
|
}
|
||||||
|
|
||||||
// enable +20 dBm operation
|
// enable +20 dBm operation
|
||||||
if(_power > 17) {
|
if(this->power > 17) {
|
||||||
state = _mod->SPIsetRegValue(RADIOLIB_RF69_REG_OCP, RADIOLIB_RF69_OCP_OFF | 0x0F);
|
state = this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_OCP, RADIOLIB_RF69_OCP_OFF | 0x0F);
|
||||||
state |= _mod->SPIsetRegValue(RADIOLIB_RF69_REG_TEST_PA1, RADIOLIB_RF69_PA1_20_DBM);
|
state |= this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_TEST_PA1, RADIOLIB_RF69_PA1_20_DBM);
|
||||||
state |= _mod->SPIsetRegValue(RADIOLIB_RF69_REG_TEST_PA2, RADIOLIB_RF69_PA2_20_DBM);
|
state |= this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_TEST_PA2, RADIOLIB_RF69_PA2_20_DBM);
|
||||||
RADIOLIB_ASSERT(state);
|
RADIOLIB_ASSERT(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
// set RF switch (if present)
|
// set RF switch (if present)
|
||||||
_mod->setRfSwitchState(Module::MODE_TX);
|
this->mod->setRfSwitchState(Module::MODE_TX);
|
||||||
|
|
||||||
// set mode to transmit
|
// set mode to transmit
|
||||||
state = setMode(RADIOLIB_RF69_TX);
|
state = setMode(RADIOLIB_RF69_TX);
|
||||||
|
@ -449,13 +449,13 @@ int16_t RF69::readData(uint8_t* data, size_t len) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// check address filtering
|
// check address filtering
|
||||||
uint8_t filter = _mod->SPIgetRegValue(RADIOLIB_RF69_REG_PACKET_CONFIG_1, 2, 1);
|
uint8_t filter = this->mod->SPIgetRegValue(RADIOLIB_RF69_REG_PACKET_CONFIG_1, 2, 1);
|
||||||
if((filter == RADIOLIB_RF69_ADDRESS_FILTERING_NODE) || (filter == RADIOLIB_RF69_ADDRESS_FILTERING_NODE_BROADCAST)) {
|
if((filter == RADIOLIB_RF69_ADDRESS_FILTERING_NODE) || (filter == RADIOLIB_RF69_ADDRESS_FILTERING_NODE_BROADCAST)) {
|
||||||
_mod->SPIreadRegister(RADIOLIB_RF69_REG_FIFO);
|
this->mod->SPIreadRegister(RADIOLIB_RF69_REG_FIFO);
|
||||||
}
|
}
|
||||||
|
|
||||||
// read packet data
|
// read packet data
|
||||||
_mod->SPIreadRegisterBurst(RADIOLIB_RF69_REG_FIFO, length, data);
|
this->mod->SPIreadRegisterBurst(RADIOLIB_RF69_REG_FIFO, length, data);
|
||||||
|
|
||||||
// dump the bytes that weren't requested
|
// dump the bytes that weren't requested
|
||||||
if(dumpLen != 0) {
|
if(dumpLen != 0) {
|
||||||
|
@ -463,7 +463,7 @@ int16_t RF69::readData(uint8_t* data, size_t len) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// clear internal flag so getPacketLength can return the new packet length
|
// clear internal flag so getPacketLength can return the new packet length
|
||||||
_packetLengthQueried = false;
|
this->packetLengthQueried = false;
|
||||||
|
|
||||||
// clear interrupt flags
|
// clear interrupt flags
|
||||||
clearIRQFlags();
|
clearIRQFlags();
|
||||||
|
@ -471,21 +471,21 @@ int16_t RF69::readData(uint8_t* data, size_t len) {
|
||||||
return(RADIOLIB_ERR_NONE);
|
return(RADIOLIB_ERR_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t RF69::setOOK(bool enableOOK) {
|
int16_t RF69::setOOK(bool enable) {
|
||||||
// set OOK and if successful, save the new setting
|
// set OOK and if successful, save the new setting
|
||||||
int16_t state = RADIOLIB_ERR_NONE;
|
int16_t state = RADIOLIB_ERR_NONE;
|
||||||
if(enableOOK) {
|
if(enable) {
|
||||||
state = _mod->SPIsetRegValue(RADIOLIB_RF69_REG_DATA_MODUL, RADIOLIB_RF69_OOK, 4, 3, 5);
|
state = this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_DATA_MODUL, RADIOLIB_RF69_OOK, 4, 3, 5);
|
||||||
} else {
|
} else {
|
||||||
state = _mod->SPIsetRegValue(RADIOLIB_RF69_REG_DATA_MODUL, RADIOLIB_RF69_FSK, 4, 3, 5);
|
state = this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_DATA_MODUL, RADIOLIB_RF69_FSK, 4, 3, 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(state == RADIOLIB_ERR_NONE) {
|
if(state == RADIOLIB_ERR_NONE) {
|
||||||
_ook = enableOOK;
|
this->ookEnabled = enable;
|
||||||
}
|
}
|
||||||
|
|
||||||
// call setRxBandwidth again, since register values differ based on OOK mode being enabled
|
// call setRxBandwidth again, since register values differ based on OOK mode being enabled
|
||||||
state |= setRxBandwidth(_rxBw);
|
state |= setRxBandwidth(this->rxBandwidth);
|
||||||
|
|
||||||
return(state);
|
return(state);
|
||||||
}
|
}
|
||||||
|
@ -494,15 +494,15 @@ int16_t RF69::setOokThresholdType(uint8_t type) {
|
||||||
if((type != RADIOLIB_RF69_OOK_THRESH_FIXED) && (type != RADIOLIB_RF69_OOK_THRESH_PEAK) && (type != RADIOLIB_RF69_OOK_THRESH_AVERAGE)) {
|
if((type != RADIOLIB_RF69_OOK_THRESH_FIXED) && (type != RADIOLIB_RF69_OOK_THRESH_PEAK) && (type != RADIOLIB_RF69_OOK_THRESH_AVERAGE)) {
|
||||||
return(RADIOLIB_ERR_INVALID_OOK_RSSI_PEAK_TYPE);
|
return(RADIOLIB_ERR_INVALID_OOK_RSSI_PEAK_TYPE);
|
||||||
}
|
}
|
||||||
return(_mod->SPIsetRegValue(RADIOLIB_RF69_REG_OOK_PEAK, type, 7, 3, 5));
|
return(this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_OOK_PEAK, type, 7, 3, 5));
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t RF69::setOokFixedThreshold(uint8_t value) {
|
int16_t RF69::setOokFixedThreshold(uint8_t value) {
|
||||||
return(_mod->SPIsetRegValue(RADIOLIB_RF69_REG_OOK_FIX, value, 7, 0, 5));
|
return(this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_OOK_FIX, value, 7, 0, 5));
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t RF69::setOokPeakThresholdDecrement(uint8_t value) {
|
int16_t RF69::setOokPeakThresholdDecrement(uint8_t value) {
|
||||||
return(_mod->SPIsetRegValue(RADIOLIB_RF69_REG_OOK_PEAK, value, 2, 0, 5));
|
return(this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_OOK_PEAK, value, 2, 0, 5));
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t RF69::setFrequency(float freq) {
|
int16_t RF69::setFrequency(float freq) {
|
||||||
|
@ -519,9 +519,9 @@ int16_t RF69::setFrequency(float freq) {
|
||||||
//set carrier frequency
|
//set carrier frequency
|
||||||
//FRF(23:0) = freq / Fstep = freq * (1 / Fstep) = freq * (2^19 / 32.0) (pag. 17 of datasheet)
|
//FRF(23:0) = freq / Fstep = freq * (1 / Fstep) = freq * (2^19 / 32.0) (pag. 17 of datasheet)
|
||||||
uint32_t FRF = (freq * (uint32_t(1) << RADIOLIB_RF69_DIV_EXPONENT)) / RADIOLIB_RF69_CRYSTAL_FREQ;
|
uint32_t FRF = (freq * (uint32_t(1) << RADIOLIB_RF69_DIV_EXPONENT)) / RADIOLIB_RF69_CRYSTAL_FREQ;
|
||||||
_mod->SPIwriteRegister(RADIOLIB_RF69_REG_FRF_MSB, (FRF & 0xFF0000) >> 16);
|
this->mod->SPIwriteRegister(RADIOLIB_RF69_REG_FRF_MSB, (FRF & 0xFF0000) >> 16);
|
||||||
_mod->SPIwriteRegister(RADIOLIB_RF69_REG_FRF_MID, (FRF & 0x00FF00) >> 8);
|
this->mod->SPIwriteRegister(RADIOLIB_RF69_REG_FRF_MID, (FRF & 0x00FF00) >> 8);
|
||||||
_mod->SPIwriteRegister(RADIOLIB_RF69_REG_FRF_LSB, FRF & 0x0000FF);
|
this->mod->SPIwriteRegister(RADIOLIB_RF69_REG_FRF_LSB, FRF & 0x0000FF);
|
||||||
|
|
||||||
return(RADIOLIB_ERR_NONE);
|
return(RADIOLIB_ERR_NONE);
|
||||||
}
|
}
|
||||||
|
@ -531,9 +531,9 @@ int16_t RF69::getFrequency(float *freq) {
|
||||||
|
|
||||||
//FRF(23:0) = [ [FRF_MSB]|[FRF_MID]|[FRF_LSB]]
|
//FRF(23:0) = [ [FRF_MSB]|[FRF_MID]|[FRF_LSB]]
|
||||||
//FRF(32:0) = [0x00|[FRF_MSB]|[FRF_MID]|[FRF_LSB]]
|
//FRF(32:0) = [0x00|[FRF_MSB]|[FRF_MID]|[FRF_LSB]]
|
||||||
FRF |= (((uint32_t)(_mod->SPIgetRegValue(RADIOLIB_RF69_REG_FRF_MSB, 7, 0)) << 16) & 0x00FF0000);
|
FRF |= (((uint32_t)(this->mod->SPIgetRegValue(RADIOLIB_RF69_REG_FRF_MSB, 7, 0)) << 16) & 0x00FF0000);
|
||||||
FRF |= (((uint32_t)(_mod->SPIgetRegValue(RADIOLIB_RF69_REG_FRF_MID, 7, 0)) << 8) & 0x0000FF00);
|
FRF |= (((uint32_t)(this->mod->SPIgetRegValue(RADIOLIB_RF69_REG_FRF_MID, 7, 0)) << 8) & 0x0000FF00);
|
||||||
FRF |= (((uint32_t)(_mod->SPIgetRegValue(RADIOLIB_RF69_REG_FRF_LSB, 7, 0)) << 0) & 0x000000FF);
|
FRF |= (((uint32_t)(this->mod->SPIgetRegValue(RADIOLIB_RF69_REG_FRF_LSB, 7, 0)) << 0) & 0x000000FF);
|
||||||
|
|
||||||
//freq = Fstep * FRF(23:0) = (32.0 / 2^19) * FRF(23:0) (pag. 17 of datasheet)
|
//freq = Fstep * FRF(23:0) = (32.0 / 2^19) * FRF(23:0) (pag. 17 of datasheet)
|
||||||
*freq = FRF * ( RADIOLIB_RF69_CRYSTAL_FREQ / (uint32_t(1) << RADIOLIB_RF69_DIV_EXPONENT) );
|
*freq = FRF * ( RADIOLIB_RF69_CRYSTAL_FREQ / (uint32_t(1) << RADIOLIB_RF69_DIV_EXPONENT) );
|
||||||
|
@ -546,7 +546,7 @@ int16_t RF69::setBitRate(float br) {
|
||||||
RADIOLIB_CHECK_RANGE(br, 0.5, 300.0, RADIOLIB_ERR_INVALID_BIT_RATE);
|
RADIOLIB_CHECK_RANGE(br, 0.5, 300.0, RADIOLIB_ERR_INVALID_BIT_RATE);
|
||||||
|
|
||||||
// check bitrate-bandwidth ratio
|
// check bitrate-bandwidth ratio
|
||||||
if(!(br < 2000 * _rxBw)) {
|
if(!(br < 2000 * this->rxBandwidth)) {
|
||||||
return(RADIOLIB_ERR_INVALID_BIT_RATE_BW_RATIO);
|
return(RADIOLIB_ERR_INVALID_BIT_RATE_BW_RATIO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -555,17 +555,17 @@ int16_t RF69::setBitRate(float br) {
|
||||||
|
|
||||||
// set bit rate
|
// set bit rate
|
||||||
uint16_t bitRate = 32000 / br;
|
uint16_t bitRate = 32000 / br;
|
||||||
int16_t state = _mod->SPIsetRegValue(RADIOLIB_RF69_REG_BITRATE_MSB, (bitRate & 0xFF00) >> 8, 7, 0);
|
int16_t state = this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_BITRATE_MSB, (bitRate & 0xFF00) >> 8, 7, 0);
|
||||||
state |= _mod->SPIsetRegValue(RADIOLIB_RF69_REG_BITRATE_LSB, bitRate & 0x00FF, 7, 0);
|
state |= this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_BITRATE_LSB, bitRate & 0x00FF, 7, 0);
|
||||||
if(state == RADIOLIB_ERR_NONE) {
|
if(state == RADIOLIB_ERR_NONE) {
|
||||||
_br = br;
|
this->bitRate = br;
|
||||||
}
|
}
|
||||||
return(state);
|
return(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t RF69::setRxBandwidth(float rxBw) {
|
int16_t RF69::setRxBandwidth(float rxBw) {
|
||||||
// check bitrate-bandwidth ratio
|
// check bitrate-bandwidth ratio
|
||||||
if(!(_br < 2000 * rxBw)) {
|
if(!(this->bitRate < 2000 * rxBw)) {
|
||||||
return(RADIOLIB_ERR_INVALID_BIT_RATE_BW_RATIO);
|
return(RADIOLIB_ERR_INVALID_BIT_RATE_BW_RATIO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -576,12 +576,12 @@ int16_t RF69::setRxBandwidth(float rxBw) {
|
||||||
// calculate exponent and mantissa values for receiver bandwidth
|
// calculate exponent and mantissa values for receiver bandwidth
|
||||||
for(int8_t e = 7; e >= 0; e--) {
|
for(int8_t e = 7; e >= 0; e--) {
|
||||||
for(int8_t m = 2; m >= 0; m--) {
|
for(int8_t m = 2; m >= 0; m--) {
|
||||||
float point = (RADIOLIB_RF69_CRYSTAL_FREQ * 1000000.0)/(((4 * m) + 16) * ((uint32_t)1 << (e + (_ook ? 3 : 2))));
|
float point = (RADIOLIB_RF69_CRYSTAL_FREQ * 1000000.0)/(((4 * m) + 16) * ((uint32_t)1 << (e + (this->ookEnabled ? 3 : 2))));
|
||||||
if(fabs(rxBw - (point / 1000.0)) <= 0.1) {
|
if(fabs(rxBw - (point / 1000.0)) <= 0.1) {
|
||||||
// set Rx bandwidth
|
// set Rx bandwidth
|
||||||
state = _mod->SPIsetRegValue(RADIOLIB_RF69_REG_RX_BW, (m << 3) | e, 4, 0);
|
state = this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_RX_BW, (m << 3) | e, 4, 0);
|
||||||
if(state == RADIOLIB_ERR_NONE) {
|
if(state == RADIOLIB_ERR_NONE) {
|
||||||
_rxBw = rxBw;
|
this->rxBandwidth = rxBw;
|
||||||
}
|
}
|
||||||
return(state);
|
return(state);
|
||||||
}
|
}
|
||||||
|
@ -599,7 +599,7 @@ int16_t RF69::setFrequencyDeviation(float freqDev) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// check frequency deviation range
|
// check frequency deviation range
|
||||||
if(!((newFreqDev + _br/2 <= 500))) {
|
if(!((newFreqDev + this->bitRate/2 <= 500))) {
|
||||||
return(RADIOLIB_ERR_INVALID_FREQUENCY_DEVIATION);
|
return(RADIOLIB_ERR_INVALID_FREQUENCY_DEVIATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -608,18 +608,18 @@ int16_t RF69::setFrequencyDeviation(float freqDev) {
|
||||||
|
|
||||||
// set frequency deviation from carrier frequency
|
// set frequency deviation from carrier frequency
|
||||||
uint32_t fdev = (newFreqDev * (uint32_t(1) << RADIOLIB_RF69_DIV_EXPONENT)) / 32000;
|
uint32_t fdev = (newFreqDev * (uint32_t(1) << RADIOLIB_RF69_DIV_EXPONENT)) / 32000;
|
||||||
int16_t state = _mod->SPIsetRegValue(RADIOLIB_RF69_REG_FDEV_MSB, (fdev & 0xFF00) >> 8, 5, 0);
|
int16_t state = this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_FDEV_MSB, (fdev & 0xFF00) >> 8, 5, 0);
|
||||||
state |= _mod->SPIsetRegValue(RADIOLIB_RF69_REG_FDEV_LSB, fdev & 0x00FF, 7, 0);
|
state |= this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_FDEV_LSB, fdev & 0x00FF, 7, 0);
|
||||||
|
|
||||||
return(state);
|
return(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t RF69::getFrequencyDeviation(float *freqDev) {
|
int16_t RF69::getFrequencyDeviation(float *freqDev) {
|
||||||
if (freqDev == NULL) {
|
if(freqDev == NULL) {
|
||||||
return(RADIOLIB_ERR_NULL_POINTER);
|
return(RADIOLIB_ERR_NULL_POINTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RF69::_ook) {
|
if(this->ookEnabled) {
|
||||||
*freqDev = 0.0;
|
*freqDev = 0.0;
|
||||||
|
|
||||||
return(RADIOLIB_ERR_NONE);
|
return(RADIOLIB_ERR_NONE);
|
||||||
|
@ -627,8 +627,8 @@ int16_t RF69::getFrequencyDeviation(float *freqDev) {
|
||||||
|
|
||||||
// get raw value from register
|
// get raw value from register
|
||||||
uint32_t fdev = 0;
|
uint32_t fdev = 0;
|
||||||
fdev |= (uint32_t)((_mod->SPIgetRegValue(RADIOLIB_RF69_REG_FDEV_MSB, 5, 0) << 8) & 0x0000FF00);
|
fdev |= (uint32_t)((this->mod->SPIgetRegValue(RADIOLIB_RF69_REG_FDEV_MSB, 5, 0) << 8) & 0x0000FF00);
|
||||||
fdev |= (uint32_t)((_mod->SPIgetRegValue(RADIOLIB_RF69_REG_FDEV_LSB, 7, 0) << 0) & 0x000000FF);
|
fdev |= (uint32_t)((this->mod->SPIgetRegValue(RADIOLIB_RF69_REG_FDEV_LSB, 7, 0) << 0) & 0x000000FF);
|
||||||
|
|
||||||
// calculate frequency deviation from raw value obtained from register
|
// calculate frequency deviation from raw value obtained from register
|
||||||
// Fdev = Fstep * Fdev(13:0) (pag. 20 of datasheet)
|
// Fdev = Fstep * Fdev(13:0) (pag. 20 of datasheet)
|
||||||
|
@ -638,11 +638,11 @@ int16_t RF69::getFrequencyDeviation(float *freqDev) {
|
||||||
return(RADIOLIB_ERR_NONE);
|
return(RADIOLIB_ERR_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t RF69::setOutputPower(int8_t power, bool highPower) {
|
int16_t RF69::setOutputPower(int8_t pwr, bool highPower) {
|
||||||
if(highPower) {
|
if(highPower) {
|
||||||
RADIOLIB_CHECK_RANGE(power, -2, 20, RADIOLIB_ERR_INVALID_OUTPUT_POWER);
|
RADIOLIB_CHECK_RANGE(pwr, -2, 20, RADIOLIB_ERR_INVALID_OUTPUT_POWER);
|
||||||
} else {
|
} else {
|
||||||
RADIOLIB_CHECK_RANGE(power, -18, 13, RADIOLIB_ERR_INVALID_OUTPUT_POWER);
|
RADIOLIB_CHECK_RANGE(pwr, -18, 13, RADIOLIB_ERR_INVALID_OUTPUT_POWER);
|
||||||
}
|
}
|
||||||
|
|
||||||
// set mode to standby
|
// set mode to standby
|
||||||
|
@ -652,25 +652,25 @@ int16_t RF69::setOutputPower(int8_t power, bool highPower) {
|
||||||
int16_t state;
|
int16_t state;
|
||||||
if(highPower) {
|
if(highPower) {
|
||||||
// check if both PA1 and PA2 are needed
|
// check if both PA1 and PA2 are needed
|
||||||
if(power <= 10) {
|
if(pwr <= 10) {
|
||||||
// -2 to 13 dBm, PA1 is enough
|
// -2 to 13 dBm, PA1 is enough
|
||||||
state = _mod->SPIsetRegValue(RADIOLIB_RF69_REG_PA_LEVEL, RADIOLIB_RF69_PA0_OFF | RADIOLIB_RF69_PA1_ON | RADIOLIB_RF69_PA2_OFF | (power + 18), 7, 0);
|
state = this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_PA_LEVEL, RADIOLIB_RF69_PA0_OFF | RADIOLIB_RF69_PA1_ON | RADIOLIB_RF69_PA2_OFF | (power + 18), 7, 0);
|
||||||
} else if(power <= 17) {
|
} else if(pwr <= 17) {
|
||||||
// 13 to 17 dBm, both PAs required
|
// 13 to 17 dBm, both PAs required
|
||||||
state = _mod->SPIsetRegValue(RADIOLIB_RF69_REG_PA_LEVEL, RADIOLIB_RF69_PA0_OFF | RADIOLIB_RF69_PA1_ON | RADIOLIB_RF69_PA2_ON | (power + 14), 7, 0);
|
state = this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_PA_LEVEL, RADIOLIB_RF69_PA0_OFF | RADIOLIB_RF69_PA1_ON | RADIOLIB_RF69_PA2_ON | (power + 14), 7, 0);
|
||||||
} else {
|
} else {
|
||||||
// 18 - 20 dBm, both PAs and hig power settings required
|
// 18 - 20 dBm, both PAs and hig power settings required
|
||||||
state = _mod->SPIsetRegValue(RADIOLIB_RF69_REG_PA_LEVEL, RADIOLIB_RF69_PA0_OFF | RADIOLIB_RF69_PA1_ON | RADIOLIB_RF69_PA2_ON | (power + 11), 7, 0);
|
state = this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_PA_LEVEL, RADIOLIB_RF69_PA0_OFF | RADIOLIB_RF69_PA1_ON | RADIOLIB_RF69_PA2_ON | (power + 11), 7, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// low power module, use only PA0
|
// low power module, use only PA0
|
||||||
state = _mod->SPIsetRegValue(RADIOLIB_RF69_REG_PA_LEVEL, RADIOLIB_RF69_PA0_ON | RADIOLIB_RF69_PA1_OFF | RADIOLIB_RF69_PA2_OFF | (power + 18), 7, 0);
|
state = this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_PA_LEVEL, RADIOLIB_RF69_PA0_ON | RADIOLIB_RF69_PA1_OFF | RADIOLIB_RF69_PA2_OFF | (power + 18), 7, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// cache the power value
|
// cache the power value
|
||||||
if(state == RADIOLIB_ERR_NONE) {
|
if(state == RADIOLIB_ERR_NONE) {
|
||||||
_power = power;
|
this->power = pwr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return(state);
|
return(state);
|
||||||
|
@ -693,10 +693,10 @@ int16_t RF69::setSyncWord(uint8_t* syncWord, size_t len, uint8_t maxErrBits) {
|
||||||
RADIOLIB_ASSERT(state);
|
RADIOLIB_ASSERT(state);
|
||||||
|
|
||||||
// set sync word register
|
// set sync word register
|
||||||
_mod->SPIwriteRegisterBurst(RADIOLIB_RF69_REG_SYNC_VALUE_1, syncWord, len);
|
this->mod->SPIwriteRegisterBurst(RADIOLIB_RF69_REG_SYNC_VALUE_1, syncWord, len);
|
||||||
|
|
||||||
if(state == RADIOLIB_ERR_NONE) {
|
if(state == RADIOLIB_ERR_NONE) {
|
||||||
_syncWordLength = len;
|
this->syncWordLength = len;
|
||||||
}
|
}
|
||||||
|
|
||||||
return(state);
|
return(state);
|
||||||
|
@ -709,44 +709,44 @@ int16_t RF69::setPreambleLength(uint8_t preambleLen) {
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t preLenBytes = preambleLen / 8;
|
uint8_t preLenBytes = preambleLen / 8;
|
||||||
_mod->SPIwriteRegister(RADIOLIB_RF69_REG_PREAMBLE_MSB, 0x00);
|
this->mod->SPIwriteRegister(RADIOLIB_RF69_REG_PREAMBLE_MSB, 0x00);
|
||||||
|
|
||||||
return (_mod->SPIsetRegValue(RADIOLIB_RF69_REG_PREAMBLE_LSB, preLenBytes));
|
return (this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_PREAMBLE_LSB, preLenBytes));
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t RF69::setNodeAddress(uint8_t nodeAddr) {
|
int16_t RF69::setNodeAddress(uint8_t nodeAddr) {
|
||||||
// enable address filtering (node only)
|
// enable address filtering (node only)
|
||||||
int16_t state = _mod->SPIsetRegValue(RADIOLIB_RF69_REG_PACKET_CONFIG_1, RADIOLIB_RF69_ADDRESS_FILTERING_NODE, 2, 1);
|
int16_t state = this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_PACKET_CONFIG_1, RADIOLIB_RF69_ADDRESS_FILTERING_NODE, 2, 1);
|
||||||
RADIOLIB_ASSERT(state);
|
RADIOLIB_ASSERT(state);
|
||||||
|
|
||||||
// set node address
|
// set node address
|
||||||
return(_mod->SPIsetRegValue(RADIOLIB_RF69_REG_NODE_ADRS, nodeAddr));
|
return(this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_NODE_ADRS, nodeAddr));
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t RF69::setBroadcastAddress(uint8_t broadAddr) {
|
int16_t RF69::setBroadcastAddress(uint8_t broadAddr) {
|
||||||
// enable address filtering (node + broadcast)
|
// enable address filtering (node + broadcast)
|
||||||
int16_t state = _mod->SPIsetRegValue(RADIOLIB_RF69_REG_PACKET_CONFIG_1, RADIOLIB_RF69_ADDRESS_FILTERING_NODE_BROADCAST, 2, 1);
|
int16_t state = this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_PACKET_CONFIG_1, RADIOLIB_RF69_ADDRESS_FILTERING_NODE_BROADCAST, 2, 1);
|
||||||
RADIOLIB_ASSERT(state);
|
RADIOLIB_ASSERT(state);
|
||||||
|
|
||||||
// set broadcast address
|
// set broadcast address
|
||||||
return(_mod->SPIsetRegValue(RADIOLIB_RF69_REG_BROADCAST_ADRS, broadAddr));
|
return(this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_BROADCAST_ADRS, broadAddr));
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t RF69::disableAddressFiltering() {
|
int16_t RF69::disableAddressFiltering() {
|
||||||
// disable address filtering
|
// disable address filtering
|
||||||
int16_t state = _mod->SPIsetRegValue(RADIOLIB_RF69_REG_PACKET_CONFIG_1, RADIOLIB_RF69_ADDRESS_FILTERING_OFF, 2, 1);
|
int16_t state = this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_PACKET_CONFIG_1, RADIOLIB_RF69_ADDRESS_FILTERING_OFF, 2, 1);
|
||||||
RADIOLIB_ASSERT(state);
|
RADIOLIB_ASSERT(state);
|
||||||
|
|
||||||
// set node address to default (0x00)
|
// set node address to default (0x00)
|
||||||
state = _mod->SPIsetRegValue(RADIOLIB_RF69_REG_NODE_ADRS, 0x00);
|
state = this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_NODE_ADRS, 0x00);
|
||||||
RADIOLIB_ASSERT(state);
|
RADIOLIB_ASSERT(state);
|
||||||
|
|
||||||
// set broadcast address to default (0x00)
|
// set broadcast address to default (0x00)
|
||||||
return(_mod->SPIsetRegValue(RADIOLIB_RF69_REG_BROADCAST_ADRS, 0x00));
|
return(this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_BROADCAST_ADRS, 0x00));
|
||||||
}
|
}
|
||||||
|
|
||||||
void RF69::setAmbientTemperature(int16_t tempAmbient) {
|
void RF69::setAmbientTemperature(int16_t tempAmbient) {
|
||||||
_tempOffset = getTemperature() - tempAmbient;
|
this->tempOffset = getTemperature() - tempAmbient;
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t RF69::getTemperature() {
|
int16_t RF69::getTemperature() {
|
||||||
|
@ -754,29 +754,29 @@ int16_t RF69::getTemperature() {
|
||||||
setMode(RADIOLIB_RF69_STANDBY);
|
setMode(RADIOLIB_RF69_STANDBY);
|
||||||
|
|
||||||
// start temperature measurement
|
// start temperature measurement
|
||||||
_mod->SPIsetRegValue(RADIOLIB_RF69_REG_TEMP_1, RADIOLIB_RF69_TEMP_MEAS_START, 3, 3);
|
this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_TEMP_1, RADIOLIB_RF69_TEMP_MEAS_START, 3, 3);
|
||||||
|
|
||||||
// wait until measurement is finished
|
// wait until measurement is finished
|
||||||
while(_mod->SPIgetRegValue(RADIOLIB_RF69_REG_TEMP_1, 2, 2) == RADIOLIB_RF69_TEMP_MEAS_RUNNING) {
|
while(this->mod->SPIgetRegValue(RADIOLIB_RF69_REG_TEMP_1, 2, 2) == RADIOLIB_RF69_TEMP_MEAS_RUNNING) {
|
||||||
// check every 10 us
|
// check every 10 us
|
||||||
_mod->hal->delay(10);
|
this->mod->hal->delay(10);
|
||||||
}
|
}
|
||||||
int8_t rawTemp = _mod->SPIgetRegValue(RADIOLIB_RF69_REG_TEMP_2);
|
int8_t rawTemp = this->mod->SPIgetRegValue(RADIOLIB_RF69_REG_TEMP_2);
|
||||||
|
|
||||||
return(0 - (rawTemp + _tempOffset));
|
return(0 - (rawTemp + this->tempOffset));
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t RF69::getPacketLength(bool update) {
|
size_t RF69::getPacketLength(bool update) {
|
||||||
if(!_packetLengthQueried && update) {
|
if(!this->packetLengthQueried && update) {
|
||||||
if (_packetLengthConfig == RADIOLIB_RF69_PACKET_FORMAT_VARIABLE) {
|
if (this->packetLengthConfig == RADIOLIB_RF69_PACKET_FORMAT_VARIABLE) {
|
||||||
_packetLength = _mod->SPIreadRegister(RADIOLIB_RF69_REG_FIFO);
|
this->packetLength = this->mod->SPIreadRegister(RADIOLIB_RF69_REG_FIFO);
|
||||||
} else {
|
} else {
|
||||||
_packetLength = _mod->SPIreadRegister(RADIOLIB_RF69_REG_PAYLOAD_LENGTH);
|
this->packetLength = this->mod->SPIreadRegister(RADIOLIB_RF69_REG_PAYLOAD_LENGTH);
|
||||||
}
|
}
|
||||||
_packetLengthQueried = true;
|
this->packetLengthQueried = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return(_packetLength);
|
return(this->packetLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t RF69::fixedPacketLengthMode(uint8_t len) {
|
int16_t RF69::fixedPacketLengthMode(uint8_t len) {
|
||||||
|
@ -789,27 +789,27 @@ int16_t RF69::variablePacketLengthMode(uint8_t maxLen) {
|
||||||
|
|
||||||
int16_t RF69::enableSyncWordFiltering(uint8_t maxErrBits) {
|
int16_t RF69::enableSyncWordFiltering(uint8_t maxErrBits) {
|
||||||
// enable sync word recognition
|
// enable sync word recognition
|
||||||
return(_mod->SPIsetRegValue(RADIOLIB_RF69_REG_SYNC_CONFIG, RADIOLIB_RF69_SYNC_ON | RADIOLIB_RF69_FIFO_FILL_CONDITION_SYNC | (_syncWordLength - 1) << 3 | maxErrBits, 7, 0));
|
return(this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_SYNC_CONFIG, RADIOLIB_RF69_SYNC_ON | RADIOLIB_RF69_FIFO_FILL_CONDITION_SYNC | (this->syncWordLength - 1) << 3 | maxErrBits, 7, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t RF69::disableSyncWordFiltering() {
|
int16_t RF69::disableSyncWordFiltering() {
|
||||||
// disable sync word detection and generation
|
// disable sync word detection and generation
|
||||||
return(_mod->SPIsetRegValue(RADIOLIB_RF69_REG_SYNC_CONFIG, RADIOLIB_RF69_SYNC_OFF | RADIOLIB_RF69_FIFO_FILL_CONDITION, 7, 6));
|
return(this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_SYNC_CONFIG, RADIOLIB_RF69_SYNC_OFF | RADIOLIB_RF69_FIFO_FILL_CONDITION, 7, 6));
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t RF69::enableContinuousModeBitSync() {
|
int16_t RF69::enableContinuousModeBitSync() {
|
||||||
int16_t state = _mod->SPIsetRegValue(RADIOLIB_RF69_REG_DATA_MODUL, RADIOLIB_RF69_CONTINUOUS_MODE_WITH_SYNC, 6, 5);
|
int16_t state = this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_DATA_MODUL, RADIOLIB_RF69_CONTINUOUS_MODE_WITH_SYNC, 6, 5);
|
||||||
if(state == RADIOLIB_ERR_NONE) {
|
if(state == RADIOLIB_ERR_NONE) {
|
||||||
_bitSync = true;
|
this->bitSync = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return(state);
|
return(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t RF69::disableContinuousModeBitSync() {
|
int16_t RF69::disableContinuousModeBitSync() {
|
||||||
int16_t state = _mod->SPIsetRegValue(RADIOLIB_RF69_REG_DATA_MODUL, RADIOLIB_RF69_CONTINUOUS_MODE, 6, 5);
|
int16_t state = this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_DATA_MODUL, RADIOLIB_RF69_CONTINUOUS_MODE, 6, 5);
|
||||||
if(state == RADIOLIB_ERR_NONE) {
|
if(state == RADIOLIB_ERR_NONE) {
|
||||||
_bitSync = false;
|
this->bitSync = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return(state);
|
return(state);
|
||||||
|
@ -817,20 +817,20 @@ int16_t RF69::disableContinuousModeBitSync() {
|
||||||
|
|
||||||
int16_t RF69::setCrcFiltering(bool crcOn) {
|
int16_t RF69::setCrcFiltering(bool crcOn) {
|
||||||
if (crcOn == true) {
|
if (crcOn == true) {
|
||||||
return(_mod->SPIsetRegValue(RADIOLIB_RF69_REG_PACKET_CONFIG_1, RADIOLIB_RF69_CRC_ON, 4, 4));
|
return(this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_PACKET_CONFIG_1, RADIOLIB_RF69_CRC_ON, 4, 4));
|
||||||
} else {
|
} else {
|
||||||
return(_mod->SPIsetRegValue(RADIOLIB_RF69_REG_PACKET_CONFIG_1, RADIOLIB_RF69_CRC_OFF, 4, 4));
|
return(this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_PACKET_CONFIG_1, RADIOLIB_RF69_CRC_OFF, 4, 4));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t RF69::setPromiscuousMode(bool promiscuous) {
|
int16_t RF69::setPromiscuousMode(bool enable) {
|
||||||
int16_t state = RADIOLIB_ERR_NONE;
|
int16_t state = RADIOLIB_ERR_NONE;
|
||||||
|
|
||||||
if (_promiscuous == promiscuous) {
|
if (this->promiscuous == enable) {
|
||||||
return(state);
|
return(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (promiscuous == true) {
|
if (enable == true) {
|
||||||
// disable preamble detection and generation
|
// disable preamble detection and generation
|
||||||
state = setPreambleLength(0);
|
state = setPreambleLength(0);
|
||||||
RADIOLIB_ASSERT(state);
|
RADIOLIB_ASSERT(state);
|
||||||
|
@ -854,7 +854,7 @@ int16_t RF69::setPromiscuousMode(bool promiscuous) {
|
||||||
state = setCrcFiltering(true);
|
state = setCrcFiltering(true);
|
||||||
}
|
}
|
||||||
if(state == RADIOLIB_ERR_NONE) {
|
if(state == RADIOLIB_ERR_NONE) {
|
||||||
_promiscuous = promiscuous;
|
this->promiscuous = enable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -869,13 +869,13 @@ int16_t RF69::setDataShaping(uint8_t sh) {
|
||||||
// set data shaping
|
// set data shaping
|
||||||
switch(sh) {
|
switch(sh) {
|
||||||
case RADIOLIB_SHAPING_NONE:
|
case RADIOLIB_SHAPING_NONE:
|
||||||
return(_mod->SPIsetRegValue(RADIOLIB_RF69_REG_DATA_MODUL, RADIOLIB_RF69_NO_SHAPING, 1, 0));
|
return(this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_DATA_MODUL, RADIOLIB_RF69_NO_SHAPING, 1, 0));
|
||||||
case RADIOLIB_SHAPING_0_3:
|
case RADIOLIB_SHAPING_0_3:
|
||||||
return(_mod->SPIsetRegValue(RADIOLIB_RF69_REG_DATA_MODUL, RADIOLIB_RF69_FSK_GAUSSIAN_0_3, 1, 0));
|
return(this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_DATA_MODUL, RADIOLIB_RF69_FSK_GAUSSIAN_0_3, 1, 0));
|
||||||
case RADIOLIB_SHAPING_0_5:
|
case RADIOLIB_SHAPING_0_5:
|
||||||
return(_mod->SPIsetRegValue(RADIOLIB_RF69_REG_DATA_MODUL, RADIOLIB_RF69_FSK_GAUSSIAN_0_5, 1, 0));
|
return(this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_DATA_MODUL, RADIOLIB_RF69_FSK_GAUSSIAN_0_5, 1, 0));
|
||||||
case RADIOLIB_SHAPING_1_0:
|
case RADIOLIB_SHAPING_1_0:
|
||||||
return(_mod->SPIsetRegValue(RADIOLIB_RF69_REG_DATA_MODUL, RADIOLIB_RF69_FSK_GAUSSIAN_1_0, 1, 0));
|
return(this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_DATA_MODUL, RADIOLIB_RF69_FSK_GAUSSIAN_1_0, 1, 0));
|
||||||
default:
|
default:
|
||||||
return(RADIOLIB_ERR_INVALID_DATA_SHAPING);
|
return(RADIOLIB_ERR_INVALID_DATA_SHAPING);
|
||||||
}
|
}
|
||||||
|
@ -889,11 +889,11 @@ int16_t RF69::setEncoding(uint8_t encoding) {
|
||||||
// set encoding
|
// set encoding
|
||||||
switch(encoding) {
|
switch(encoding) {
|
||||||
case RADIOLIB_ENCODING_NRZ:
|
case RADIOLIB_ENCODING_NRZ:
|
||||||
return(_mod->SPIsetRegValue(RADIOLIB_RF69_REG_PACKET_CONFIG_1, RADIOLIB_RF69_DC_FREE_NONE, 6, 5));
|
return(this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_PACKET_CONFIG_1, RADIOLIB_RF69_DC_FREE_NONE, 6, 5));
|
||||||
case RADIOLIB_ENCODING_MANCHESTER:
|
case RADIOLIB_ENCODING_MANCHESTER:
|
||||||
return(_mod->SPIsetRegValue(RADIOLIB_RF69_REG_PACKET_CONFIG_1, RADIOLIB_RF69_DC_FREE_MANCHESTER, 6, 5));
|
return(this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_PACKET_CONFIG_1, RADIOLIB_RF69_DC_FREE_MANCHESTER, 6, 5));
|
||||||
case RADIOLIB_ENCODING_WHITENING:
|
case RADIOLIB_ENCODING_WHITENING:
|
||||||
return(_mod->SPIsetRegValue(RADIOLIB_RF69_REG_PACKET_CONFIG_1, RADIOLIB_RF69_DC_FREE_WHITENING, 6, 5));
|
return(this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_PACKET_CONFIG_1, RADIOLIB_RF69_DC_FREE_WHITENING, 6, 5));
|
||||||
default:
|
default:
|
||||||
return(RADIOLIB_ERR_INVALID_ENCODING);
|
return(RADIOLIB_ERR_INVALID_ENCODING);
|
||||||
}
|
}
|
||||||
|
@ -901,28 +901,28 @@ int16_t RF69::setEncoding(uint8_t encoding) {
|
||||||
|
|
||||||
int16_t RF69::setLnaTestBoost(bool value) {
|
int16_t RF69::setLnaTestBoost(bool value) {
|
||||||
if(value) {
|
if(value) {
|
||||||
return (_mod->SPIsetRegValue(RADIOLIB_RF69_REG_TEST_LNA, RADIOLIB_RF69_TEST_LNA_BOOST_HIGH, 7, 0));
|
return (this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_TEST_LNA, RADIOLIB_RF69_TEST_LNA_BOOST_HIGH, 7, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
return(_mod->SPIsetRegValue(RADIOLIB_RF69_TEST_LNA_BOOST_NORMAL, RADIOLIB_RF69_TEST_LNA_BOOST_HIGH, 7, 0));
|
return(this->mod->SPIsetRegValue(RADIOLIB_RF69_TEST_LNA_BOOST_NORMAL, RADIOLIB_RF69_TEST_LNA_BOOST_HIGH, 7, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
float RF69::getRSSI() {
|
float RF69::getRSSI() {
|
||||||
return(-1.0 * (_mod->SPIgetRegValue(RADIOLIB_RF69_REG_RSSI_VALUE)/2.0));
|
return(-1.0 * (this->mod->SPIgetRegValue(RADIOLIB_RF69_REG_RSSI_VALUE)/2.0));
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t RF69::setRSSIThreshold(float dbm) {
|
int16_t RF69::setRSSIThreshold(float dbm) {
|
||||||
RADIOLIB_CHECK_RANGE(dbm, -127.5, 0, RADIOLIB_ERR_INVALID_RSSI_THRESHOLD);
|
RADIOLIB_CHECK_RANGE(dbm, -127.5, 0, RADIOLIB_ERR_INVALID_RSSI_THRESHOLD);
|
||||||
|
|
||||||
return _mod->SPIsetRegValue(RADIOLIB_RF69_REG_RSSI_THRESH, (uint8_t)(-2.0 * dbm), 7, 0);
|
return this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_RSSI_THRESH, (uint8_t)(-2.0 * dbm), 7, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RF69::setRfSwitchPins(uint32_t rxEn, uint32_t txEn) {
|
void RF69::setRfSwitchPins(uint32_t rxEn, uint32_t txEn) {
|
||||||
_mod->setRfSwitchPins(rxEn, txEn);
|
this->mod->setRfSwitchPins(rxEn, txEn);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RF69::setRfSwitchTable(const uint32_t (&pins)[Module::RFSWITCH_MAX_PINS], const Module::RfSwitchMode_t table[]) {
|
void RF69::setRfSwitchTable(const uint32_t (&pins)[Module::RFSWITCH_MAX_PINS], const Module::RfSwitchMode_t table[]) {
|
||||||
_mod->setRfSwitchTable(pins, table);
|
this->mod->setRfSwitchTable(pins, table);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t RF69::randomByte() {
|
uint8_t RF69::randomByte() {
|
||||||
|
@ -930,12 +930,12 @@ uint8_t RF69::randomByte() {
|
||||||
setMode(RADIOLIB_RF69_RX);
|
setMode(RADIOLIB_RF69_RX);
|
||||||
|
|
||||||
// wait a bit for the RSSI reading to stabilise
|
// wait a bit for the RSSI reading to stabilise
|
||||||
_mod->hal->delay(10);
|
this->mod->hal->delay(10);
|
||||||
|
|
||||||
// read RSSI value 8 times, always keep just the least significant bit
|
// read RSSI value 8 times, always keep just the least significant bit
|
||||||
uint8_t randByte = 0x00;
|
uint8_t randByte = 0x00;
|
||||||
for(uint8_t i = 0; i < 8; i++) {
|
for(uint8_t i = 0; i < 8; i++) {
|
||||||
randByte |= ((_mod->SPIreadRegister(RADIOLIB_RF69_REG_RSSI_VALUE) & 0x01) << i);
|
randByte |= ((this->mod->SPIreadRegister(RADIOLIB_RF69_REG_RSSI_VALUE) & 0x01) << i);
|
||||||
}
|
}
|
||||||
|
|
||||||
// set mode to standby
|
// set mode to standby
|
||||||
|
@ -950,7 +950,7 @@ void RF69::setDirectAction(void (*func)(void)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void RF69::readBit(uint32_t pin) {
|
void RF69::readBit(uint32_t pin) {
|
||||||
updateDirectBuffer((uint8_t)_mod->hal->digitalRead(pin));
|
updateDirectBuffer((uint8_t)this->mod->hal->digitalRead(pin));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -960,14 +960,14 @@ int16_t RF69::setDIOMapping(uint32_t pin, uint32_t value) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(pin < 4) {
|
if(pin < 4) {
|
||||||
return(_mod->SPIsetRegValue(RADIOLIB_RF69_REG_DIO_MAPPING_1, value, 7 - 2 * pin, 6 - 2 * pin));
|
return(this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_DIO_MAPPING_1, value, 7 - 2 * pin, 6 - 2 * pin));
|
||||||
}
|
}
|
||||||
|
|
||||||
return(_mod->SPIsetRegValue(RADIOLIB_RF69_REG_DIO_MAPPING_2, value, 15 - 2 * pin, 14 - 2 * pin));
|
return(this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_DIO_MAPPING_2, value, 15 - 2 * pin, 14 - 2 * pin));
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t RF69::getChipVersion() {
|
int16_t RF69::getChipVersion() {
|
||||||
return(_mod->SPIgetRegValue(RADIOLIB_RF69_REG_VERSION));
|
return(this->mod->SPIgetRegValue(RADIOLIB_RF69_REG_VERSION));
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t RF69::config() {
|
int16_t RF69::config() {
|
||||||
|
@ -978,50 +978,50 @@ int16_t RF69::config() {
|
||||||
RADIOLIB_ASSERT(state);
|
RADIOLIB_ASSERT(state);
|
||||||
|
|
||||||
// set operation modes
|
// set operation modes
|
||||||
state = _mod->SPIsetRegValue(RADIOLIB_RF69_REG_OP_MODE, RADIOLIB_RF69_SEQUENCER_ON | RADIOLIB_RF69_LISTEN_OFF, 7, 6);
|
state = this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_OP_MODE, RADIOLIB_RF69_SEQUENCER_ON | RADIOLIB_RF69_LISTEN_OFF, 7, 6);
|
||||||
RADIOLIB_ASSERT(state);
|
RADIOLIB_ASSERT(state);
|
||||||
|
|
||||||
// enable over-current protection
|
// enable over-current protection
|
||||||
state = _mod->SPIsetRegValue(RADIOLIB_RF69_REG_OCP, RADIOLIB_RF69_OCP_ON, 4, 4);
|
state = this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_OCP, RADIOLIB_RF69_OCP_ON, 4, 4);
|
||||||
RADIOLIB_ASSERT(state);
|
RADIOLIB_ASSERT(state);
|
||||||
|
|
||||||
// set data mode, modulation type and shaping
|
// set data mode, modulation type and shaping
|
||||||
state = _mod->SPIsetRegValue(RADIOLIB_RF69_REG_DATA_MODUL, RADIOLIB_RF69_PACKET_MODE | RADIOLIB_RF69_FSK, 6, 3);
|
state = this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_DATA_MODUL, RADIOLIB_RF69_PACKET_MODE | RADIOLIB_RF69_FSK, 6, 3);
|
||||||
state |= _mod->SPIsetRegValue(RADIOLIB_RF69_REG_DATA_MODUL, RADIOLIB_RF69_FSK_GAUSSIAN_0_3, 1, 0);
|
state |= this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_DATA_MODUL, RADIOLIB_RF69_FSK_GAUSSIAN_0_3, 1, 0);
|
||||||
RADIOLIB_ASSERT(state);
|
RADIOLIB_ASSERT(state);
|
||||||
|
|
||||||
// set RSSI threshold
|
// set RSSI threshold
|
||||||
state = _mod->SPIsetRegValue(RADIOLIB_RF69_REG_RSSI_THRESH, RADIOLIB_RF69_RSSI_THRESHOLD, 7, 0);
|
state = this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_RSSI_THRESH, RADIOLIB_RF69_RSSI_THRESHOLD, 7, 0);
|
||||||
RADIOLIB_ASSERT(state);
|
RADIOLIB_ASSERT(state);
|
||||||
|
|
||||||
// reset FIFO flag
|
// reset FIFO flag
|
||||||
_mod->SPIwriteRegister(RADIOLIB_RF69_REG_IRQ_FLAGS_2, RADIOLIB_RF69_IRQ_FIFO_OVERRUN);
|
this->mod->SPIwriteRegister(RADIOLIB_RF69_REG_IRQ_FLAGS_2, RADIOLIB_RF69_IRQ_FIFO_OVERRUN);
|
||||||
|
|
||||||
// disable ClkOut on DIO5
|
// disable ClkOut on DIO5
|
||||||
state = _mod->SPIsetRegValue(RADIOLIB_RF69_REG_DIO_MAPPING_2, RADIOLIB_RF69_CLK_OUT_OFF, 2, 0);
|
state = this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_DIO_MAPPING_2, RADIOLIB_RF69_CLK_OUT_OFF, 2, 0);
|
||||||
RADIOLIB_ASSERT(state);
|
RADIOLIB_ASSERT(state);
|
||||||
|
|
||||||
// set packet configuration and disable encryption
|
// set packet configuration and disable encryption
|
||||||
state = _mod->SPIsetRegValue(RADIOLIB_RF69_REG_PACKET_CONFIG_1, RADIOLIB_RF69_PACKET_FORMAT_VARIABLE | RADIOLIB_RF69_DC_FREE_NONE | RADIOLIB_RF69_CRC_ON | RADIOLIB_RF69_CRC_AUTOCLEAR_ON | RADIOLIB_RF69_ADDRESS_FILTERING_OFF, 7, 1);
|
state = this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_PACKET_CONFIG_1, RADIOLIB_RF69_PACKET_FORMAT_VARIABLE | RADIOLIB_RF69_DC_FREE_NONE | RADIOLIB_RF69_CRC_ON | RADIOLIB_RF69_CRC_AUTOCLEAR_ON | RADIOLIB_RF69_ADDRESS_FILTERING_OFF, 7, 1);
|
||||||
state |= _mod->SPIsetRegValue(RADIOLIB_RF69_REG_PACKET_CONFIG_2, RADIOLIB_RF69_INTER_PACKET_RX_DELAY, 7, 4);
|
state |= this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_PACKET_CONFIG_2, RADIOLIB_RF69_INTER_PACKET_RX_DELAY, 7, 4);
|
||||||
state |= _mod->SPIsetRegValue(RADIOLIB_RF69_REG_PACKET_CONFIG_2, RADIOLIB_RF69_AUTO_RX_RESTART_ON | RADIOLIB_RF69_AES_OFF, 1, 0);
|
state |= this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_PACKET_CONFIG_2, RADIOLIB_RF69_AUTO_RX_RESTART_ON | RADIOLIB_RF69_AES_OFF, 1, 0);
|
||||||
RADIOLIB_ASSERT(state);
|
RADIOLIB_ASSERT(state);
|
||||||
|
|
||||||
// set payload length
|
// set payload length
|
||||||
state = _mod->SPIsetRegValue(RADIOLIB_RF69_REG_PAYLOAD_LENGTH, RADIOLIB_RF69_PAYLOAD_LENGTH, 7, 0);
|
state = this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_PAYLOAD_LENGTH, RADIOLIB_RF69_PAYLOAD_LENGTH, 7, 0);
|
||||||
RADIOLIB_ASSERT(state);
|
RADIOLIB_ASSERT(state);
|
||||||
|
|
||||||
// set FIFO threshold
|
// set FIFO threshold
|
||||||
state = _mod->SPIsetRegValue(RADIOLIB_RF69_REG_FIFO_THRESH, RADIOLIB_RF69_TX_START_CONDITION_FIFO_NOT_EMPTY | RADIOLIB_RF69_FIFO_THRESH, 7, 0);
|
state = this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_FIFO_THRESH, RADIOLIB_RF69_TX_START_CONDITION_FIFO_NOT_EMPTY | RADIOLIB_RF69_FIFO_THRESH, 7, 0);
|
||||||
RADIOLIB_ASSERT(state);
|
RADIOLIB_ASSERT(state);
|
||||||
|
|
||||||
// set Rx timeouts
|
// set Rx timeouts
|
||||||
state = _mod->SPIsetRegValue(RADIOLIB_RF69_REG_RX_TIMEOUT_1, RADIOLIB_RF69_TIMEOUT_RX_START, 7, 0);
|
state = this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_RX_TIMEOUT_1, RADIOLIB_RF69_TIMEOUT_RX_START, 7, 0);
|
||||||
state |= _mod->SPIsetRegValue(RADIOLIB_RF69_REG_RX_TIMEOUT_2, RADIOLIB_RF69_TIMEOUT_RSSI_THRESH, 7, 0);
|
state |= this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_RX_TIMEOUT_2, RADIOLIB_RF69_TIMEOUT_RSSI_THRESH, 7, 0);
|
||||||
RADIOLIB_ASSERT(state);
|
RADIOLIB_ASSERT(state);
|
||||||
|
|
||||||
// enable improved fading margin
|
// enable improved fading margin
|
||||||
state = _mod->SPIsetRegValue(RADIOLIB_RF69_REG_TEST_DAGC, RADIOLIB_RF69_CONTINUOUS_DAGC_LOW_BETA_OFF, 7, 0);
|
state = this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_TEST_DAGC, RADIOLIB_RF69_CONTINUOUS_DAGC_LOW_BETA_OFF, 7, 0);
|
||||||
|
|
||||||
return(state);
|
return(state);
|
||||||
}
|
}
|
||||||
|
@ -1033,30 +1033,30 @@ int16_t RF69::setPacketMode(uint8_t mode, uint8_t len) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// set to fixed packet length
|
// set to fixed packet length
|
||||||
int16_t state = _mod->SPIsetRegValue(RADIOLIB_RF69_REG_PACKET_CONFIG_1, mode, 7, 7);
|
int16_t state = this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_PACKET_CONFIG_1, mode, 7, 7);
|
||||||
RADIOLIB_ASSERT(state);
|
RADIOLIB_ASSERT(state);
|
||||||
|
|
||||||
// set length to register
|
// set length to register
|
||||||
state = _mod->SPIsetRegValue(RADIOLIB_RF69_REG_PAYLOAD_LENGTH, len);
|
state = this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_PAYLOAD_LENGTH, len);
|
||||||
RADIOLIB_ASSERT(state);
|
RADIOLIB_ASSERT(state);
|
||||||
|
|
||||||
// update the cached value
|
// update the cached value
|
||||||
_packetLengthConfig = mode;
|
this->packetLengthConfig = mode;
|
||||||
return(state);
|
return(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t RF69::setMode(uint8_t mode) {
|
int16_t RF69::setMode(uint8_t mode) {
|
||||||
return(_mod->SPIsetRegValue(RADIOLIB_RF69_REG_OP_MODE, mode, 4, 2));
|
return(this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_OP_MODE, mode, 4, 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
void RF69::clearIRQFlags() {
|
void RF69::clearIRQFlags() {
|
||||||
_mod->SPIwriteRegister(RADIOLIB_RF69_REG_IRQ_FLAGS_1, 0b11111111);
|
this->mod->SPIwriteRegister(RADIOLIB_RF69_REG_IRQ_FLAGS_1, 0b11111111);
|
||||||
_mod->SPIwriteRegister(RADIOLIB_RF69_REG_IRQ_FLAGS_2, 0b11111111);
|
this->mod->SPIwriteRegister(RADIOLIB_RF69_REG_IRQ_FLAGS_2, 0b11111111);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RF69::clearFIFO(size_t count) {
|
void RF69::clearFIFO(size_t count) {
|
||||||
while(count) {
|
while(count) {
|
||||||
_mod->SPIreadRegister(RADIOLIB_RF69_REG_FIFO);
|
this->mod->SPIreadRegister(RADIOLIB_RF69_REG_FIFO);
|
||||||
count--;
|
count--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,7 +97,7 @@
|
||||||
#define RADIOLIB_RF69_REG_TEST_DAGC 0x6F
|
#define RADIOLIB_RF69_REG_TEST_DAGC 0x6F
|
||||||
|
|
||||||
// RF69 modem settings
|
// RF69 modem settings
|
||||||
// RF69_REG_OP_MODE MSB LSB DESCRIPTION
|
// RADIOLIB_RF69_REG_OP_MODE MSB LSB DESCRIPTION
|
||||||
#define RADIOLIB_RF69_SEQUENCER_OFF 0b00000000 // 7 7 disable automatic sequencer
|
#define RADIOLIB_RF69_SEQUENCER_OFF 0b00000000 // 7 7 disable automatic sequencer
|
||||||
#define RADIOLIB_RF69_SEQUENCER_ON 0b10000000 // 7 7 enable automatic sequencer
|
#define RADIOLIB_RF69_SEQUENCER_ON 0b10000000 // 7 7 enable automatic sequencer
|
||||||
#define RADIOLIB_RF69_LISTEN_OFF 0b00000000 // 6 6 disable Listen mode
|
#define RADIOLIB_RF69_LISTEN_OFF 0b00000000 // 6 6 disable Listen mode
|
||||||
|
@ -109,7 +109,7 @@
|
||||||
#define RADIOLIB_RF69_TX 0b00001100 // 4 2 transmit
|
#define RADIOLIB_RF69_TX 0b00001100 // 4 2 transmit
|
||||||
#define RADIOLIB_RF69_RX 0b00010000 // 4 2 receive
|
#define RADIOLIB_RF69_RX 0b00010000 // 4 2 receive
|
||||||
|
|
||||||
// RF69_REG_DATA_MODUL
|
// RADIOLIB_RF69_REG_DATA_MODUL
|
||||||
#define RADIOLIB_RF69_PACKET_MODE 0b00000000 // 6 5 packet mode (default)
|
#define RADIOLIB_RF69_PACKET_MODE 0b00000000 // 6 5 packet mode (default)
|
||||||
#define RADIOLIB_RF69_CONTINUOUS_MODE_WITH_SYNC 0b01000000 // 6 5 continuous mode with bit synchronizer
|
#define RADIOLIB_RF69_CONTINUOUS_MODE_WITH_SYNC 0b01000000 // 6 5 continuous mode with bit synchronizer
|
||||||
#define RADIOLIB_RF69_CONTINUOUS_MODE 0b01100000 // 6 5 continuous mode without bit synchronizer
|
#define RADIOLIB_RF69_CONTINUOUS_MODE 0b01100000 // 6 5 continuous mode without bit synchronizer
|
||||||
|
@ -122,29 +122,29 @@
|
||||||
#define RADIOLIB_RF69_OOK_FILTER_BR 0b00000001 // 1 0 OOK modulation filter, f_cutoff = BR
|
#define RADIOLIB_RF69_OOK_FILTER_BR 0b00000001 // 1 0 OOK modulation filter, f_cutoff = BR
|
||||||
#define RADIOLIB_RF69_OOK_FILTER_2BR 0b00000010 // 1 0 OOK modulation filter, f_cutoff = 2*BR
|
#define RADIOLIB_RF69_OOK_FILTER_2BR 0b00000010 // 1 0 OOK modulation filter, f_cutoff = 2*BR
|
||||||
|
|
||||||
// RF69_REG_BITRATE_MSB + REG_BITRATE_LSB
|
// RADIOLIB_RF69_REG_BITRATE_MSB + REG_BITRATE_LSB
|
||||||
#define RADIOLIB_RF69_BITRATE_MSB 0x1A // 7 0 bit rate setting: rate = F(XOSC) / BITRATE
|
#define RADIOLIB_RF69_BITRATE_MSB 0x1A // 7 0 bit rate setting: rate = F(XOSC) / BITRATE
|
||||||
#define RADIOLIB_RF69_BITRATE_LSB 0x0B // 7 0 default value: 4.8 kbps 0x40 // 7 0
|
#define RADIOLIB_RF69_BITRATE_LSB 0x0B // 7 0 default value: 4.8 kbps 0x40 // 7 0
|
||||||
|
|
||||||
// RF69_REG_FDEV_MSB + REG_FDEV_LSB
|
// RADIOLIB_RF69_REG_FDEV_MSB + REG_FDEV_LSB
|
||||||
#define RADIOLIB_RF69_FDEV_MSB 0x00 // 5 0 frequency deviation: f_dev = f_step * FDEV
|
#define RADIOLIB_RF69_FDEV_MSB 0x00 // 5 0 frequency deviation: f_dev = f_step * FDEV
|
||||||
#define RADIOLIB_RF69_FDEV_LSB 0x52 // 7 0 default value: 5 kHz
|
#define RADIOLIB_RF69_FDEV_LSB 0x52 // 7 0 default value: 5 kHz
|
||||||
|
|
||||||
// RF69_REG_FRF_MSB + REG_FRF_MID + REG_FRF_LSB
|
// RADIOLIB_RF69_REG_FRF_MSB + REG_FRF_MID + REG_FRF_LSB
|
||||||
#define RADIOLIB_RF69_FRF_MSB 0xE4 // 7 0 carrier frequency setting: f_RF = (F(XOSC) * FRF)/2^19
|
#define RADIOLIB_RF69_FRF_MSB 0xE4 // 7 0 carrier frequency setting: f_RF = (F(XOSC) * FRF)/2^19
|
||||||
#define RADIOLIB_RF69_FRF_MID 0xC0 // 7 0 where F(XOSC) = 32 MHz
|
#define RADIOLIB_RF69_FRF_MID 0xC0 // 7 0 where F(XOSC) = 32 MHz
|
||||||
#define RADIOLIB_RF69_FRF_LSB 0x00 // 7 0 default value: 915 MHz
|
#define RADIOLIB_RF69_FRF_LSB 0x00 // 7 0 default value: 915 MHz
|
||||||
|
|
||||||
// RF69_REG_OSC_1
|
// RADIOLIB_RF69_REG_OSC_1
|
||||||
#define RADIOLIB_RF69_RC_CAL_START 0b10000000 // 7 7 force RC oscillator calibration
|
#define RADIOLIB_RF69_RC_CAL_START 0b10000000 // 7 7 force RC oscillator calibration
|
||||||
#define RADIOLIB_RF69_RC_CAL_RUNNING 0b00000000 // 6 6 RC oscillator calibration is still running
|
#define RADIOLIB_RF69_RC_CAL_RUNNING 0b00000000 // 6 6 RC oscillator calibration is still running
|
||||||
#define RADIOLIB_RF69_RC_CAL_DONE 0b00000000 // 5 5 RC oscillator calibration has finished
|
#define RADIOLIB_RF69_RC_CAL_DONE 0b00000000 // 5 5 RC oscillator calibration has finished
|
||||||
|
|
||||||
// RF69_REG_AFC_CTRL
|
// RADIOLIB_RF69_REG_AFC_CTRL
|
||||||
#define RADIOLIB_RF69_AFC_LOW_BETA_OFF 0b00000000 // 5 5 standard AFC routine
|
#define RADIOLIB_RF69_AFC_LOW_BETA_OFF 0b00000000 // 5 5 standard AFC routine
|
||||||
#define RADIOLIB_RF69_AFC_LOW_BETA_ON 0b00100000 // 5 5 improved AFC routine for signals with modulation index less than 2
|
#define RADIOLIB_RF69_AFC_LOW_BETA_ON 0b00100000 // 5 5 improved AFC routine for signals with modulation index less than 2
|
||||||
|
|
||||||
// RF69_REG_LISTEN_1
|
// RADIOLIB_RF69_REG_LISTEN_1
|
||||||
#define RADIOLIB_RF69_LISTEN_RES_IDLE_64_US 0b01000000 // 7 6 resolution of Listen mode idle time: 64 us
|
#define RADIOLIB_RF69_LISTEN_RES_IDLE_64_US 0b01000000 // 7 6 resolution of Listen mode idle time: 64 us
|
||||||
#define RADIOLIB_RF69_LISTEN_RES_IDLE_4_1_MS 0b10000000 // 7 6 4.1 ms (default)
|
#define RADIOLIB_RF69_LISTEN_RES_IDLE_4_1_MS 0b10000000 // 7 6 4.1 ms (default)
|
||||||
#define RADIOLIB_RF69_LISTEN_RES_IDLE_262_MS 0b11000000 // 7 6 262 ms
|
#define RADIOLIB_RF69_LISTEN_RES_IDLE_262_MS 0b11000000 // 7 6 262 ms
|
||||||
|
@ -157,16 +157,16 @@
|
||||||
#define RADIOLIB_RF69_LISTEN_END_KEEP_RX_TIMEOUT 0b00000010 // 2 1 stay in Rx mode until timeout (default)
|
#define RADIOLIB_RF69_LISTEN_END_KEEP_RX_TIMEOUT 0b00000010 // 2 1 stay in Rx mode until timeout (default)
|
||||||
#define RADIOLIB_RF69_LISTEN_END_KEEP_RX_TIMEOUT_RESUME 0b00000100 // 2 1 stay in Rx mode until timeout, Listen mode will resume
|
#define RADIOLIB_RF69_LISTEN_END_KEEP_RX_TIMEOUT_RESUME 0b00000100 // 2 1 stay in Rx mode until timeout, Listen mode will resume
|
||||||
|
|
||||||
// RF69_REG_LISTEN_2
|
// RADIOLIB_RF69_REG_LISTEN_2
|
||||||
#define RADIOLIB_RF69_LISTEN_COEF_IDLE 0xF5 // 7 0 duration of idle phase in Listen mode
|
#define RADIOLIB_RF69_LISTEN_COEF_IDLE 0xF5 // 7 0 duration of idle phase in Listen mode
|
||||||
|
|
||||||
// RF69_REG_LISTEN_3
|
// RADIOLIB_RF69_REG_LISTEN_3
|
||||||
#define RADIOLIB_RF69_LISTEN_COEF_RX 0x20 // 7 0 duration of Rx phase in Listen mode
|
#define RADIOLIB_RF69_LISTEN_COEF_RX 0x20 // 7 0 duration of Rx phase in Listen mode
|
||||||
|
|
||||||
// RF69_REG_VERSION
|
// RADIOLIB_RF69_REG_VERSION
|
||||||
#define RADIOLIB_RF69_CHIP_VERSION 0x24 // 7 0
|
#define RADIOLIB_RF69_CHIP_VERSION 0x24 // 7 0
|
||||||
|
|
||||||
// RF69_REG_PA_LEVEL
|
// RADIOLIB_RF69_REG_PA_LEVEL
|
||||||
#define RADIOLIB_RF69_PA0_OFF 0b00000000 // 7 7 PA0 disabled
|
#define RADIOLIB_RF69_PA0_OFF 0b00000000 // 7 7 PA0 disabled
|
||||||
#define RADIOLIB_RF69_PA0_ON 0b10000000 // 7 7 PA0 enabled (default)
|
#define RADIOLIB_RF69_PA0_ON 0b10000000 // 7 7 PA0 enabled (default)
|
||||||
#define RADIOLIB_RF69_PA1_OFF 0b00000000 // 6 6 PA1 disabled (default)
|
#define RADIOLIB_RF69_PA1_OFF 0b00000000 // 6 6 PA1 disabled (default)
|
||||||
|
@ -175,7 +175,7 @@
|
||||||
#define RADIOLIB_RF69_PA2_ON 0b00100000 // 5 5 PA2 enabled
|
#define RADIOLIB_RF69_PA2_ON 0b00100000 // 5 5 PA2 enabled
|
||||||
#define RADIOLIB_RF69_OUTPUT_POWER 0b00011111 // 4 0 output power: P_out = -18 + OUTPUT_POWER
|
#define RADIOLIB_RF69_OUTPUT_POWER 0b00011111 // 4 0 output power: P_out = -18 + OUTPUT_POWER
|
||||||
|
|
||||||
// RF69_REG_PA_RAMP
|
// RADIOLIB_RF69_REG_PA_RAMP
|
||||||
#define RADIOLIB_RF69_PA_RAMP_3_4_MS 0b00000000 // 3 0 PA ramp rise/fall time: 3.4 ms
|
#define RADIOLIB_RF69_PA_RAMP_3_4_MS 0b00000000 // 3 0 PA ramp rise/fall time: 3.4 ms
|
||||||
#define RADIOLIB_RF69_PA_RAMP_2_MS 0b00000001 // 3 0 2 ms
|
#define RADIOLIB_RF69_PA_RAMP_2_MS 0b00000001 // 3 0 2 ms
|
||||||
#define RADIOLIB_RF69_PA_RAMP_1_MS 0b00000010 // 3 0 1 ms
|
#define RADIOLIB_RF69_PA_RAMP_1_MS 0b00000010 // 3 0 1 ms
|
||||||
|
@ -193,12 +193,12 @@
|
||||||
#define RADIOLIB_RF69_PA_RAMP_12_US 0b00001110 // 3 0 12 us
|
#define RADIOLIB_RF69_PA_RAMP_12_US 0b00001110 // 3 0 12 us
|
||||||
#define RADIOLIB_RF69_PA_RAMP_10_US 0b00001111 // 3 0 10 us
|
#define RADIOLIB_RF69_PA_RAMP_10_US 0b00001111 // 3 0 10 us
|
||||||
|
|
||||||
// RF69_REG_OCP
|
// RADIOLIB_RF69_REG_OCP
|
||||||
#define RADIOLIB_RF69_OCP_OFF 0b00000000 // 4 4 PA overload current protection disabled
|
#define RADIOLIB_RF69_OCP_OFF 0b00000000 // 4 4 PA overload current protection disabled
|
||||||
#define RADIOLIB_RF69_OCP_ON 0b00010000 // 4 4 PA overload current protection enabled
|
#define RADIOLIB_RF69_OCP_ON 0b00010000 // 4 4 PA overload current protection enabled
|
||||||
#define RADIOLIB_RF69_OCP_TRIM 0b00001010 // 3 0 OCP current: I_max(OCP_TRIM = 0b1010) = 95 mA
|
#define RADIOLIB_RF69_OCP_TRIM 0b00001010 // 3 0 OCP current: I_max(OCP_TRIM = 0b1010) = 95 mA
|
||||||
|
|
||||||
// RF69_REG_LNA
|
// RADIOLIB_RF69_REG_LNA
|
||||||
#define RADIOLIB_RF69_LNA_Z_IN_50_OHM 0b00000000 // 7 7 LNA input impedance: 50 ohm
|
#define RADIOLIB_RF69_LNA_Z_IN_50_OHM 0b00000000 // 7 7 LNA input impedance: 50 ohm
|
||||||
#define RADIOLIB_RF69_LNA_Z_IN_200_OHM 0b10000000 // 7 7 200 ohm
|
#define RADIOLIB_RF69_LNA_Z_IN_200_OHM 0b10000000 // 7 7 200 ohm
|
||||||
#define RADIOLIB_RF69_LNA_CURRENT_GAIN 0b00001000 // 5 3 manually set LNA current gain
|
#define RADIOLIB_RF69_LNA_CURRENT_GAIN 0b00001000 // 5 3 manually set LNA current gain
|
||||||
|
@ -210,19 +210,19 @@
|
||||||
#define RADIOLIB_RF69_LNA_GAIN_MAX_36_DB 0b00000101 // 2 0 max gain - 36 dB
|
#define RADIOLIB_RF69_LNA_GAIN_MAX_36_DB 0b00000101 // 2 0 max gain - 36 dB
|
||||||
#define RADIOLIB_RF69_LNA_GAIN_MAX_48_DB 0b00000110 // 2 0 max gain - 48 dB
|
#define RADIOLIB_RF69_LNA_GAIN_MAX_48_DB 0b00000110 // 2 0 max gain - 48 dB
|
||||||
|
|
||||||
// RF69_REG_RX_BW
|
// RADIOLIB_RF69_REG_RX_BW
|
||||||
#define RADIOLIB_RF69_DCC_FREQ 0b01000000 // 7 5 DC offset canceller cutoff frequency (4% Rx BW by default)
|
#define RADIOLIB_RF69_DCC_FREQ 0b01000000 // 7 5 DC offset canceller cutoff frequency (4% Rx BW by default)
|
||||||
#define RADIOLIB_RF69_RX_BW_MANT_16 0b00000000 // 4 3 Channel filter bandwidth FSK: RxBw = F(XOSC)/(RxBwMant * 2^(RxBwExp + 2))
|
#define RADIOLIB_RF69_RX_BW_MANT_16 0b00000000 // 4 3 Channel filter bandwidth FSK: RxBw = F(XOSC)/(RxBwMant * 2^(RxBwExp + 2))
|
||||||
#define RADIOLIB_RF69_RX_BW_MANT_20 0b00001000 // 4 3 OOK: RxBw = F(XOSC)/(RxBwMant * 2^(RxBwExp + 3))
|
#define RADIOLIB_RF69_RX_BW_MANT_20 0b00001000 // 4 3 OOK: RxBw = F(XOSC)/(RxBwMant * 2^(RxBwExp + 3))
|
||||||
#define RADIOLIB_RF69_RX_BW_MANT_24 0b00010000 // 4 3
|
#define RADIOLIB_RF69_RX_BW_MANT_24 0b00010000 // 4 3
|
||||||
#define RADIOLIB_RF69_RX_BW_EXP 0b00000101 // 2 0 default RxBwExp value = 5
|
#define RADIOLIB_RF69_RX_BW_EXP 0b00000101 // 2 0 default RxBwExp value = 5
|
||||||
|
|
||||||
// RF69_REG_AFC_BW
|
// RADIOLIB_RF69_REG_AFC_BW
|
||||||
#define RADIOLIB_RF69_DCC_FREQ_AFC 0b10000000 // 7 5 default DccFreq parameter for AFC
|
#define RADIOLIB_RF69_DCC_FREQ_AFC 0b10000000 // 7 5 default DccFreq parameter for AFC
|
||||||
#define RADIOLIB_RF69_DCC_RX_BW_MANT_AFC 0b00001000 // 4 3 default RxBwMant parameter for AFC
|
#define RADIOLIB_RF69_DCC_RX_BW_MANT_AFC 0b00001000 // 4 3 default RxBwMant parameter for AFC
|
||||||
#define RADIOLIB_RF69_DCC_RX_BW_EXP_AFC 0b00000011 // 2 0 default RxBwExp parameter for AFC
|
#define RADIOLIB_RF69_DCC_RX_BW_EXP_AFC 0b00000011 // 2 0 default RxBwExp parameter for AFC
|
||||||
|
|
||||||
// RF69_REG_OOK_PEAK
|
// RADIOLIB_RF69_REG_OOK_PEAK
|
||||||
#define RADIOLIB_RF69_OOK_THRESH_FIXED 0b00000000 // 7 6 OOK threshold type: fixed
|
#define RADIOLIB_RF69_OOK_THRESH_FIXED 0b00000000 // 7 6 OOK threshold type: fixed
|
||||||
#define RADIOLIB_RF69_OOK_THRESH_PEAK 0b01000000 // 7 6 peak (default)
|
#define RADIOLIB_RF69_OOK_THRESH_PEAK 0b01000000 // 7 6 peak (default)
|
||||||
#define RADIOLIB_RF69_OOK_THRESH_AVERAGE 0b10000000 // 7 6 average
|
#define RADIOLIB_RF69_OOK_THRESH_AVERAGE 0b10000000 // 7 6 average
|
||||||
|
@ -243,16 +243,16 @@
|
||||||
#define RADIOLIB_RF69_OOK_PEAK_THRESH_DEC_8_1_CHIP 0b00000110 // 2 0 8 times per chip
|
#define RADIOLIB_RF69_OOK_PEAK_THRESH_DEC_8_1_CHIP 0b00000110 // 2 0 8 times per chip
|
||||||
#define RADIOLIB_RF69_OOK_PEAK_THRESH_DEC_16_1_CHIP 0b00000111 // 2 0 16 times per chip
|
#define RADIOLIB_RF69_OOK_PEAK_THRESH_DEC_16_1_CHIP 0b00000111 // 2 0 16 times per chip
|
||||||
|
|
||||||
// RF69_REG_OOK_AVG
|
// RADIOLIB_RF69_REG_OOK_AVG
|
||||||
#define RADIOLIB_RF69_OOK_AVG_THRESH_FILT_32_PI 0b00000000 // 7 6 OOK average filter coefficient: chip rate / 32*pi
|
#define RADIOLIB_RF69_OOK_AVG_THRESH_FILT_32_PI 0b00000000 // 7 6 OOK average filter coefficient: chip rate / 32*pi
|
||||||
#define RADIOLIB_RF69_OOK_AVG_THRESH_FILT_8_PI 0b01000000 // 7 6 chip rate / 8*pi
|
#define RADIOLIB_RF69_OOK_AVG_THRESH_FILT_8_PI 0b01000000 // 7 6 chip rate / 8*pi
|
||||||
#define RADIOLIB_RF69_OOK_AVG_THRESH_FILT_4_PI 0b10000000 // 7 6 chip rate / 4*pi (default)
|
#define RADIOLIB_RF69_OOK_AVG_THRESH_FILT_4_PI 0b10000000 // 7 6 chip rate / 4*pi (default)
|
||||||
#define RADIOLIB_RF69_OOK_AVG_THRESH_FILT_2_PI 0b11000000 // 7 6 chip rate / 2*pi
|
#define RADIOLIB_RF69_OOK_AVG_THRESH_FILT_2_PI 0b11000000 // 7 6 chip rate / 2*pi
|
||||||
|
|
||||||
// RF69_REG_OOK_FIX
|
// RADIOLIB_RF69_REG_OOK_FIX
|
||||||
#define RADIOLIB_RF69_OOK_FIXED_THRESH 0b00000110 // 7 0 default OOK fixed threshold (6 dB)
|
#define RADIOLIB_RF69_OOK_FIXED_THRESH 0b00000110 // 7 0 default OOK fixed threshold (6 dB)
|
||||||
|
|
||||||
// RF69_REG_AFC_FEI
|
// RADIOLIB_RF69_REG_AFC_FEI
|
||||||
#define RADIOLIB_RF69_FEI_RUNNING 0b00000000 // 6 6 FEI status: on-going
|
#define RADIOLIB_RF69_FEI_RUNNING 0b00000000 // 6 6 FEI status: on-going
|
||||||
#define RADIOLIB_RF69_FEI_DONE 0b01000000 // 6 6 done
|
#define RADIOLIB_RF69_FEI_DONE 0b01000000 // 6 6 done
|
||||||
#define RADIOLIB_RF69_FEI_START 0b00100000 // 5 5 force new FEI measurement
|
#define RADIOLIB_RF69_FEI_START 0b00100000 // 5 5 force new FEI measurement
|
||||||
|
@ -265,12 +265,12 @@
|
||||||
#define RADIOLIB_RF69_AFC_CLEAR 0b00000010 // 1 1 clear AFC register
|
#define RADIOLIB_RF69_AFC_CLEAR 0b00000010 // 1 1 clear AFC register
|
||||||
#define RADIOLIB_RF69_AFC_START 0b00000001 // 0 0 start AFC
|
#define RADIOLIB_RF69_AFC_START 0b00000001 // 0 0 start AFC
|
||||||
|
|
||||||
// RF69_REG_RSSI_CONFIG
|
// RADIOLIB_RF69_REG_RSSI_CONFIG
|
||||||
#define RADIOLIB_RF69_RSSI_RUNNING 0b00000000 // 1 1 RSSI status: on-going
|
#define RADIOLIB_RF69_RSSI_RUNNING 0b00000000 // 1 1 RSSI status: on-going
|
||||||
#define RADIOLIB_RF69_RSSI_DONE 0b00000010 // 1 1 done
|
#define RADIOLIB_RF69_RSSI_DONE 0b00000010 // 1 1 done
|
||||||
#define RADIOLIB_RF69_RSSI_START 0b00000001 // 0 0 start RSSI measurement
|
#define RADIOLIB_RF69_RSSI_START 0b00000001 // 0 0 start RSSI measurement
|
||||||
|
|
||||||
// RF69_REG_DIO_MAPPING_1
|
// RADIOLIB_RF69_REG_DIO_MAPPING_1
|
||||||
#define RADIOLIB_RF69_DIO0_CONT_MODE_READY 0b11000000 // 7 6
|
#define RADIOLIB_RF69_DIO0_CONT_MODE_READY 0b11000000 // 7 6
|
||||||
#define RADIOLIB_RF69_DIO0_CONT_PLL_LOCK 0b00000000 // 7 6
|
#define RADIOLIB_RF69_DIO0_CONT_PLL_LOCK 0b00000000 // 7 6
|
||||||
#define RADIOLIB_RF69_DIO0_CONT_SYNC_ADDRESS 0b00000000 // 7 6
|
#define RADIOLIB_RF69_DIO0_CONT_SYNC_ADDRESS 0b00000000 // 7 6
|
||||||
|
@ -309,7 +309,7 @@
|
||||||
#define RADIOLIB_RF69_DIO3_PACK_SYNC_ADDRESSS 0b00000010 // 0 1
|
#define RADIOLIB_RF69_DIO3_PACK_SYNC_ADDRESSS 0b00000010 // 0 1
|
||||||
#define RADIOLIB_RF69_DIO3_PACK_TX_READY 0b00000001 // 0 1
|
#define RADIOLIB_RF69_DIO3_PACK_TX_READY 0b00000001 // 0 1
|
||||||
|
|
||||||
// RF69_REG_DIO_MAPPING_2
|
// RADIOLIB_RF69_REG_DIO_MAPPING_2
|
||||||
#define RADIOLIB_RF69_DIO4_CONT_PLL_LOCK 0b11000000 // 7 6
|
#define RADIOLIB_RF69_DIO4_CONT_PLL_LOCK 0b11000000 // 7 6
|
||||||
#define RADIOLIB_RF69_DIO4_CONT_TIMEOUT 0b00000000 // 7 6
|
#define RADIOLIB_RF69_DIO4_CONT_TIMEOUT 0b00000000 // 7 6
|
||||||
#define RADIOLIB_RF69_DIO4_CONT_RX_READY 0b01000000 // 7 6
|
#define RADIOLIB_RF69_DIO4_CONT_RX_READY 0b01000000 // 7 6
|
||||||
|
@ -336,7 +336,7 @@
|
||||||
#define RADIOLIB_RF69_CLK_OUT_RC 0b00000110 // 2 0 RC
|
#define RADIOLIB_RF69_CLK_OUT_RC 0b00000110 // 2 0 RC
|
||||||
#define RADIOLIB_RF69_CLK_OUT_OFF 0b00000111 // 2 0 disabled (default)
|
#define RADIOLIB_RF69_CLK_OUT_OFF 0b00000111 // 2 0 disabled (default)
|
||||||
|
|
||||||
// RF69_REG_IRQ_FLAGS_1
|
// RADIOLIB_RF69_REG_IRQ_FLAGS_1
|
||||||
#define RADIOLIB_RF69_IRQ_MODE_READY 0b10000000 // 7 7 requested mode was set
|
#define RADIOLIB_RF69_IRQ_MODE_READY 0b10000000 // 7 7 requested mode was set
|
||||||
#define RADIOLIB_RF69_IRQ_RX_READY 0b01000000 // 6 6 Rx mode ready
|
#define RADIOLIB_RF69_IRQ_RX_READY 0b01000000 // 6 6 Rx mode ready
|
||||||
#define RADIOLIB_RF69_IRQ_TX_READY 0b00100000 // 5 5 Tx mode ready
|
#define RADIOLIB_RF69_IRQ_TX_READY 0b00100000 // 5 5 Tx mode ready
|
||||||
|
@ -346,7 +346,7 @@
|
||||||
#define RADIOLIB_RF69_IRQ_AUTO_MODE 0b00000010 // 1 1 entered intermediate mode
|
#define RADIOLIB_RF69_IRQ_AUTO_MODE 0b00000010 // 1 1 entered intermediate mode
|
||||||
#define RADIOLIB_RF69_SYNC_ADDRESS_MATCH 0b00000001 // 0 0 sync address detected
|
#define RADIOLIB_RF69_SYNC_ADDRESS_MATCH 0b00000001 // 0 0 sync address detected
|
||||||
|
|
||||||
// RF69_REG_IRQ_FLAGS_2
|
// RADIOLIB_RF69_REG_IRQ_FLAGS_2
|
||||||
#define RADIOLIB_RF69_IRQ_FIFO_FULL 0b10000000 // 7 7 FIFO is full
|
#define RADIOLIB_RF69_IRQ_FIFO_FULL 0b10000000 // 7 7 FIFO is full
|
||||||
#define RADIOLIB_RF69_IRQ_FIFO_NOT_EMPTY 0b01000000 // 6 6 FIFO contains at least 1 byte
|
#define RADIOLIB_RF69_IRQ_FIFO_NOT_EMPTY 0b01000000 // 6 6 FIFO contains at least 1 byte
|
||||||
#define RADIOLIB_RF69_IRQ_FIFO_LEVEL 0b00100000 // 5 5 FIFO contains more than FifoThreshold bytes
|
#define RADIOLIB_RF69_IRQ_FIFO_LEVEL 0b00100000 // 5 5 FIFO contains more than FifoThreshold bytes
|
||||||
|
@ -355,22 +355,22 @@
|
||||||
#define RADIOLIB_RF69_IRQ_PAYLOAD_READY 0b00000100 // 2 2 last payload byte received and CRC check passed
|
#define RADIOLIB_RF69_IRQ_PAYLOAD_READY 0b00000100 // 2 2 last payload byte received and CRC check passed
|
||||||
#define RADIOLIB_RF69_IRQ_CRC_OK 0b00000010 // 1 1 CRC check passed
|
#define RADIOLIB_RF69_IRQ_CRC_OK 0b00000010 // 1 1 CRC check passed
|
||||||
|
|
||||||
// RF69_REG_RSSI_THRESH
|
// RADIOLIB_RF69_REG_RSSI_THRESH
|
||||||
#define RADIOLIB_RF69_RSSI_THRESHOLD 0xE4 // 7 0 RSSI threshold level (2 dB by default)
|
#define RADIOLIB_RF69_RSSI_THRESHOLD 0xE4 // 7 0 RSSI threshold level (2 dB by default)
|
||||||
|
|
||||||
// RF69_REG_RX_TIMEOUT_1
|
// RADIOLIB_RF69_REG_RX_TIMEOUT_1
|
||||||
#define RADIOLIB_RF69_TIMEOUT_RX_START_OFF 0x00 // 7 0 RSSI interrupt timeout disabled (default)
|
#define RADIOLIB_RF69_TIMEOUT_RX_START_OFF 0x00 // 7 0 RSSI interrupt timeout disabled (default)
|
||||||
#define RADIOLIB_RF69_TIMEOUT_RX_START 0xFF // 7 0 timeout will occur if RSSI interrupt is not received
|
#define RADIOLIB_RF69_TIMEOUT_RX_START 0xFF // 7 0 timeout will occur if RSSI interrupt is not received
|
||||||
|
|
||||||
// RF69_REG_RX_TIMEOUT_2
|
// RADIOLIB_RF69_REG_RX_TIMEOUT_2
|
||||||
#define RADIOLIB_RF69_TIMEOUT_RSSI_THRESH_OFF 0x00 // 7 0 PayloadReady interrupt timeout disabled (default)
|
#define RADIOLIB_RF69_TIMEOUT_RSSI_THRESH_OFF 0x00 // 7 0 PayloadReady interrupt timeout disabled (default)
|
||||||
#define RADIOLIB_RF69_TIMEOUT_RSSI_THRESH 0xFF // 7 0 timeout will occur if PayloadReady interrupt is not received
|
#define RADIOLIB_RF69_TIMEOUT_RSSI_THRESH 0xFF // 7 0 timeout will occur if PayloadReady interrupt is not received
|
||||||
|
|
||||||
// RF69_REG_PREAMBLE_MSB + REG_PREAMBLE_MSB
|
// RADIOLIB_RF69_REG_PREAMBLE_MSB + REG_PREAMBLE_MSB
|
||||||
#define RADIOLIB_RF69_PREAMBLE_MSB 0x00 // 7 0 2-byte preamble size value
|
#define RADIOLIB_RF69_PREAMBLE_MSB 0x00 // 7 0 2-byte preamble size value
|
||||||
#define RADIOLIB_RF69_PREAMBLE_LSB 0x03 // 7 0
|
#define RADIOLIB_RF69_PREAMBLE_LSB 0x03 // 7 0
|
||||||
|
|
||||||
// RF69_REG_SYNC_CONFIG
|
// RADIOLIB_RF69_REG_SYNC_CONFIG
|
||||||
#define RADIOLIB_RF69_SYNC_OFF 0b00000000 // 7 7 sync word detection off
|
#define RADIOLIB_RF69_SYNC_OFF 0b00000000 // 7 7 sync word detection off
|
||||||
#define RADIOLIB_RF69_SYNC_ON 0b10000000 // 7 7 sync word detection on (default)
|
#define RADIOLIB_RF69_SYNC_ON 0b10000000 // 7 7 sync word detection on (default)
|
||||||
#define RADIOLIB_RF69_FIFO_FILL_CONDITION_SYNC 0b00000000 // 6 6 FIFO fill condition: on SyncAddress interrupt (default)
|
#define RADIOLIB_RF69_FIFO_FILL_CONDITION_SYNC 0b00000000 // 6 6 FIFO fill condition: on SyncAddress interrupt (default)
|
||||||
|
@ -378,7 +378,7 @@
|
||||||
#define RADIOLIB_RF69_SYNC_SIZE 0b00001000 // 5 3 size of sync word: SyncSize + 1 bytes
|
#define RADIOLIB_RF69_SYNC_SIZE 0b00001000 // 5 3 size of sync word: SyncSize + 1 bytes
|
||||||
#define RADIOLIB_RF69_SYNC_TOL 0b00000000 // 2 0 number of tolerated errors in sync word
|
#define RADIOLIB_RF69_SYNC_TOL 0b00000000 // 2 0 number of tolerated errors in sync word
|
||||||
|
|
||||||
// RF69_REG_SYNC_VALUE_1 - SYNC_VALUE_8
|
// RADIOLIB_RF69_REG_SYNC_VALUE_1 - SYNC_VALUE_8
|
||||||
#define RADIOLIB_RF69_SYNC_BYTE_1 0x01 // 7 0 sync word: 1st byte (MSB)
|
#define RADIOLIB_RF69_SYNC_BYTE_1 0x01 // 7 0 sync word: 1st byte (MSB)
|
||||||
#define RADIOLIB_RF69_SYNC_BYTE_2 0x01 // 7 0 2nd byte
|
#define RADIOLIB_RF69_SYNC_BYTE_2 0x01 // 7 0 2nd byte
|
||||||
#define RADIOLIB_RF69_SYNC_BYTE_3 0x01 // 7 0 3rd byte
|
#define RADIOLIB_RF69_SYNC_BYTE_3 0x01 // 7 0 3rd byte
|
||||||
|
@ -388,7 +388,7 @@
|
||||||
#define RADIOLIB_RF69_SYNC_BYTE_7 0x01 // 7 0 7th byte
|
#define RADIOLIB_RF69_SYNC_BYTE_7 0x01 // 7 0 7th byte
|
||||||
#define RADIOLIB_RF69_SYNC_BYTE_8 0x01 // 7 0 8th byte (LSB)
|
#define RADIOLIB_RF69_SYNC_BYTE_8 0x01 // 7 0 8th byte (LSB)
|
||||||
|
|
||||||
// RF69_REG_PACKET_CONFIG_1
|
// RADIOLIB_RF69_REG_PACKET_CONFIG_1
|
||||||
#define RADIOLIB_RF69_PACKET_FORMAT_FIXED 0b00000000 // 7 7 fixed packet length (default)
|
#define RADIOLIB_RF69_PACKET_FORMAT_FIXED 0b00000000 // 7 7 fixed packet length (default)
|
||||||
#define RADIOLIB_RF69_PACKET_FORMAT_VARIABLE 0b10000000 // 7 7 variable packet length
|
#define RADIOLIB_RF69_PACKET_FORMAT_VARIABLE 0b10000000 // 7 7 variable packet length
|
||||||
#define RADIOLIB_RF69_DC_FREE_NONE 0b00000000 // 6 5 DC-free encoding: none (default)
|
#define RADIOLIB_RF69_DC_FREE_NONE 0b00000000 // 6 5 DC-free encoding: none (default)
|
||||||
|
@ -402,10 +402,10 @@
|
||||||
#define RADIOLIB_RF69_ADDRESS_FILTERING_NODE 0b00000010 // 2 1 node
|
#define RADIOLIB_RF69_ADDRESS_FILTERING_NODE 0b00000010 // 2 1 node
|
||||||
#define RADIOLIB_RF69_ADDRESS_FILTERING_NODE_BROADCAST 0b00000100 // 2 1 node or broadcast
|
#define RADIOLIB_RF69_ADDRESS_FILTERING_NODE_BROADCAST 0b00000100 // 2 1 node or broadcast
|
||||||
|
|
||||||
// RF69_REG_PAYLOAD_LENGTH
|
// RADIOLIB_RF69_REG_PAYLOAD_LENGTH
|
||||||
#define RADIOLIB_RF69_PAYLOAD_LENGTH 0xFF // 7 0 payload length
|
#define RADIOLIB_RF69_PAYLOAD_LENGTH 0xFF // 7 0 payload length
|
||||||
|
|
||||||
// RF69_REG_AUTO_MODES
|
// RADIOLIB_RF69_REG_AUTO_MODES
|
||||||
#define RADIOLIB_RF69_ENTER_COND_NONE 0b00000000 // 7 5 condition for entering intermediate mode: none, AutoModes disabled (default)
|
#define RADIOLIB_RF69_ENTER_COND_NONE 0b00000000 // 7 5 condition for entering intermediate mode: none, AutoModes disabled (default)
|
||||||
#define RADIOLIB_RF69_ENTER_COND_FIFO_NOT_EMPTY 0b00100000 // 7 5 FifoNotEmpty rising edge
|
#define RADIOLIB_RF69_ENTER_COND_FIFO_NOT_EMPTY 0b00100000 // 7 5 FifoNotEmpty rising edge
|
||||||
#define RADIOLIB_RF69_ENTER_COND_FIFO_LEVEL 0b01000000 // 7 5 FifoLevel rising edge
|
#define RADIOLIB_RF69_ENTER_COND_FIFO_LEVEL 0b01000000 // 7 5 FifoLevel rising edge
|
||||||
|
@ -427,12 +427,12 @@
|
||||||
#define RADIOLIB_RF69_INTER_MODE_RX 0b00000010 // 1 0 Rx
|
#define RADIOLIB_RF69_INTER_MODE_RX 0b00000010 // 1 0 Rx
|
||||||
#define RADIOLIB_RF69_INTER_MODE_TX 0b00000011 // 1 0 Tx
|
#define RADIOLIB_RF69_INTER_MODE_TX 0b00000011 // 1 0 Tx
|
||||||
|
|
||||||
// RF69_REG_FIFO_THRESH
|
// RADIOLIB_RF69_REG_FIFO_THRESH
|
||||||
#define RADIOLIB_RF69_TX_START_CONDITION_FIFO_LEVEL 0b00000000 // 7 7 packet transmission start condition: FifoLevel
|
#define RADIOLIB_RF69_TX_START_CONDITION_FIFO_LEVEL 0b00000000 // 7 7 packet transmission start condition: FifoLevel
|
||||||
#define RADIOLIB_RF69_TX_START_CONDITION_FIFO_NOT_EMPTY 0b10000000 // 7 7 FifoNotEmpty (default)
|
#define RADIOLIB_RF69_TX_START_CONDITION_FIFO_NOT_EMPTY 0b10000000 // 7 7 FifoNotEmpty (default)
|
||||||
#define RADIOLIB_RF69_FIFO_THRESH 0x1F // 6 0 default threshold to trigger FifoLevel interrupt
|
#define RADIOLIB_RF69_FIFO_THRESH 0x1F // 6 0 default threshold to trigger FifoLevel interrupt
|
||||||
|
|
||||||
// RF69_REG_PACKET_CONFIG_2
|
// RADIOLIB_RF69_REG_PACKET_CONFIG_2
|
||||||
#define RADIOLIB_RF69_INTER_PACKET_RX_DELAY 0b00000000 // 7 4 delay between FIFO empty and start of new RSSI phase
|
#define RADIOLIB_RF69_INTER_PACKET_RX_DELAY 0b00000000 // 7 4 delay between FIFO empty and start of new RSSI phase
|
||||||
#define RADIOLIB_RF69_RESTART_RX 0b00000100 // 2 2 force receiver into wait mode
|
#define RADIOLIB_RF69_RESTART_RX 0b00000100 // 2 2 force receiver into wait mode
|
||||||
#define RADIOLIB_RF69_AUTO_RX_RESTART_OFF 0b00000000 // 1 1 auto Rx restart disabled
|
#define RADIOLIB_RF69_AUTO_RX_RESTART_OFF 0b00000000 // 1 1 auto Rx restart disabled
|
||||||
|
@ -440,29 +440,29 @@
|
||||||
#define RADIOLIB_RF69_AES_OFF 0b00000000 // 0 0 AES encryption disabled (default)
|
#define RADIOLIB_RF69_AES_OFF 0b00000000 // 0 0 AES encryption disabled (default)
|
||||||
#define RADIOLIB_RF69_AES_ON 0b00000001 // 0 0 AES encryption enabled, payload size limited to 66 bytes
|
#define RADIOLIB_RF69_AES_ON 0b00000001 // 0 0 AES encryption enabled, payload size limited to 66 bytes
|
||||||
|
|
||||||
// RF69_REG_TEST_LNA
|
// RADIOLIB_RF69_REG_TEST_LNA
|
||||||
#define RADIOLIB_RF69_TEST_LNA_BOOST_NORMAL 0x1B // 7 0
|
#define RADIOLIB_RF69_TEST_LNA_BOOST_NORMAL 0x1B // 7 0
|
||||||
#define RADIOLIB_RF69_TEST_LNA_BOOST_HIGH 0x2D // 7 0
|
#define RADIOLIB_RF69_TEST_LNA_BOOST_HIGH 0x2D // 7 0
|
||||||
|
|
||||||
// RF69_REG_TEMP_1
|
// RADIOLIB_RF69_REG_TEMP_1
|
||||||
#define RADIOLIB_RF69_TEMP_MEAS_START 0b00001000 // 3 3 trigger temperature measurement
|
#define RADIOLIB_RF69_TEMP_MEAS_START 0b00001000 // 3 3 trigger temperature measurement
|
||||||
#define RADIOLIB_RF69_TEMP_MEAS_RUNNING 0b00000100 // 2 2 temperature measurement status: on-going
|
#define RADIOLIB_RF69_TEMP_MEAS_RUNNING 0b00000100 // 2 2 temperature measurement status: on-going
|
||||||
#define RADIOLIB_RF69_TEMP_MEAS_DONE 0b00000000 // 2 2 done
|
#define RADIOLIB_RF69_TEMP_MEAS_DONE 0b00000000 // 2 2 done
|
||||||
|
|
||||||
// RF69_REG_TEST_DAGC
|
// RADIOLIB_RF69_REG_TEST_DAGC
|
||||||
#define RADIOLIB_RF69_CONTINUOUS_DAGC_NORMAL 0x00 // 7 0 fading margin improvement: normal mode
|
#define RADIOLIB_RF69_CONTINUOUS_DAGC_NORMAL 0x00 // 7 0 fading margin improvement: normal mode
|
||||||
#define RADIOLIB_RF69_CONTINUOUS_DAGC_LOW_BETA_ON 0x20 // 7 0 improved mode for AfcLowBetaOn
|
#define RADIOLIB_RF69_CONTINUOUS_DAGC_LOW_BETA_ON 0x20 // 7 0 improved mode for AfcLowBetaOn
|
||||||
#define RADIOLIB_RF69_CONTINUOUS_DAGC_LOW_BETA_OFF 0x30 // 7 0 improved mode for AfcLowBetaOff (default)
|
#define RADIOLIB_RF69_CONTINUOUS_DAGC_LOW_BETA_OFF 0x30 // 7 0 improved mode for AfcLowBetaOff (default)
|
||||||
|
|
||||||
// RF69_REG_TEST_PA1
|
// RADIOLIB_RF69_REG_TEST_PA1
|
||||||
#define RADIOLIB_RF69_PA1_NORMAL 0x55 // 7 0 PA_BOOST: none
|
#define RADIOLIB_RF69_PA1_NORMAL 0x55 // 7 0 PA_BOOST: none
|
||||||
#define RADIOLIB_RF69_PA1_20_DBM 0x5D // 7 0 +20 dBm
|
#define RADIOLIB_RF69_PA1_20_DBM 0x5D // 7 0 +20 dBm
|
||||||
|
|
||||||
// RF69_REG_TEST_PA2
|
// RADIOLIB_RF69_REG_TEST_PA2
|
||||||
#define RADIOLIB_RF69_PA2_NORMAL 0x70 // 7 0 PA_BOOST: none
|
#define RADIOLIB_RF69_PA2_NORMAL 0x70 // 7 0 PA_BOOST: none
|
||||||
#define RADIOLIB_RF69_PA2_20_DBM 0x7C // 7 0 +20 dBm
|
#define RADIOLIB_RF69_PA2_20_DBM 0x7C // 7 0 +20 dBm
|
||||||
|
|
||||||
// Defaults
|
// RadioLib defaults
|
||||||
#define RADIOLIB_RF69_DEFAULT_FREQ 434.0
|
#define RADIOLIB_RF69_DEFAULT_FREQ 434.0
|
||||||
#define RADIOLIB_RF69_DEFAULT_BR 4.8
|
#define RADIOLIB_RF69_DEFAULT_BR 4.8
|
||||||
#define RADIOLIB_RF69_DEFAULT_FREQDEV 5.0
|
#define RADIOLIB_RF69_DEFAULT_FREQDEV 5.0
|
||||||
|
@ -471,9 +471,9 @@
|
||||||
#define RADIOLIB_RF69_DEFAULT_PREAMBLELEN 16
|
#define RADIOLIB_RF69_DEFAULT_PREAMBLELEN 16
|
||||||
#define RADIOLIB_RF69_DEFAULT_SW {0x12, 0xAD}
|
#define RADIOLIB_RF69_DEFAULT_SW {0x12, 0xAD}
|
||||||
#define RADIOLIB_RF69_DEFAULT_SW_LEN 2
|
#define RADIOLIB_RF69_DEFAULT_SW_LEN 2
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\class RF69
|
\class RF69
|
||||||
|
|
||||||
\brief Control class for %RF69 module. Also serves as base class for SX1231.
|
\brief Control class for %RF69 module. Also serves as base class for SX1231.
|
||||||
*/
|
*/
|
||||||
class RF69: public PhysicalLayer {
|
class RF69: public PhysicalLayer {
|
||||||
|
@ -486,7 +486,6 @@ class RF69: public PhysicalLayer {
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Default constructor.
|
\brief Default constructor.
|
||||||
|
|
||||||
\param mod Instance of Module that will be used to communicate with the radio.
|
\param mod Instance of Module that will be used to communicate with the radio.
|
||||||
*/
|
*/
|
||||||
RF69(Module* module);
|
RF69(Module* module);
|
||||||
|
@ -497,19 +496,12 @@ class RF69: public PhysicalLayer {
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Initialization method.
|
\brief Initialization method.
|
||||||
|
|
||||||
\param freq Carrier frequency in MHz. Defaults to 434.0 MHz.
|
\param freq Carrier frequency in MHz. Defaults to 434.0 MHz.
|
||||||
|
|
||||||
\param br Bit rate to be used in kbps. Defaults to 4.8 kbps.
|
\param br Bit rate to be used in kbps. Defaults to 4.8 kbps.
|
||||||
|
|
||||||
\param freqDev Frequency deviation from carrier frequency in kHz Defaults to 5.0 kHz.
|
\param freqDev Frequency deviation from carrier frequency in kHz Defaults to 5.0 kHz.
|
||||||
|
|
||||||
\param rxBw Receiver bandwidth in kHz. Defaults to 125.0 kHz.
|
\param rxBw Receiver bandwidth in kHz. Defaults to 125.0 kHz.
|
||||||
|
|
||||||
\param power Output power in dBm. Defaults to 10 dBm.
|
\param power Output power in dBm. Defaults to 10 dBm.
|
||||||
|
|
||||||
\param preambleLen Preamble Length in bits. Defaults to 16 bits.
|
\param preambleLen Preamble Length in bits. Defaults to 16 bits.
|
||||||
|
|
||||||
\returns \ref status_codes
|
\returns \ref status_codes
|
||||||
*/
|
*/
|
||||||
int16_t begin(
|
int16_t begin(
|
||||||
|
@ -528,13 +520,9 @@ class RF69: public PhysicalLayer {
|
||||||
/*!
|
/*!
|
||||||
\brief Blocking binary transmit method.
|
\brief Blocking binary transmit method.
|
||||||
Overloads for string-based transmissions are implemented in PhysicalLayer.
|
Overloads for string-based transmissions are implemented in PhysicalLayer.
|
||||||
|
|
||||||
\param data Binary data to be sent.
|
\param data Binary data to be sent.
|
||||||
|
|
||||||
\param len Number of bytes to send.
|
\param len Number of bytes to send.
|
||||||
|
|
||||||
\param addr Address to send the data to. Will only be added if address filtering was enabled.
|
\param addr Address to send the data to. Will only be added if address filtering was enabled.
|
||||||
|
|
||||||
\returns \ref status_codes
|
\returns \ref status_codes
|
||||||
*/
|
*/
|
||||||
int16_t transmit(uint8_t* data, size_t len, uint8_t addr = 0) override;
|
int16_t transmit(uint8_t* data, size_t len, uint8_t addr = 0) override;
|
||||||
|
@ -542,50 +530,40 @@ class RF69: public PhysicalLayer {
|
||||||
/*!
|
/*!
|
||||||
\brief Blocking binary receive method.
|
\brief Blocking binary receive method.
|
||||||
Overloads for string-based transmissions are implemented in PhysicalLayer.
|
Overloads for string-based transmissions are implemented in PhysicalLayer.
|
||||||
|
|
||||||
\param data Binary data to be sent.
|
\param data Binary data to be sent.
|
||||||
|
|
||||||
\param len Number of bytes to send.
|
\param len Number of bytes to send.
|
||||||
|
|
||||||
\returns \ref status_codes
|
\returns \ref status_codes
|
||||||
*/
|
*/
|
||||||
int16_t receive(uint8_t* data, size_t len) override;
|
int16_t receive(uint8_t* data, size_t len) override;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Sets the module to sleep mode.
|
\brief Sets the module to sleep mode.
|
||||||
|
|
||||||
\returns \ref status_codes
|
\returns \ref status_codes
|
||||||
*/
|
*/
|
||||||
int16_t sleep();
|
int16_t sleep();
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Sets the module to standby mode.
|
\brief Sets the module to standby mode.
|
||||||
|
|
||||||
\returns \ref status_codes
|
\returns \ref status_codes
|
||||||
*/
|
*/
|
||||||
int16_t standby() override;
|
int16_t standby() override;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Sets the module to standby.
|
\brief Sets the module to standby.
|
||||||
|
|
||||||
\param mode Standby mode to be used. No effect, implemented only for PhysicalLayer compatibility.
|
\param mode Standby mode to be used. No effect, implemented only for PhysicalLayer compatibility.
|
||||||
|
|
||||||
\returns \ref status_codes
|
\returns \ref status_codes
|
||||||
*/
|
*/
|
||||||
int16_t standby(uint8_t mode) override;
|
int16_t standby(uint8_t mode) override;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Starts direct mode transmission.
|
\brief Starts direct mode transmission.
|
||||||
|
|
||||||
\param frf Raw RF frequency value. Defaults to 0, required for quick frequency shifts in RTTY.
|
\param frf Raw RF frequency value. Defaults to 0, required for quick frequency shifts in RTTY.
|
||||||
|
|
||||||
\returns \ref status_codes
|
\returns \ref status_codes
|
||||||
*/
|
*/
|
||||||
int16_t transmitDirect(uint32_t frf = 0) override;
|
int16_t transmitDirect(uint32_t frf = 0) override;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Starts direct mode reception.
|
\brief Starts direct mode reception.
|
||||||
|
|
||||||
\returns \ref status_codes
|
\returns \ref status_codes
|
||||||
*/
|
*/
|
||||||
int16_t receiveDirect() override;
|
int16_t receiveDirect() override;
|
||||||
|
@ -599,21 +577,18 @@ class RF69: public PhysicalLayer {
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Sets AES key.
|
\brief Sets AES key.
|
||||||
|
|
||||||
\param Key to be used for AES encryption. Must be exactly 16 bytes long.
|
\param Key to be used for AES encryption. Must be exactly 16 bytes long.
|
||||||
*/
|
*/
|
||||||
void setAESKey(uint8_t* key);
|
void setAESKey(uint8_t* key);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Enables AES encryption.
|
\brief Enables AES encryption.
|
||||||
|
|
||||||
\returns \ref status_codes
|
\returns \ref status_codes
|
||||||
*/
|
*/
|
||||||
int16_t enableAES();
|
int16_t enableAES();
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Disables AES encryption.
|
\brief Disables AES encryption.
|
||||||
|
|
||||||
\returns \ref status_codes
|
\returns \ref status_codes
|
||||||
*/
|
*/
|
||||||
int16_t disableAES();
|
int16_t disableAES();
|
||||||
|
@ -622,7 +597,6 @@ class RF69: public PhysicalLayer {
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Sets interrupt service routine to call when DIO0 activates.
|
\brief Sets interrupt service routine to call when DIO0 activates.
|
||||||
|
|
||||||
\param func ISR to call.
|
\param func ISR to call.
|
||||||
*/
|
*/
|
||||||
void setDio0Action(void (*func)(void));
|
void setDio0Action(void (*func)(void));
|
||||||
|
@ -634,7 +608,6 @@ class RF69: public PhysicalLayer {
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Sets interrupt service routine to call when DIO1 activates.
|
\brief Sets interrupt service routine to call when DIO1 activates.
|
||||||
|
|
||||||
\param func ISR to call.
|
\param func ISR to call.
|
||||||
*/
|
*/
|
||||||
void setDio1Action(void (*func)(void));
|
void setDio1Action(void (*func)(void));
|
||||||
|
@ -646,7 +619,6 @@ class RF69: public PhysicalLayer {
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Set interrupt service routine function to call when FIFO is empty.
|
\brief Set interrupt service routine function to call when FIFO is empty.
|
||||||
|
|
||||||
\param func Pointer to interrupt service routine.
|
\param func Pointer to interrupt service routine.
|
||||||
*/
|
*/
|
||||||
void setFifoEmptyAction(void (*func)(void));
|
void setFifoEmptyAction(void (*func)(void));
|
||||||
|
@ -658,7 +630,6 @@ class RF69: public PhysicalLayer {
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Set interrupt service routine function to call when FIFO is full.
|
\brief Set interrupt service routine function to call when FIFO is full.
|
||||||
|
|
||||||
\param func Pointer to interrupt service routine.
|
\param func Pointer to interrupt service routine.
|
||||||
*/
|
*/
|
||||||
void setFifoFullAction(void (*func)(void));
|
void setFifoFullAction(void (*func)(void));
|
||||||
|
@ -670,26 +641,18 @@ class RF69: public PhysicalLayer {
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Set interrupt service routine function to call when FIFO is empty.
|
\brief Set interrupt service routine function to call when FIFO is empty.
|
||||||
|
|
||||||
\param data Pointer to the transmission buffer.
|
\param data Pointer to the transmission buffer.
|
||||||
|
|
||||||
\param totalLen Total number of bytes to transmit.
|
\param totalLen Total number of bytes to transmit.
|
||||||
|
|
||||||
\param remLen Pointer to a counter holding the number of bytes that have been transmitted so far.
|
\param remLen Pointer to a counter holding the number of bytes that have been transmitted so far.
|
||||||
|
|
||||||
\returns True when a complete packet is sent, false if more data is needed.
|
\returns True when a complete packet is sent, false if more data is needed.
|
||||||
*/
|
*/
|
||||||
bool fifoAdd(uint8_t* data, int totalLen, int* remLen);
|
bool fifoAdd(uint8_t* data, int totalLen, int* remLen);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Set interrupt service routine function to call when FIFO is sufficently full to read.
|
\brief Set interrupt service routine function to call when FIFO is sufficently full to read.
|
||||||
|
|
||||||
\param data Pointer to a buffer that stores the receive data.
|
\param data Pointer to a buffer that stores the receive data.
|
||||||
|
|
||||||
\param totalLen Total number of bytes to receive.
|
\param totalLen Total number of bytes to receive.
|
||||||
|
|
||||||
\param rcvLen Pointer to a counter holding the number of bytes that have been received so far.
|
\param rcvLen Pointer to a counter holding the number of bytes that have been received so far.
|
||||||
|
|
||||||
\returns True when a complete packet is received, false if more data is needed.
|
\returns True when a complete packet is received, false if more data is needed.
|
||||||
*/
|
*/
|
||||||
bool fifoGet(volatile uint8_t* data, int totalLen, volatile int* rcvLen);
|
bool fifoGet(volatile uint8_t* data, int totalLen, volatile int* rcvLen);
|
||||||
|
@ -697,54 +660,40 @@ class RF69: public PhysicalLayer {
|
||||||
/*!
|
/*!
|
||||||
\brief Interrupt-driven binary transmit method.
|
\brief Interrupt-driven binary transmit method.
|
||||||
Overloads for string-based transmissions are implemented in PhysicalLayer.
|
Overloads for string-based transmissions are implemented in PhysicalLayer.
|
||||||
|
|
||||||
\param data Binary data to be sent.
|
\param data Binary data to be sent.
|
||||||
|
|
||||||
\param len Number of bytes to send.
|
\param len Number of bytes to send.
|
||||||
|
|
||||||
\param addr Address to send the data to. Will only be added if address filtering was enabled.
|
\param addr Address to send the data to. Will only be added if address filtering was enabled.
|
||||||
|
|
||||||
\returns \ref status_codes
|
\returns \ref status_codes
|
||||||
*/
|
*/
|
||||||
int16_t startTransmit(uint8_t* data, size_t len, uint8_t addr = 0) override;
|
int16_t startTransmit(uint8_t* data, size_t len, uint8_t addr = 0) override;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Clean up after transmission is done.
|
\brief Clean up after transmission is done.
|
||||||
|
|
||||||
\returns \ref status_codes
|
\returns \ref status_codes
|
||||||
*/
|
*/
|
||||||
int16_t finishTransmit() override;
|
int16_t finishTransmit() override;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Interrupt-driven receive method. GDO0 will be activated when full packet is received.
|
\brief Interrupt-driven receive method. GDO0 will be activated when full packet is received.
|
||||||
|
|
||||||
\returns \ref status_codes
|
\returns \ref status_codes
|
||||||
*/
|
*/
|
||||||
int16_t startReceive();
|
int16_t startReceive();
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Interrupt-driven receive method, implemented for compatibility with PhysicalLayer.
|
\brief Interrupt-driven receive method, implemented for compatibility with PhysicalLayer.
|
||||||
|
|
||||||
\param timeout Ignored.
|
\param timeout Ignored.
|
||||||
|
|
||||||
\param irqFlags Ignored.
|
\param irqFlags Ignored.
|
||||||
|
|
||||||
\param irqMask Ignored.
|
\param irqMask Ignored.
|
||||||
|
|
||||||
\param len Ignored.
|
\param len Ignored.
|
||||||
|
|
||||||
\returns \ref status_codes
|
\returns \ref status_codes
|
||||||
*/
|
*/
|
||||||
int16_t startReceive(uint32_t timeout, uint16_t irqFlags, uint16_t irqMask, size_t len);
|
int16_t startReceive(uint32_t timeout, uint16_t irqFlags, uint16_t irqMask, size_t len);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Reads data received after calling startReceive method.
|
\brief Reads data received after calling startReceive method.
|
||||||
|
|
||||||
\param data Pointer to array to save the received binary data.
|
\param data Pointer to array to save the received binary data.
|
||||||
|
|
||||||
\param len Number of bytes that will be read. When set to 0, the packet length will be retreived automatically.
|
\param len Number of bytes that will be read. When set to 0, the packet length will be retreived automatically.
|
||||||
When more bytes than received are requested, only the number of bytes requested will be returned.
|
When more bytes than received are requested, only the number of bytes requested will be returned.
|
||||||
|
|
||||||
\returns \ref status_codes
|
\returns \ref status_codes
|
||||||
*/
|
*/
|
||||||
int16_t readData(uint8_t* data, size_t len) override;
|
int16_t readData(uint8_t* data, size_t len) override;
|
||||||
|
@ -752,111 +701,90 @@ class RF69: public PhysicalLayer {
|
||||||
// configuration methods
|
// configuration methods
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Sets carrier frequency. Allowed values are in bands 290.0 to 340.0 MHz, 431.0 to 510.0 MHz and 862.0 to 1020.0 MHz.
|
\brief Sets carrier frequency. Allowed values are in bands 290.0 to 340.0 MHz, 431.0 to 510.0 MHz
|
||||||
|
and 862.0 to 1020.0 MHz.
|
||||||
\param freq Carrier frequency to be set in MHz.
|
\param freq Carrier frequency to be set in MHz.
|
||||||
|
|
||||||
\returns \ref status_codes
|
\returns \ref status_codes
|
||||||
*/
|
*/
|
||||||
int16_t setFrequency(float freq);
|
int16_t setFrequency(float freq);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Gets carrier frequency.
|
\brief Gets carrier frequency.
|
||||||
|
|
||||||
\param[out] freq Variable to write carrier frequency currently set, in MHz.
|
\param[out] freq Variable to write carrier frequency currently set, in MHz.
|
||||||
|
|
||||||
\returns \ref status_codes
|
\returns \ref status_codes
|
||||||
*/
|
*/
|
||||||
int16_t getFrequency(float *freq);
|
int16_t getFrequency(float *freq);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Sets bit rate. Allowed values range from 0.5 to 300.0 kbps.
|
\brief Sets bit rate. Allowed values range from 0.5 to 300.0 kbps.
|
||||||
|
|
||||||
\param br Bit rate to be set in kbps.
|
\param br Bit rate to be set in kbps.
|
||||||
|
|
||||||
\returns \ref status_codes
|
\returns \ref status_codes
|
||||||
*/
|
*/
|
||||||
int16_t setBitRate(float br);
|
int16_t setBitRate(float br);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Sets receiver bandwidth. Allowed values are 2.6, 3.1, 3.9, 5.2, 6.3, 7.8, 10.4, 12.5, 15.6, 20.8, 25.0, 31.3, 41.7, 50.0, 62.5, 83.3, 100.0, 125.0, 166.7, 200.0, 250.0, 333.3, 400.0 and 500.0 kHz.
|
\brief Sets receiver bandwidth. Allowed values are 2.6, 3.1, 3.9, 5.2, 6.3, 7.8, 10.4, 12.5, 15.6,
|
||||||
|
20.8, 25.0, 31.3, 41.7, 50.0, 62.5, 83.3, 100.0, 125.0, 166.7, 200.0, 250.0, 333.3, 400.0 and 500.0 kHz.
|
||||||
\param rxBw Receiver bandwidth to be set in kHz.
|
\param rxBw Receiver bandwidth to be set in kHz.
|
||||||
|
|
||||||
\returns \ref status_codes
|
\returns \ref status_codes
|
||||||
*/
|
*/
|
||||||
int16_t setRxBandwidth(float rxBw);
|
int16_t setRxBandwidth(float rxBw);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Sets frequency deviation.
|
\brief Sets frequency deviation.
|
||||||
|
|
||||||
\param freqDev Frequency deviation to be set in kHz.
|
\param freqDev Frequency deviation to be set in kHz.
|
||||||
|
|
||||||
\returns \ref status_codes
|
\returns \ref status_codes
|
||||||
*/
|
*/
|
||||||
int16_t setFrequencyDeviation(float freqDev) override;
|
int16_t setFrequencyDeviation(float freqDev) override;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Gets frequency deviation.
|
\brief Gets frequency deviation.
|
||||||
|
|
||||||
\param[out] freqDev Where to write the frequency deviation currently set, in kHz.
|
\param[out] freqDev Where to write the frequency deviation currently set, in kHz.
|
||||||
|
|
||||||
\returns \ref status_codes
|
\returns \ref status_codes
|
||||||
*/
|
*/
|
||||||
int16_t getFrequencyDeviation(float *freqDev);
|
int16_t getFrequencyDeviation(float *freqDev);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Sets output power. Allowed values range from -18 to 13 dBm for low power modules (RF69C/CW) or -2 to 20 dBm (RF69H/HC/HCW).
|
\brief Sets output power. Allowed values range from -18 to 13 dBm for
|
||||||
|
low power modules (RF69C/CW) or -2 to 20 dBm (RF69H/HC/HCW).
|
||||||
\param power Output power to be set in dBm.
|
\param pwr Output power to be set in dBm.
|
||||||
|
\param highPower Set to true when using modules high power port (RF69H/HC/HCW).
|
||||||
\param highPower Set to true when using modules high power port (RF69H/HC/HCW). Defaults to false (models without high power port - RF69C/CW).
|
Defaults to false (models without high power port - RF69C/CW).
|
||||||
|
|
||||||
\returns \ref status_codes
|
\returns \ref status_codes
|
||||||
*/
|
*/
|
||||||
int16_t setOutputPower(int8_t power, bool highPower = false);
|
int16_t setOutputPower(int8_t pwr, bool highPower = false);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Sets sync word. Up to 8 bytes can be set as sync word.
|
\brief Sets sync word. Up to 8 bytes can be set as sync word.
|
||||||
|
|
||||||
\param syncWord Pointer to the array of sync word bytes.
|
\param syncWord Pointer to the array of sync word bytes.
|
||||||
|
|
||||||
\param len Sync word length in bytes.
|
\param len Sync word length in bytes.
|
||||||
|
|
||||||
\param maxErrBits Maximum allowed number of bit errors in received sync word. Defaults to 0.
|
\param maxErrBits Maximum allowed number of bit errors in received sync word. Defaults to 0.
|
||||||
*/
|
*/
|
||||||
int16_t setSyncWord(uint8_t* syncWord, size_t len, uint8_t maxErrBits = 0);
|
int16_t setSyncWord(uint8_t* syncWord, size_t len, uint8_t maxErrBits = 0);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Sets preamble length.
|
\brief Sets preamble length.
|
||||||
|
|
||||||
\param preambleLen Preamble length to be set (in bits), allowed values: 16, 24, 32, 48, 64, 96, 128 and 192.
|
\param preambleLen Preamble length to be set (in bits), allowed values: 16, 24, 32, 48, 64, 96, 128 and 192.
|
||||||
|
|
||||||
\returns \ref status_codes
|
\returns \ref status_codes
|
||||||
*/
|
*/
|
||||||
int16_t setPreambleLength(uint8_t preambleLen);
|
int16_t setPreambleLength(uint8_t preambleLen);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Sets node address. Calling this method will also enable address filtering for node address only.
|
\brief Sets node address. Calling this method will also enable address filtering for node address only.
|
||||||
|
|
||||||
\param nodeAddr Node address to be set.
|
\param nodeAddr Node address to be set.
|
||||||
|
|
||||||
\returns \ref status_codes
|
\returns \ref status_codes
|
||||||
*/
|
*/
|
||||||
int16_t setNodeAddress(uint8_t nodeAddr);
|
int16_t setNodeAddress(uint8_t nodeAddr);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Sets broadcast address. Calling this method will also enable address filtering for node and broadcast address.
|
\brief Sets broadcast address. Calling this method will also enable address filtering for node and broadcast address.
|
||||||
|
|
||||||
\param broadAddr Node address to be set.
|
\param broadAddr Node address to be set.
|
||||||
|
|
||||||
\returns \ref status_codes
|
\returns \ref status_codes
|
||||||
*/
|
*/
|
||||||
int16_t setBroadcastAddress(uint8_t broadAddr);
|
int16_t setBroadcastAddress(uint8_t broadAddr);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Disables address filtering. Calling this method will also erase previously set addresses.
|
\brief Disables address filtering. Calling this method will also erase previously set addresses.
|
||||||
|
|
||||||
\returns \ref status_codes
|
\returns \ref status_codes
|
||||||
*/
|
*/
|
||||||
int16_t disableAddressFiltering();
|
int16_t disableAddressFiltering();
|
||||||
|
@ -865,136 +793,113 @@ class RF69: public PhysicalLayer {
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Sets ambient temperature. Required to correct values from on-board temperature sensor.
|
\brief Sets ambient temperature. Required to correct values from on-board temperature sensor.
|
||||||
|
|
||||||
\param tempAmbient Ambient temperature in degrees Celsius.
|
\param tempAmbient Ambient temperature in degrees Celsius.
|
||||||
*/
|
*/
|
||||||
void setAmbientTemperature(int16_t tempAmbient);
|
void setAmbientTemperature(int16_t tempAmbient);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Measures temperature.
|
\brief Measures temperature.
|
||||||
|
|
||||||
\returns Measured temperature in degrees Celsius.
|
\returns Measured temperature in degrees Celsius.
|
||||||
*/
|
*/
|
||||||
int16_t getTemperature();
|
int16_t getTemperature();
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Query modem for the packet length of received payload.
|
\brief Query modem for the packet length of received payload.
|
||||||
|
|
||||||
\param update Update received packet length. Will return cached value when set to false.
|
\param update Update received packet length. Will return cached value when set to false.
|
||||||
|
|
||||||
\returns Length of last received packet in bytes.
|
\returns Length of last received packet in bytes.
|
||||||
*/
|
*/
|
||||||
size_t getPacketLength(bool update = true) override;
|
size_t getPacketLength(bool update = true) override;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Enables/disables OOK modulation instead of FSK.
|
\brief Enables/disables OOK modulation instead of FSK.
|
||||||
Note: This function calls setRxBandwidth again, since register values differ based on OOK mode being enabled/disabled
|
Note: This function calls setRxBandwidth again, since register values differ based on OOK mode being enabled/disabled.
|
||||||
|
\param enable Enable (true) or disable (false) OOK.
|
||||||
\param enableOOK Enable (true) or disable (false) OOK.
|
|
||||||
|
|
||||||
\returns \ref status_codes
|
\returns \ref status_codes
|
||||||
*/
|
*/
|
||||||
int16_t setOOK(bool enableOOK);
|
int16_t setOOK(bool enable);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Selects the type of threshold in the OOK data slicer
|
\brief Selects the type of threshold in the OOK data slicer
|
||||||
|
\param type Threshold type: RADIOLIB_RF69_OOK_THRESH_PEAK(default), RADIOLIB_RF69_OOK_THRESH_FIXED or
|
||||||
\param type Threshold type: RADIOLIB_RF69_OOK_THRESH_PEAK(default), RADIOLIB_RF69_OOK_THRESH_FIXED or RADIOLIB_RF69_OOK_THRESH_AVERAGE
|
RADIOLIB_RF69_OOK_THRESH_AVERAGE
|
||||||
|
|
||||||
\returns \ref status_codes
|
\returns \ref status_codes
|
||||||
*/
|
*/
|
||||||
int16_t setOokThresholdType(uint8_t type);
|
int16_t setOokThresholdType(uint8_t type);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Fixed threshold for the Data Slicer in OOK mode or floor threshold for the Data Slicer in OOK when Peak mode is used.
|
\brief Fixed threshold for the Data Slicer in OOK mode or floor threshold for the Data Slicer
|
||||||
|
in OOK when Peak mode is used.
|
||||||
\param value Fixed threshold value (in dB) in the OOK demodulator. Used when OokThresType = RADIOLIB_RF69_OOK_THRESH_FIXED.
|
\param value Fixed threshold value (in dB) in the OOK demodulator.
|
||||||
|
Used when OokThresType = RADIOLIB_RF69_OOK_THRESH_FIXED.
|
||||||
\returns \ref status_codes
|
\returns \ref status_codes
|
||||||
*/
|
*/
|
||||||
int16_t setOokFixedThreshold(uint8_t value);
|
int16_t setOokFixedThreshold(uint8_t value);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Period of decrement of the RSSI threshold in the OOK demodulator.
|
\brief Period of decrement of the RSSI threshold in the OOK demodulator.
|
||||||
|
|
||||||
\param value Use defines RADIOLIB_RF69_OOK_PEAK_THRESH_DEC_X_X_CHIP
|
\param value Use defines RADIOLIB_RF69_OOK_PEAK_THRESH_DEC_X_X_CHIP
|
||||||
|
|
||||||
\returns \ref status_codes
|
\returns \ref status_codes
|
||||||
*/
|
*/
|
||||||
int16_t setOokPeakThresholdDecrement(uint8_t value);
|
int16_t setOokPeakThresholdDecrement(uint8_t value);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Set modem in fixed packet length mode.
|
\brief Set modem in fixed packet length mode.
|
||||||
|
|
||||||
\param len Packet length.
|
\param len Packet length.
|
||||||
|
|
||||||
\returns \ref status_codes
|
\returns \ref status_codes
|
||||||
*/
|
*/
|
||||||
int16_t fixedPacketLengthMode(uint8_t len = RADIOLIB_RF69_MAX_PACKET_LENGTH);
|
int16_t fixedPacketLengthMode(uint8_t len = RADIOLIB_RF69_MAX_PACKET_LENGTH);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Set modem in variable packet length mode.
|
\brief Set modem in variable packet length mode.
|
||||||
|
|
||||||
\param len Maximum packet length.
|
\param len Maximum packet length.
|
||||||
|
|
||||||
\returns \ref status_codes
|
\returns \ref status_codes
|
||||||
*/
|
*/
|
||||||
int16_t variablePacketLengthMode(uint8_t maxLen = RADIOLIB_RF69_MAX_PACKET_LENGTH);
|
int16_t variablePacketLengthMode(uint8_t maxLen = RADIOLIB_RF69_MAX_PACKET_LENGTH);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Enable sync word filtering and generation.
|
\brief Enable sync word filtering and generation.
|
||||||
|
|
||||||
\param numBits Sync word length in bits.
|
\param numBits Sync word length in bits.
|
||||||
|
|
||||||
\returns \ref status_codes
|
\returns \ref status_codes
|
||||||
*/
|
*/
|
||||||
int16_t enableSyncWordFiltering(uint8_t maxErrBits = 0);
|
int16_t enableSyncWordFiltering(uint8_t maxErrBits = 0);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Disable preamble and sync word filtering and generation.
|
\brief Disable preamble and sync word filtering and generation.
|
||||||
|
|
||||||
\returns \ref status_codes
|
\returns \ref status_codes
|
||||||
*/
|
*/
|
||||||
int16_t disableSyncWordFiltering();
|
int16_t disableSyncWordFiltering();
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Enable Bit synchronization in continuous mode.
|
\brief Enable Bit synchronization in continuous mode.
|
||||||
|
|
||||||
\returns \ref status_codes
|
\returns \ref status_codes
|
||||||
*/
|
*/
|
||||||
int16_t enableContinuousModeBitSync();
|
int16_t enableContinuousModeBitSync();
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Disable Bit synchronization in continuous mode.
|
\brief Disable Bit synchronization in continuous mode.
|
||||||
|
|
||||||
\returns \ref status_codes
|
\returns \ref status_codes
|
||||||
*/
|
*/
|
||||||
int16_t disableContinuousModeBitSync();
|
int16_t disableContinuousModeBitSync();
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Enable CRC filtering and generation.
|
\brief Enable CRC filtering and generation.
|
||||||
|
|
||||||
\param crcOn Set or unset CRC filtering.
|
\param crcOn Set or unset CRC filtering.
|
||||||
|
|
||||||
\returns \ref status_codes
|
\returns \ref status_codes
|
||||||
*/
|
*/
|
||||||
int16_t setCrcFiltering(bool crcOn = true);
|
int16_t setCrcFiltering(bool crcOn = true);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Set modem in "sniff" mode: no packet filtering (e.g., no preamble, sync word, address, CRC).
|
\brief Set modem in "sniff" mode: no packet filtering (e.g., no preamble, sync word, address, CRC).
|
||||||
|
\param enable Set or unset promiscuous mode.
|
||||||
\param promiscuous Set or unset promiscuous mode.
|
|
||||||
|
|
||||||
\returns \ref status_codes
|
\returns \ref status_codes
|
||||||
*/
|
*/
|
||||||
int16_t setPromiscuousMode(bool promiscuous = true);
|
int16_t setPromiscuousMode(bool enable = true);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Sets Gaussian filter bandwidth-time product that will be used for data shaping.
|
\brief Sets Gaussian filter bandwidth-time product that will be used for data shaping.
|
||||||
Allowed values are RADIOLIB_SHAPING_0_3, RADIOLIB_SHAPING_0_5 or RADIOLIB_SHAPING_1_0. Set to RADIOLIB_SHAPING_NONE to disable data shaping.
|
Allowed values are RADIOLIB_SHAPING_0_3, RADIOLIB_SHAPING_0_5 or RADIOLIB_SHAPING_1_0.
|
||||||
|
Set to RADIOLIB_SHAPING_NONE to disable data shaping.
|
||||||
\param sh Gaussian shaping bandwidth-time product that will be used for data shaping
|
\param sh Gaussian shaping bandwidth-time product that will be used for data shaping
|
||||||
|
|
||||||
\returns \ref status_codes
|
\returns \ref status_codes
|
||||||
*/
|
*/
|
||||||
int16_t setDataShaping(uint8_t sh) override;
|
int16_t setDataShaping(uint8_t sh) override;
|
||||||
|
@ -1002,34 +907,27 @@ class RF69: public PhysicalLayer {
|
||||||
/*!
|
/*!
|
||||||
\brief Sets transmission encoding.
|
\brief Sets transmission encoding.
|
||||||
Allowed values are RADIOLIB_ENCODING_NRZ, RADIOLIB_ENCODING_MANCHESTER and RADIOLIB_ENCODING_WHITENING.
|
Allowed values are RADIOLIB_ENCODING_NRZ, RADIOLIB_ENCODING_MANCHESTER and RADIOLIB_ENCODING_WHITENING.
|
||||||
|
|
||||||
\param encoding Encoding to be used.
|
\param encoding Encoding to be used.
|
||||||
|
|
||||||
\returns \ref status_codes
|
\returns \ref status_codes
|
||||||
*/
|
*/
|
||||||
int16_t setEncoding(uint8_t encoding) override;
|
int16_t setEncoding(uint8_t encoding) override;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Enable/disable LNA Boost mode (disabled by default).
|
\brief Enable/disable LNA Boost mode (disabled by default).
|
||||||
|
|
||||||
\param value True to enable, false to disable.
|
\param value True to enable, false to disable.
|
||||||
|
|
||||||
\returns \ref status_codes
|
\returns \ref status_codes
|
||||||
*/
|
*/
|
||||||
int16_t setLnaTestBoost(bool value);
|
int16_t setLnaTestBoost(bool value);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Gets RSSI (Recorded Signal Strength Indicator) of the last received packet.
|
\brief Gets RSSI (Recorded Signal Strength Indicator) of the last received packet.
|
||||||
|
|
||||||
\returns Last packet RSSI in dBm.
|
\returns Last packet RSSI in dBm.
|
||||||
*/
|
*/
|
||||||
float getRSSI();
|
float getRSSI();
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Sets the RSSI value above which the RSSI interrupt is signaled
|
\brief Sets the RSSI value above which the RSSI interrupt is signaled
|
||||||
|
|
||||||
\param dbm A dBm value between -127.5 and 0 inclusive
|
\param dbm A dBm value between -127.5 and 0 inclusive
|
||||||
|
|
||||||
\returns \ref status_codes
|
\returns \ref status_codes
|
||||||
*/
|
*/
|
||||||
int16_t setRSSIThreshold(float dbm);
|
int16_t setRSSIThreshold(float dbm);
|
||||||
|
@ -1042,14 +940,12 @@ class RF69: public PhysicalLayer {
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Get one truly random byte from RSSI noise.
|
\brief Get one truly random byte from RSSI noise.
|
||||||
|
|
||||||
\returns TRNG byte.
|
\returns TRNG byte.
|
||||||
*/
|
*/
|
||||||
uint8_t randomByte();
|
uint8_t randomByte();
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Read version SPI register. Should return RF69_CHIP_VERSION (0x24) if SX127x is connected and working.
|
\brief Read version SPI register. Should return RF69_CHIP_VERSION (0x24) if SX127x is connected and working.
|
||||||
|
|
||||||
\returns Version register contents or \ref status_codes
|
\returns Version register contents or \ref status_codes
|
||||||
*/
|
*/
|
||||||
int16_t getChipVersion();
|
int16_t getChipVersion();
|
||||||
|
@ -1057,14 +953,12 @@ class RF69: public PhysicalLayer {
|
||||||
#if !defined(RADIOLIB_EXCLUDE_DIRECT_RECEIVE)
|
#if !defined(RADIOLIB_EXCLUDE_DIRECT_RECEIVE)
|
||||||
/*!
|
/*!
|
||||||
\brief Set interrupt service routine function to call when data bit is receveid in direct mode.
|
\brief Set interrupt service routine function to call when data bit is receveid in direct mode.
|
||||||
|
|
||||||
\param func Pointer to interrupt service routine.
|
\param func Pointer to interrupt service routine.
|
||||||
*/
|
*/
|
||||||
void setDirectAction(void (*func)(void));
|
void setDirectAction(void (*func)(void));
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Function to read and process data bit in direct reception mode.
|
\brief Function to read and process data bit in direct reception mode.
|
||||||
|
|
||||||
\param pin Pin on which to read.
|
\param pin Pin on which to read.
|
||||||
*/
|
*/
|
||||||
void readBit(uint32_t pin);
|
void readBit(uint32_t pin);
|
||||||
|
@ -1072,11 +966,8 @@ class RF69: public PhysicalLayer {
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Configure DIO pin mapping to get a given signal on a DIO pin (if available).
|
\brief Configure DIO pin mapping to get a given signal on a DIO pin (if available).
|
||||||
|
|
||||||
\param pin Pin number onto which a signal is to be placed.
|
\param pin Pin number onto which a signal is to be placed.
|
||||||
|
|
||||||
\param value The value that indicates which function to place on that pin. See chip datasheet for details.
|
\param value The value that indicates which function to place on that pin. See chip datasheet for details.
|
||||||
|
|
||||||
\returns \ref status_codes
|
\returns \ref status_codes
|
||||||
*/
|
*/
|
||||||
int16_t setDIOMapping(uint32_t pin, uint32_t value);
|
int16_t setDIOMapping(uint32_t pin, uint32_t value);
|
||||||
|
@ -1084,28 +975,28 @@ class RF69: public PhysicalLayer {
|
||||||
#if !defined(RADIOLIB_GODMODE) && !defined(RADIOLIB_LOW_LEVEL)
|
#if !defined(RADIOLIB_GODMODE) && !defined(RADIOLIB_LOW_LEVEL)
|
||||||
protected:
|
protected:
|
||||||
#endif
|
#endif
|
||||||
Module* _mod;
|
Module* mod;
|
||||||
|
|
||||||
#if !defined(RADIOLIB_GODMODE)
|
#if !defined(RADIOLIB_GODMODE)
|
||||||
protected:
|
protected:
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
float _freq = RADIOLIB_RF69_DEFAULT_FREQ;
|
float frequency = RADIOLIB_RF69_DEFAULT_FREQ;
|
||||||
float _br = RADIOLIB_RF69_DEFAULT_BR;
|
float bitRate = RADIOLIB_RF69_DEFAULT_BR;
|
||||||
float _rxBw = RADIOLIB_RF69_DEFAULT_RXBW;
|
float rxBandwidth = RADIOLIB_RF69_DEFAULT_RXBW;
|
||||||
bool _ook = false;
|
bool ookEnabled = false;
|
||||||
int16_t _tempOffset = 0;
|
int16_t tempOffset = 0;
|
||||||
int8_t _power = RADIOLIB_RF69_DEFAULT_POWER;
|
int8_t power = RADIOLIB_RF69_DEFAULT_POWER;
|
||||||
|
|
||||||
size_t _packetLength = 0;
|
size_t packetLength = 0;
|
||||||
bool _packetLengthQueried = false;
|
bool packetLengthQueried = false;
|
||||||
uint8_t _packetLengthConfig = RADIOLIB_RF69_PACKET_FORMAT_VARIABLE;
|
uint8_t packetLengthConfig = RADIOLIB_RF69_PACKET_FORMAT_VARIABLE;
|
||||||
|
|
||||||
bool _promiscuous = false;
|
bool promiscuous = false;
|
||||||
|
|
||||||
uint8_t _syncWordLength = RADIOLIB_RF69_DEFAULT_SW_LEN;
|
uint8_t syncWordLength = RADIOLIB_RF69_DEFAULT_SW_LEN;
|
||||||
|
|
||||||
bool _bitSync = true;
|
bool bitSync = true;
|
||||||
|
|
||||||
int16_t config();
|
int16_t config();
|
||||||
int16_t directMode();
|
int16_t directMode();
|
||||||
|
|
Loading…
Add table
Reference in a new issue