Untested compiling code
This commit is contained in:
parent
aedfadeeec
commit
9dd2a5e1f7
4 changed files with 16 additions and 0 deletions
|
@ -374,6 +374,10 @@ void Module::attachInterrupt(RADIOLIB_PIN_TYPE interruptNum, void (*userFunc)(vo
|
|||
::attachInterrupt(interruptNum, userFunc, mode);
|
||||
}
|
||||
|
||||
void Module::attachInterrupt(RADIOLIB_PIN_TYPE interruptNum, std::function<void(void)> userFunc, RADIOLIB_INTERRUPT_STATUS mode) {
|
||||
::attachInterrupt(interruptNum, userFunc, mode);
|
||||
}
|
||||
|
||||
void Module::detachInterrupt(RADIOLIB_PIN_TYPE interruptNum) {
|
||||
::detachInterrupt(interruptNum);
|
||||
}
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
#define _RADIOLIB_MODULE_H
|
||||
|
||||
#include "TypeDef.h"
|
||||
#include <functional>
|
||||
#include <FunctionalInterrupt.h>
|
||||
|
||||
|
||||
#include <SPI.h>
|
||||
#ifndef RADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED
|
||||
|
@ -432,6 +435,7 @@ class Module {
|
|||
*/
|
||||
static void attachInterrupt(RADIOLIB_PIN_TYPE interruptNum, void (*userFunc)(void), RADIOLIB_INTERRUPT_STATUS mode);
|
||||
|
||||
static void attachInterrupt(RADIOLIB_PIN_TYPE interruptNum, std::function<void(void)> userFunc, RADIOLIB_INTERRUPT_STATUS mode);
|
||||
/*!
|
||||
\brief Arduino core detachInterrupt override.
|
||||
|
||||
|
|
|
@ -414,6 +414,10 @@ void SX127x::setDio0Action(void (*func)(void)) {
|
|||
Module::attachInterrupt(RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(_mod->getIrq()), func, RISING);
|
||||
}
|
||||
|
||||
void SX127x::setDio0Action(std::function<void(void)> func) {
|
||||
Module::attachInterrupt(RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(_mod->getIrq()), func, RISING);
|
||||
}
|
||||
|
||||
void SX127x::clearDio0Action() {
|
||||
Module::detachInterrupt(RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(_mod->getIrq()));
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#if !defined(_RADIOLIB_SX127X_H)
|
||||
#define _RADIOLIB_SX127X_H
|
||||
|
||||
#include <functional>
|
||||
#include "../../TypeDef.h"
|
||||
|
||||
#if !defined(RADIOLIB_EXCLUDE_SX127X)
|
||||
|
@ -682,6 +683,9 @@ class SX127x: public PhysicalLayer {
|
|||
*/
|
||||
void setDio0Action(void (*func)(void));
|
||||
|
||||
|
||||
void setDio0Action(std::function<void(void)> func);
|
||||
|
||||
/*!
|
||||
\brief Clears interrupt service routine to call when DIO0 activates.
|
||||
*/
|
||||
|
|
Loading…
Add table
Reference in a new issue