1
Diff: radio_sx126x.cpp
- Revision:
- 20:75635d50262e
- Parent:
- 18:78c5e644d37a
- Child:
- 22:fc88e265f425
--- a/radio_sx126x.cpp Thu Jun 25 12:39:08 2020 -0700 +++ b/radio_sx126x.cpp Fri Jul 10 10:52:39 2020 -0700 @@ -8,7 +8,12 @@ Timer Radio::lpt; #endif +#if (MBED_MAJOR_VERSION < 6) volatile us_timestamp_t Radio::irqAt; +#else +LowPowerClock::time_point Radio::irqAt; +#endif + bool Radio::paOff; #ifdef TARGET_FF_ARDUINO @@ -391,19 +396,35 @@ radio.xfer(OPCODE_SET_LORA_SYMBOL_TIMEOUT, 1, 0, &symbs); radio.start_rx(RX_TIMEOUT_CONTINUOUS); + #if (MBED_MAJOR_VERSION < 6) startAt = lpt.read_us(); + #else + startAt = LowPowerClock::now().time_since_epoch().count(); + #endif Lstart: do { + #if (MBED_MAJOR_VERSION < 6) now = lpt.read_us(); + #else + now = LowPowerClock::now().time_since_epoch().count(); + #endif if ((now - startAt) > maxListenTime) { return -1; } radio.xfer(OPCODE_GET_RSSIINST, 0, 2, buf); rssi = buf[1] / -2; } while (rssi > rssiThresh); + #if (MBED_MAJOR_VERSION < 6) chFreeAt = lpt.read_us(); + #else + chFreeAt = LowPowerClock::now().time_since_epoch().count(); + #endif do { + #if (MBED_MAJOR_VERSION < 6) now = lpt.read_us(); + #else + now = LowPowerClock::now().time_since_epoch().count(); + #endif radio.xfer(OPCODE_GET_RSSIINST, 0, 2, buf); rssi = buf[1] / -2; if (rssi > rssiThresh) { @@ -439,7 +460,11 @@ void Radio::dio1_top_half() { +#if (MBED_MAJOR_VERSION < 6) irqAt = lpt.read_us(); +#else + irqAt = LowPowerClock::now(); +#endif if (RadioEvents->DioPin_top_half) RadioEvents->DioPin_top_half();