[RF69] Implemented generic actions
This commit is contained in:
parent
43b9b13903
commit
df126c92f9
4 changed files with 40 additions and 2 deletions
|
@ -41,7 +41,7 @@ void setup() {
|
|||
|
||||
// set the function that will be called
|
||||
// when new packet is received
|
||||
radio.setDio0Action(setFlag);
|
||||
radio.setPacketReceivedAction(setFlag);
|
||||
|
||||
// start listening for packets
|
||||
Serial.print(F("[RF69] Starting to listen ... "));
|
||||
|
|
|
@ -47,7 +47,7 @@ void setup() {
|
|||
|
||||
// set the function that will be called
|
||||
// when packet transmission is finished
|
||||
radio.setDio0Action(setFlag);
|
||||
radio.setPacketSentAction(setFlag);
|
||||
|
||||
// NOTE: some RF69 modules use high power output,
|
||||
// those are usually marked RF69H(C/CW).
|
||||
|
|
|
@ -294,6 +294,22 @@ void RF69::clearDio1Action() {
|
|||
this->mod->hal->detachInterrupt(this->mod->hal->pinToInterrupt(this->mod->getGpio()));
|
||||
}
|
||||
|
||||
void RF69::setPacketReceivedAction(void (*func)(void)) {
|
||||
this->setDio0Action(func);
|
||||
}
|
||||
|
||||
void RF69::clearPacketReceivedAction() {
|
||||
this->clearDio0Action();
|
||||
}
|
||||
|
||||
void RF69::setPacketSentAction(void (*func)(void)) {
|
||||
this->setDio0Action(func);
|
||||
}
|
||||
|
||||
void RF69::clearPacketSentAction() {
|
||||
this->clearDio0Action();
|
||||
}
|
||||
|
||||
void RF69::setFifoEmptyAction(void (*func)(void)) {
|
||||
// set DIO1 to the FIFO empty event (the register setting is done in startTransmit)
|
||||
if(this->mod->getGpio() == RADIOLIB_NC) {
|
||||
|
|
|
@ -617,6 +617,28 @@ class RF69: public PhysicalLayer {
|
|||
*/
|
||||
void clearDio1Action();
|
||||
|
||||
/*!
|
||||
\brief Sets interrupt service routine to call when a packet is received.
|
||||
\param func ISR to call.
|
||||
*/
|
||||
void setPacketReceivedAction(void (*func)(void));
|
||||
|
||||
/*!
|
||||
\brief Clears interrupt service routine to call when a packet is received.
|
||||
*/
|
||||
void clearPacketReceivedAction();
|
||||
|
||||
/*!
|
||||
\brief Sets interrupt service routine to call when a packet is sent.
|
||||
\param func ISR to call.
|
||||
*/
|
||||
void setPacketSentAction(void (*func)(void));
|
||||
|
||||
/*!
|
||||
\brief Clears interrupt service routine to call when a packet is sent.
|
||||
*/
|
||||
void clearPacketSentAction();
|
||||
|
||||
/*!
|
||||
\brief Set interrupt service routine function to call when FIFO is empty.
|
||||
\param func Pointer to interrupt service routine.
|
||||
|
|
Loading…
Add table
Reference in a new issue