[SX126x] Enable timeout to generate IRQ event
This commit is contained in:
parent
2e183d70bb
commit
7f09fc430a
3 changed files with 18 additions and 5 deletions
|
@ -182,6 +182,8 @@ startReceiveDutyCycleAuto KEYWORD2
|
|||
setRegulatorLDO KEYWORD2
|
||||
setRegulatorDCDC KEYWORD2
|
||||
getCurrentLimit KEYWORD2
|
||||
getIrqStatus KEYWORD2
|
||||
|
||||
# nRF24
|
||||
setIrqAction KEYWORD2
|
||||
setAddressWidth KEYWORD2
|
||||
|
|
|
@ -441,7 +441,7 @@ int16_t SX126x::startTransmit(uint8_t* data, size_t len, uint8_t addr) {
|
|||
}
|
||||
|
||||
int16_t SX126x::startReceive(uint32_t timeout) {
|
||||
int16_t state = startReceiveCommon();
|
||||
int16_t state = startReceiveCommon(timeout);
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
// set RF switch (if present)
|
||||
|
@ -520,9 +520,13 @@ int16_t SX126x::startReceiveDutyCycleAuto(uint16_t senderPreambleLength, uint16_
|
|||
return(startReceiveDutyCycle(wakePeriod, sleepPeriod));
|
||||
}
|
||||
|
||||
int16_t SX126x::startReceiveCommon() {
|
||||
int16_t SX126x::startReceiveCommon(uint32_t timeout) {
|
||||
// set DIO mapping
|
||||
int16_t state = setDioIrqParams(RADIOLIB_SX126X_IRQ_RX_DONE | RADIOLIB_SX126X_IRQ_TIMEOUT | RADIOLIB_SX126X_IRQ_CRC_ERR | RADIOLIB_SX126X_IRQ_HEADER_ERR, RADIOLIB_SX126X_IRQ_RX_DONE);
|
||||
uint16_t mask = RADIOLIB_SX126X_IRQ_RX_DONE;
|
||||
if(timeout != RADIOLIB_SX126X_RX_TIMEOUT_INF) {
|
||||
mask |= RADIOLIB_SX126X_IRQ_TIMEOUT;
|
||||
}
|
||||
int16_t state = setDioIrqParams(RADIOLIB_SX126X_IRQ_RX_DONE | RADIOLIB_SX126X_IRQ_TIMEOUT | RADIOLIB_SX126X_IRQ_CRC_ERR | RADIOLIB_SX126X_IRQ_HEADER_ERR, mask);
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
// set buffer pointers
|
||||
|
|
|
@ -511,6 +511,7 @@ class SX126x: public PhysicalLayer {
|
|||
\brief Interrupt-driven receive method. DIO1 will be activated when full packet is received.
|
||||
|
||||
\param timeout Raw timeout value, expressed as multiples of 15.625 us. Defaults to RADIOLIB_SX126X_RX_TIMEOUT_INF for infinite timeout (Rx continuous mode), set to RADIOLIB_SX126X_RX_TIMEOUT_NONE for no timeout (Rx single mode).
|
||||
If timeout other than infinite is set, signal will be generated on DIO1.
|
||||
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
|
@ -541,6 +542,13 @@ class SX126x: public PhysicalLayer {
|
|||
*/
|
||||
int16_t startReceiveDutyCycleAuto(uint16_t senderPreambleLength = 0, uint16_t minSymbols = 8);
|
||||
|
||||
/*!
|
||||
\brief Reads the current IRQ status.
|
||||
|
||||
\returns IRQ status bits
|
||||
*/
|
||||
uint16_t getIrqStatus();
|
||||
|
||||
/*!
|
||||
\brief Reads data received after calling startReceive method.
|
||||
|
||||
|
@ -927,7 +935,6 @@ class SX126x: public PhysicalLayer {
|
|||
int16_t writeBuffer(uint8_t* data, uint8_t numBytes, uint8_t offset = 0x00);
|
||||
int16_t readBuffer(uint8_t* data, uint8_t numBytes);
|
||||
int16_t setDioIrqParams(uint16_t irqMask, uint16_t dio1Mask, uint16_t dio2Mask = RADIOLIB_SX126X_IRQ_NONE, uint16_t dio3Mask = RADIOLIB_SX126X_IRQ_NONE);
|
||||
uint16_t getIrqStatus();
|
||||
int16_t clearIrqStatus(uint16_t clearIrqParams = RADIOLIB_SX126X_IRQ_ALL);
|
||||
int16_t setRfFrequency(uint32_t frf);
|
||||
int16_t calibrateImage(uint8_t* data);
|
||||
|
@ -944,7 +951,7 @@ class SX126x: public PhysicalLayer {
|
|||
uint16_t getDeviceErrors();
|
||||
int16_t clearDeviceErrors();
|
||||
|
||||
int16_t startReceiveCommon();
|
||||
int16_t startReceiveCommon(uint32_t timeout = RADIOLIB_SX126X_RX_TIMEOUT_INF);
|
||||
int16_t setFrequencyRaw(float freq);
|
||||
int16_t setPacketMode(uint8_t mode, uint8_t len);
|
||||
int16_t setHeaderType(uint8_t headerType, size_t len = 0xFF);
|
||||
|
|
Loading…
Add table
Reference in a new issue