Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SX127x/RF69] Added setFifoThreshold #1309

Merged
merged 4 commits into from
Nov 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/modules/RF69/RF69.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 8 additions & 0 deletions src/modules/RF69/RF69.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 4 additions & 0 deletions src/modules/SX127x/SX127x.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 8 additions & 0 deletions src/modules/SX127x/SX127x.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Loading