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.h
- Revision:
- 10:bd29cdff8f3e
- Parent:
- 8:1002d3025eaa
- Child:
- 11:866b939cf709
diff -r a9a2d4937e88 -r bd29cdff8f3e sx1272/sx1272.h --- a/sx1272/sx1272.h Sat Feb 10 08:59:58 2018 +0100 +++ b/sx1272/sx1272.h Sat Feb 24 08:47:30 2018 +0100 @@ -99,8 +99,8 @@ static const FskBandwidth_t FskBandwidths[]; // <RTOS> - Thread _thread_events_queue; - EventQueue _eq_events; + Thread* _thread_events_queue; + EventQueue* _eq_events; // </RTOS> protected: @@ -118,6 +118,11 @@ PinName dio0, PinName dio1, PinName dio2, PinName dio3, PinName dio4, PinName dio5 ); SX1272( RadioEvents_t *events ); virtual ~SX1272( ); + + // <RTOS> + void assign_events_queue_thread(Thread* thread) {_thread_events_queue=thread;} + void assign_events_queue(EventQueue* event_queue) {_eq_events=event_queue;} + // </RTOS> //------------------------------------------------------------------------- // Redefined Radio functions