Removed remaining enable interrupt (#657)
This commit is contained in:
parent
6666060d52
commit
27c1eb715a
3 changed files with 0 additions and 50 deletions
|
@ -32,9 +32,6 @@ int transmissionState = RADIOLIB_ERR_NONE;
|
||||||
// flag to indicate transmission or reception state
|
// flag to indicate transmission or reception state
|
||||||
bool transmitFlag = false;
|
bool transmitFlag = false;
|
||||||
|
|
||||||
// disable interrupt when it's not needed
|
|
||||||
volatile bool enableInterrupt = true;
|
|
||||||
|
|
||||||
// flag to indicate that a packet was sent or received
|
// flag to indicate that a packet was sent or received
|
||||||
volatile bool operationDone = false;
|
volatile bool operationDone = false;
|
||||||
|
|
||||||
|
@ -43,11 +40,6 @@ volatile bool operationDone = false;
|
||||||
// IMPORTANT: this function MUST be 'void' type
|
// IMPORTANT: this function MUST be 'void' type
|
||||||
// and MUST NOT have any arguments!
|
// and MUST NOT have any arguments!
|
||||||
void setFlag(void) {
|
void setFlag(void) {
|
||||||
// check if the interrupt is enabled
|
|
||||||
if(!enableInterrupt) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// we sent or received packet, set the flag
|
// we sent or received packet, set the flag
|
||||||
operationDone = true;
|
operationDone = true;
|
||||||
}
|
}
|
||||||
|
@ -92,10 +84,6 @@ void setup() {
|
||||||
void loop() {
|
void loop() {
|
||||||
// check if the previous operation finished
|
// check if the previous operation finished
|
||||||
if(operationDone) {
|
if(operationDone) {
|
||||||
// disable the interrupt service routine while
|
|
||||||
// processing the data
|
|
||||||
enableInterrupt = false;
|
|
||||||
|
|
||||||
// reset flag
|
// reset flag
|
||||||
operationDone = false;
|
operationDone = false;
|
||||||
|
|
||||||
|
@ -150,10 +138,5 @@ void loop() {
|
||||||
transmissionState = radio.startTransmit("Hello World!");
|
transmissionState = radio.startTransmit("Hello World!");
|
||||||
transmitFlag = true;
|
transmitFlag = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// we're ready to process more packets,
|
|
||||||
// enable interrupt service routine
|
|
||||||
enableInterrupt = true;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,9 +86,6 @@ void setup() {
|
||||||
// flag to indicate that a packet was received
|
// flag to indicate that a packet was received
|
||||||
volatile bool receivedFlag = false;
|
volatile bool receivedFlag = false;
|
||||||
|
|
||||||
// disable interrupt when it's not needed
|
|
||||||
volatile bool enableInterrupt = true;
|
|
||||||
|
|
||||||
// how many bytes are there in total
|
// how many bytes are there in total
|
||||||
const int totalLength = 512;
|
const int totalLength = 512;
|
||||||
|
|
||||||
|
@ -106,11 +103,6 @@ volatile uint8_t rxBuffer[totalLength + 1];
|
||||||
ICACHE_RAM_ATTR
|
ICACHE_RAM_ATTR
|
||||||
#endif
|
#endif
|
||||||
void fifoGet(void) {
|
void fifoGet(void) {
|
||||||
// check if the interrupt is enabled
|
|
||||||
if(!enableInterrupt) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// set the flag when we receive the full packet
|
// set the flag when we receive the full packet
|
||||||
receivedFlag = radio.fifoGet(rxBuffer, totalLength, &receivedLength);
|
receivedFlag = radio.fifoGet(rxBuffer, totalLength, &receivedLength);
|
||||||
}
|
}
|
||||||
|
@ -118,10 +110,6 @@ void fifoGet(void) {
|
||||||
void loop() {
|
void loop() {
|
||||||
// check if the flag is set
|
// check if the flag is set
|
||||||
if(receivedFlag) {
|
if(receivedFlag) {
|
||||||
// disable the interrupt service routine while
|
|
||||||
// processing the data
|
|
||||||
enableInterrupt = false;
|
|
||||||
|
|
||||||
// packet was successfully received
|
// packet was successfully received
|
||||||
Serial.println(F("[SX1278] Received packet!"));
|
Serial.println(F("[SX1278] Received packet!"));
|
||||||
|
|
||||||
|
@ -135,10 +123,5 @@ void loop() {
|
||||||
|
|
||||||
// put module back to listen mode
|
// put module back to listen mode
|
||||||
radio.startReceive();
|
radio.startReceive();
|
||||||
|
|
||||||
// we're ready to receive more packets,
|
|
||||||
// enable interrupt service routine
|
|
||||||
enableInterrupt = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,9 +80,6 @@ void setup() {
|
||||||
transmissionState = radio.startTransmit(longPacket);
|
transmissionState = radio.startTransmit(longPacket);
|
||||||
}
|
}
|
||||||
|
|
||||||
// disable interrupt when it's not needed
|
|
||||||
volatile bool enableInterrupt = true;
|
|
||||||
|
|
||||||
// flag to indicate we can keep adding more bytes to FIFO
|
// flag to indicate we can keep adding more bytes to FIFO
|
||||||
volatile bool fifoEmpty = false;
|
volatile bool fifoEmpty = false;
|
||||||
|
|
||||||
|
@ -103,31 +100,18 @@ int remLength = totalLength;
|
||||||
ICACHE_RAM_ATTR
|
ICACHE_RAM_ATTR
|
||||||
#endif
|
#endif
|
||||||
void fifoAdd(void) {
|
void fifoAdd(void) {
|
||||||
// check if the interrupt is enabled
|
|
||||||
if(!enableInterrupt) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// we can send more bytes
|
// we can send more bytes
|
||||||
fifoEmpty = true;
|
fifoEmpty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
if(fifoEmpty) {
|
if(fifoEmpty) {
|
||||||
// disable the interrupt service routine while
|
|
||||||
// processing the data
|
|
||||||
enableInterrupt = false;
|
|
||||||
|
|
||||||
// reset flag
|
// reset flag
|
||||||
fifoEmpty = false;
|
fifoEmpty = false;
|
||||||
|
|
||||||
// add more bytes to the transmit buffer
|
// add more bytes to the transmit buffer
|
||||||
uint8_t* txBuffPtr = (uint8_t*)longPacket.c_str();
|
uint8_t* txBuffPtr = (uint8_t*)longPacket.c_str();
|
||||||
transmittedFlag = radio.fifoAdd(txBuffPtr, totalLength, &remLength);
|
transmittedFlag = radio.fifoAdd(txBuffPtr, totalLength, &remLength);
|
||||||
|
|
||||||
// we're ready to send more packets,
|
|
||||||
// enable interrupt service routine
|
|
||||||
enableInterrupt = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if the previous transmission finished
|
// check if the previous transmission finished
|
||||||
|
|
Loading…
Add table
Reference in a new issue