Driver compatible with SX126X series. Operates by default with Cold
Start sleep mode, i.e., the lowest possible power state while sleeping.
RX boost mode supported and the driver can be configured to get RX gain
at the orice of power. Default mode is normal RX gain.
Some of the rtos::Thread APIs like signal_set() and signal_wait() are
noe deprecated. Although they are still backward compatible, we switch
to the new APIs.
We had been on a mission to get rid of all the Timeout instances from
the radio drivers. However, 'tx_timeout' is a necessary evil which runs
every time we transmit so that we can inform the stack about any fatal
errors. The side effect of this Timeout is that it was using high-res
timeout which would lock the deep sleep and hence prevent the MCU to go
to deep sleep.
We have now added support for low power timeout and we check compile
time if the platform supports low power timeout to use it in the driver.
This means that now the 'tx_timeout' will not lock the deep sleep.
This commit fixes two issues reported in #24 and #25.
The default buffer size for the radio driver should have been 255 (0xFF) not 256.
In addition to that it was pointed out that the tx timer values were inconsistent
with the doc. All timer values are considered in ms except symbol timeout and the
time value for set_tx_continuous_wave() API.
In case of catastrophic bus failure at radio end, we shouldn't reset the chip
as it will cause the chip to hang and then burst out interrupts in a fury resulting
in an ISR queue overflow.
rather than that we gracefully accept the failure and set the radio to sleep and
set the state to idle. In addition to that we inform the upper layers about the
failure.
A little touch up to the FHSS case, was actually a leftover from the previous PR.
We don't use FHSS mode, that was why we didn't catch in the testing.
Both in FSK and LoRa mode, we do not rely on software timers anymore.
This makes our timing precise and enables us to consume less power.
It also gives us flexibility which we need for future deep sleep
venture as Mbed OS timeout class may lock the sleep manager if not using
low power timers.
preamble_detected and sync_word_detected are uint8_t integer type variables so those should not be compared to (boolean) true/false values.
Fixed to use 1 and 0 values instead.
NXP Hal provides a write API on DigitalOut::write() that asserts if pin
is NC and we try to perform an operation on it. This behaviour is not
consistent among various Hals in Mbed-OS. However, we now check the pin
ourselves in the driver just like 1276.
For example muRata modules do not have DIO4 and DIO5 pins connected.
If these pins are not connected, driver should not try to set up
interrupt handlers for those.
In respose to the radio event callback change from c style callbacks
to Mbed callbacks, we need to remove NULL checks from the driver code
as the callbacks itself are not pointers anymore. However, thanks to
template magic, we can check if callback is assigned or not. If its not
not assigned, it is default constructed to NULL which we can check by boolean
operator.
For some unknown reason (may be a rebase issue) Mbed config name for the
drivers was not spell correctly inside the source macro definition.
Alongwith that the SX1276 driver was missing a class terminator.
rf_ctrls is a data structure that holds all control pins for a certain LoRa Radio.
Same data structure was being used in both SX1272 and SX1276 drivers. As we are
heading towards putting both drivers in the same repo and as the plan is to use them
togather, i.e., both header files could be included we need to move this data structure to a
common location so that the name does not collide.
In addition to that we have tried to reduce namespace pollution caused by the driver
header files.