SX1272Lib updated in order to be RTOS aware
Fork of SX1272Lib by
Since Semtech original SX1272 library used InterruptIn and Timout mbed-os classes, whose ISRs are not allowed to lock RTOS mutexes, any SPI-related operation was doomed to fail. Indeed, SPI transactions functions are always nested inside a spi-level mutex lock/unlock pair in order to provide for thread access safety. A typical case occurs for example when radio is set to sleep state after a RX timeout.
This fork solves such problems by mean of a EventQueue/Thread pair, where any InterruptIn and Timeout ISRs actually enqueue callback calls.
Take a look at usage example at https://github.com/maiorfi/mbedos_lablet_lora_1
Diff: sx1272/sx1272-hal.cpp
- Revision:
- 8:1002d3025eaa
- Parent:
- 7:b988b60083a1
- Child:
- 11:866b939cf709
--- a/sx1272/sx1272-hal.cpp Mon Apr 24 09:26:08 2017 +0000 +++ b/sx1272/sx1272-hal.cpp Sat Feb 10 08:58:42 2018 +0100 @@ -90,12 +90,12 @@ } SX1272MB2xAS::SX1272MB2xAS( RadioEvents_t *events ) - #if defined ( TARGET_NUCLEO_L152RE ) || defined ( TARGET_NUCLEO_L476RG ) + #if defined ( TARGET_NUCLEO_L152RE ) || defined ( TARGET_NUCLEO_L476RG ) || defined (TARGET_NUCLEO_F401RE) : SX1272( events, D11, D12, D13, D10, A0, D2, D3, D4, D5, A3, D9 ), // For NUCLEO L152RE dio4 is on port A3 AntSwitch( A4 ), Fake( D8 ) #elif defined ( TARGET_MOTE_L152RC ) - : SX1272( events, PB_15, PB_14, PB_13, PB_12, PC_2, PC_6, PC_10, PC_11, PC_8, PC_9, PC_12 ), + : SX1272( events, D11, D12, D13, D10, A0, D2, D3, D4, D5, A3, D9 ), RfSwitchCntr1( PC_4 ), RfSwitchCntr2( PC_13 ), PwrAmpCntr( PD_2 )