diff --git a/src/protocols/PhysicalLayer/PhysicalLayer.cpp b/src/protocols/PhysicalLayer/PhysicalLayer.cpp index 611425e8..e1a88151 100644 --- a/src/protocols/PhysicalLayer/PhysicalLayer.cpp +++ b/src/protocols/PhysicalLayer/PhysicalLayer.cpp @@ -266,3 +266,15 @@ int16_t PhysicalLayer::setDIOMapping(RADIOLIB_PIN_TYPE pin, uint8_t value) { (void)value; return(RADIOLIB_ERR_UNSUPPORTED); } + +#if defined(RADIOLIB_INTERRUPT_TIMING) +void PhysicalLayer::setInterruptSetup(void (*func)(uint32_t)) { + Module* mod = getMod(); + mod->TimerSetupCb = func; +} + +void PhysicalLayer::setTimerFlag() { + Module* mod = getMod(); + mod->TimerFlag = true; +} +#endif diff --git a/src/protocols/PhysicalLayer/PhysicalLayer.h b/src/protocols/PhysicalLayer/PhysicalLayer.h index 941181b1..4e33881a 100644 --- a/src/protocols/PhysicalLayer/PhysicalLayer.h +++ b/src/protocols/PhysicalLayer/PhysicalLayer.h @@ -344,6 +344,22 @@ class PhysicalLayer { */ virtual int16_t setDIOMapping(RADIOLIB_PIN_TYPE pin, uint8_t value); + #if defined(RADIOLIB_INTERRUPT_TIMING) + + /*! + \brief Set function to be called to set up the timing interrupt. + + \param func Setup function to be called, with one argument (pulse length in microseconds). + */ + void setInterruptSetup(void (*func)(uint32_t)); + + /*! + \brief Set timing interrupt flag. + */ + void setTimerFlag(); + + #endif + #if !defined(RADIOLIB_EXCLUDE_DIRECT_RECEIVE) protected: void updateDirectBuffer(uint8_t bit);