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
|
||||
bool transmitFlag = false;
|
||||
|
||||
// disable interrupt when it's not needed
|
||||
volatile bool enableInterrupt = true;
|
||||
|
||||
// flag to indicate that a packet was sent or received
|
||||
volatile bool operationDone = false;
|
||||
|
||||
|
@ -43,11 +40,6 @@ volatile bool operationDone = false;
|
|||
// IMPORTANT: this function MUST be 'void' type
|
||||
// and MUST NOT have any arguments!
|
||||
void setFlag(void) {
|
||||
// check if the interrupt is enabled
|
||||
if(!enableInterrupt) {
|
||||
return;
|
||||
}
|
||||
|
||||
// we sent or received packet, set the flag
|
||||
operationDone = true;
|
||||
}
|
||||
|
@ -92,10 +84,6 @@ void setup() {
|
|||
void loop() {
|
||||
// check if the previous operation finished
|
||||
if(operationDone) {
|
||||
// disable the interrupt service routine while
|
||||
// processing the data
|
||||
enableInterrupt = false;
|
||||
|
||||
// reset flag
|
||||
operationDone = false;
|
||||
|
||||
|
@ -150,10 +138,5 @@ void loop() {
|
|||
transmissionState = radio.startTransmit("Hello World!");
|
||||
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
|
||||
volatile bool receivedFlag = false;
|
||||
|
||||
// disable interrupt when it's not needed
|
||||
volatile bool enableInterrupt = true;
|
||||
|
||||
// how many bytes are there in total
|
||||
const int totalLength = 512;
|
||||
|
||||
|
@ -106,11 +103,6 @@ volatile uint8_t rxBuffer[totalLength + 1];
|
|||
ICACHE_RAM_ATTR
|
||||
#endif
|
||||
void fifoGet(void) {
|
||||
// check if the interrupt is enabled
|
||||
if(!enableInterrupt) {
|
||||
return;
|
||||
}
|
||||
|
||||
// set the flag when we receive the full packet
|
||||
receivedFlag = radio.fifoGet(rxBuffer, totalLength, &receivedLength);
|
||||
}
|
||||
|
@ -118,10 +110,6 @@ void fifoGet(void) {
|
|||
void loop() {
|
||||
// check if the flag is set
|
||||
if(receivedFlag) {
|
||||
// disable the interrupt service routine while
|
||||
// processing the data
|
||||
enableInterrupt = false;
|
||||
|
||||
// packet was successfully received
|
||||
Serial.println(F("[SX1278] Received packet!"));
|
||||
|
||||
|
@ -135,10 +123,5 @@ void loop() {
|
|||
|
||||
// put module back to listen mode
|
||||
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);
|
||||
}
|
||||
|
||||
// disable interrupt when it's not needed
|
||||
volatile bool enableInterrupt = true;
|
||||
|
||||
// flag to indicate we can keep adding more bytes to FIFO
|
||||
volatile bool fifoEmpty = false;
|
||||
|
||||
|
@ -103,31 +100,18 @@ int remLength = totalLength;
|
|||
ICACHE_RAM_ATTR
|
||||
#endif
|
||||
void fifoAdd(void) {
|
||||
// check if the interrupt is enabled
|
||||
if(!enableInterrupt) {
|
||||
return;
|
||||
}
|
||||
|
||||
// we can send more bytes
|
||||
fifoEmpty = true;
|
||||
}
|
||||
|
||||
void loop() {
|
||||
if(fifoEmpty) {
|
||||
// disable the interrupt service routine while
|
||||
// processing the data
|
||||
enableInterrupt = false;
|
||||
|
||||
// reset flag
|
||||
fifoEmpty = false;
|
||||
|
||||
// add more bytes to the transmit buffer
|
||||
uint8_t* txBuffPtr = (uint8_t*)longPacket.c_str();
|
||||
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
|
||||
|
|
Loading…
Add table
Reference in a new issue