Open tperale opened 4 years ago
So far two methods are documented to know if there is an ongoing communication.
uint8_t status; spi_read_register(__sx1272_dev.spi, REG_LR_MODEMSTAT, &status, 1); if (status & (0x04 | 0x01)) { sx1272_rx_internal_set(&__sx1272_dev, sx1272_rx_receiving); }
if (sx1272_read_register(SX1272_DEV.spi, REG_LR_IRQFLAGS) & RFLR_IRQFLAGS_VALIDHEADER) { SX1272_DEV.receiv_timestamp = RTIMER_NOW(); // - US_TO_RTIMERTICKS(439) sx1272_write_register(SX1272_DEV.spi, REG_LR_IRQFLAGS, RFLR_IRQFLAGS_VALIDHEADER); sx1272_rx_internal_set(&SX1272_DEV, sx1272_rx_receiving); LOG_DBG("Receiving packet\n"); }
I only managed to make the second one work. I should try to implement the first one and study which one detect an incoming packet faster to reduce the time the radio must spend listening for incoming messages.
So far two methods are documented to know if there is an ongoing communication.
I only managed to make the second one work. I should try to implement the first one and study which one detect an incoming packet faster to reduce the time the radio must spend listening for incoming messages.