[RF69] Implemented generic actions

pull/779/head
jgromes 2023-06-21 22:15:54 +02:00
rodzic 43b9b13903
commit df126c92f9
4 zmienionych plików z 40 dodań i 2 usunięć

Wyświetl plik

@ -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 ... "));

Wyświetl plik

@ -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).

Wyświetl plik

@ -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) {

Wyświetl plik

@ -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.