[SX128x] Implemented generic IRQ actions

pull/779/head
jgromes 2023-06-21 22:23:43 +02:00
rodzic 787ebde43e
commit 1f6acc8347
4 zmienionych plików z 40 dodań i 2 usunięć

Wyświetl plik

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

Wyświetl plik

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

Wyświetl plik

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

Wyświetl plik

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