[SX128x] Implemented generic IRQ actions
This commit is contained in:
parent
787ebde43e
commit
1f6acc8347
4 changed files with 40 additions and 2 deletions
|
@ -51,7 +51,7 @@ void setup() {
|
|||
|
||||
// set the function that will be called
|
||||
// when new packet is received
|
||||
radio.setDio1Action(setFlag);
|
||||
radio.setPacketReceivedAction(setFlag);
|
||||
|
||||
// start listening for LoRa packets
|
||||
Serial.print(F("[SX1280] Starting to listen ... "));
|
||||
|
|
|
@ -50,7 +50,7 @@ void setup() {
|
|||
|
||||
// set the function that will be called
|
||||
// when packet transmission is finished
|
||||
radio.setDio1Action(setFlag);
|
||||
radio.setPacketSentAction(setFlag);
|
||||
|
||||
// start transmitting the first packet
|
||||
Serial.print(F("[SX1280] Sending first packet ... "));
|
||||
|
|
|
@ -476,6 +476,22 @@ void SX128x::clearDio1Action() {
|
|||
this->mod->hal->detachInterrupt(this->mod->hal->pinToInterrupt(this->mod->getIrq()));
|
||||
}
|
||||
|
||||
void SX128x::setPacketReceivedAction(void (*func)(void)) {
|
||||
this->setDio1Action(func);
|
||||
}
|
||||
|
||||
void SX128x::clearPacketReceivedAction() {
|
||||
this->clearDio1Action();
|
||||
}
|
||||
|
||||
void SX128x::setPacketSentAction(void (*func)(void)) {
|
||||
this->setDio1Action(func);
|
||||
}
|
||||
|
||||
void SX128x::clearPacketSentAction() {
|
||||
this->clearDio1Action();
|
||||
}
|
||||
|
||||
int16_t SX128x::startTransmit(uint8_t* data, size_t len, uint8_t addr) {
|
||||
// suppress unused variable warning
|
||||
(void)addr;
|
||||
|
|
|
@ -495,6 +495,28 @@ class SX128x: 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 Interrupt-driven binary transmit method.
|
||||
Overloads for string-based transmissions are implemented in PhysicalLayer.
|
||||
|
|
Loading…
Add table
Reference in a new issue