Fork for LoDev
Diff: sx1276/sx1276-mbed-hal.cpp
- Revision:
- 44:544add59b26d
- Parent:
- 42:72deced1a4c4
- Child:
- 45:9788b98821a5
--- a/sx1276/sx1276-mbed-hal.cpp Mon May 08 22:52:31 2017 +0200 +++ b/sx1276/sx1276-mbed-hal.cpp Tue May 09 16:41:16 2017 +0200 @@ -347,25 +347,24 @@ } } -void SX1276Generic::SetTimeout(TimeoutTimer_t timer, int timeout_ms) +void SX1276Generic::SetTimeout(TimeoutTimer_t timer, timeoutFuncPtr func, int timeout_ms) { - SX1276 *sx = this; switch(timer) { case RXTimeoutTimer: - if (timeout_ms) - rxTimeoutTimer.attach_us(callback(sx, &SX1276::OnTimeoutIrq), timeout_ms); + if (func) + rxTimeoutTimer.attach_us(callback(this, func), timeout_ms); else rxTimeoutTimer.detach(); break; case TXTimeoutTimer: - if (timeout_ms) - txTimeoutTimer.attach_us(callback(sx, &SX1276::OnTimeoutIrq), timeout_ms); + if (func) + txTimeoutTimer.attach_us(callback(this, func), timeout_ms); else txTimeoutTimer.detach(); break; case RXTimeoutSyncWorldTimer: - if (timeout_ms) - rxTimeoutSyncWord.attach_us(callback(sx, &SX1276::OnTimeoutIrq), timeout_ms); + if (func) + rxTimeoutSyncWord.attach_us(callback(this, func), timeout_ms); else rxTimeoutSyncWord.detach(); break;