Skip to content

Commit

Permalink
[SX127x/RF69] Added setFifoThreshold (#1309)
Browse files Browse the repository at this point in the history
* [SX127x] Added setFifoThreshold

* [SX127x] Added setFifoThreshold

* Add setFifoThreshold to RF69 class.

* Documentation update, about setFifoThreshold.
  • Loading branch information
SzczepanLeon authored Nov 3, 2024
1 parent 4986893 commit cb45f4f
Showing 4 changed files with 24 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/modules/RF69/RF69.cpp
Original file line number Diff line number Diff line change
@@ -321,6 +321,10 @@ void RF69::clearFifoEmptyAction() {
clearDio1Action();
}

void RF69::setFifoThreshold(uint8_t threshold) {
this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_FIFO_THRESH, threshold, 6, 0);
}

void RF69::setFifoFullAction(void (*func)(void)) {
// set the interrupt
this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_FIFO_THRESH, RADIOLIB_RF69_FIFO_THRESH, 6, 0);
8 changes: 8 additions & 0 deletions src/modules/RF69/RF69.h
Original file line number Diff line number Diff line change
@@ -648,6 +648,14 @@ class RF69: public PhysicalLayer {
*/
void clearFifoEmptyAction();

/*!
\brief Set FIFO threshold level.
Be aware that threshold is also set in setFifoFullAction method.
setFifoThreshold method must be called AFTER calling setFifoFullAction!
\param Threshold level.
*/
void setFifoThreshold(uint8_t threshold);

/*!
\brief Set interrupt service routine function to call when FIFO is full.
\param func Pointer to interrupt service routine.
4 changes: 4 additions & 0 deletions src/modules/SX127x/SX127x.cpp
Original file line number Diff line number Diff line change
@@ -504,6 +504,10 @@ void SX127x::clearFifoEmptyAction() {
clearDio1Action();
}

void SX127x::setFifoThreshold(uint8_t threshold) {
this->mod->SPIsetRegValue(RADIOLIB_SX127X_REG_FIFO_THRESH, threshold, 5, 0);
}

void SX127x::setFifoFullAction(void (*func)(void)) {
// set the interrupt
this->mod->SPIsetRegValue(RADIOLIB_SX127X_REG_FIFO_THRESH, RADIOLIB_SX127X_FIFO_THRESH, 5, 0);
8 changes: 8 additions & 0 deletions src/modules/SX127x/SX127x.h
Original file line number Diff line number Diff line change
@@ -761,6 +761,14 @@ class SX127x: public PhysicalLayer {
*/
void clearFifoEmptyAction();

/*!
\brief Set FIFO threshold level.
Be aware that threshold is also set in setFifoFullAction method.
setFifoThreshold method must be called AFTER calling setFifoFullAction!
\param Threshold level.
*/
void setFifoThreshold(uint8_t threshold);

/*!
\brief Set interrupt service routine function to call when FIFO is full.
\param func Pointer to interrupt service routine.

0 comments on commit cb45f4f

Please sign in to comment.