Browse Source

LLCC68: add PREAMBLE_DETECTED to reported irq flags

pull/3036/head
taco 1 week ago
parent
commit
c56928347f
  1. 10
      src/helpers/radiolib/CustomLLCC68.h

10
src/helpers/radiolib/CustomLLCC68.h

@ -2,9 +2,6 @@
#include <RadioLib.h> #include <RadioLib.h>
#define SX126X_IRQ_HEADER_VALID 0b0000010000 // 4 4 valid LoRa header received
#define SX126X_IRQ_PREAMBLE_DETECTED 0x04
class CustomLLCC68 : public LLCC68 { class CustomLLCC68 : public LLCC68 {
public: public:
CustomLLCC68(Module *mod) : LLCC68(mod) { } CustomLLCC68(Module *mod) : LLCC68(mod) { }
@ -78,9 +75,14 @@ class CustomLLCC68 : public LLCC68 {
return true; // success return true; // success
} }
int16_t startReceive() override {
// include the PREAMBLE_DETECTED irq bit in reported flags
return LLCC68::startReceive(RADIOLIB_SX126X_RX_TIMEOUT_INF, RADIOLIB_IRQ_RX_DEFAULT_FLAGS | (1UL << RADIOLIB_IRQ_PREAMBLE_DETECTED), RADIOLIB_IRQ_RX_DEFAULT_MASK, 0);
}
bool isReceiving() { bool isReceiving() {
uint16_t irq = getIrqFlags(); uint16_t irq = getIrqFlags();
bool detected = (irq & SX126X_IRQ_HEADER_VALID) || (irq & SX126X_IRQ_PREAMBLE_DETECTED); bool detected = (irq & RADIOLIB_SX126X_IRQ_HEADER_VALID) || (irq & RADIOLIB_SX126X_IRQ_PREAMBLE_DETECTED);
return detected; return detected;
} }

Loading…
Cancel
Save