Fork with intent to refactor and add support for American 902-928(915) Frequency Bands
Diff: sx1276/sx1276-mbed-hal.cpp
- Revision:
- 42:72deced1a4c4
- Parent:
- 41:2dbc4afedf61
- Child:
- 43:90de42f3c1fd
- Child:
- 44:544add59b26d
--- a/sx1276/sx1276-mbed-hal.cpp Mon May 08 15:39:42 2017 +0200 +++ b/sx1276/sx1276-mbed-hal.cpp Mon May 08 22:52:31 2017 +0200 @@ -347,9 +347,30 @@ } } -void SX1276Generic::SetTimeout(Timeout_t timer, int timeout_ms) +void SX1276Generic::SetTimeout(TimeoutTimer_t timer, int timeout_ms) { - + SX1276 *sx = this; + switch(timer) { + case RXTimeoutTimer: + if (timeout_ms) + rxTimeoutTimer.attach_us(callback(sx, &SX1276::OnTimeoutIrq), timeout_ms); + else + rxTimeoutTimer.detach(); + break; + case TXTimeoutTimer: + if (timeout_ms) + txTimeoutTimer.attach_us(callback(sx, &SX1276::OnTimeoutIrq), timeout_ms); + else + txTimeoutTimer.detach(); + break; + case RXTimeoutSyncWorldTimer: + if (timeout_ms) + rxTimeoutSyncWord.attach_us(callback(sx, &SX1276::OnTimeoutIrq), timeout_ms); + else + rxTimeoutSyncWord.detach(); + break; + break; + } } bool SX1276Generic::CheckRfFrequency( uint32_t frequency )