Skip to content

Commit

Permalink
Method SetBitrateTolerance added for CC1101, Updated error handling (#…
Browse files Browse the repository at this point in the history
…1152)

* Update TypeDef.h

* Update CC1101.h

* Update CC1101.cpp

* Update CC1101.cpp

Update of error handling
  • Loading branch information
OlliLausS authored Jul 8, 2024
1 parent ace0997 commit 61a4cae
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/TypeDef.h
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,11 @@
*/
#define RADIOLIB_ERR_INVALID_OOK_RSSI_PEAK_TYPE (-108)

/*!
\brief Supplied Bitrate tolerance value is out of Range.
*/
#define RADIOLIB_ERR_INVALID_BIT_RATE_TOLERANCE_VALUE (-109)

// APRS status codes

/*!
Expand Down
9 changes: 9 additions & 0 deletions src/modules/CC1101/CC1101.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,15 @@ int16_t CC1101::setBitRate(float br) {
return(state);
}

int16_t CC1101::setBitRateTolerance(uint8_t brt) {
if (brt > 0x03) return (RADIOLIB_ERR_INVALID_BIT_RATE_TOLERANCE_VALUE);

// Set Bit Rate tolerance
int16_t state = SPIsetRegValue(RADIOLIB_CC1101_REG_BSCFG, brt, 1, 0);

return(state);
}

int16_t CC1101::setRxBandwidth(float rxBw) {
RADIOLIB_CHECK_RANGE(rxBw, 58.0, 812.0, RADIOLIB_ERR_INVALID_RX_BANDWIDTH);

Expand Down
7 changes: 7 additions & 0 deletions src/modules/CC1101/CC1101.h
Original file line number Diff line number Diff line change
Expand Up @@ -738,6 +738,13 @@ class CC1101: public PhysicalLayer {
*/
int16_t setBitRate(float br) override;

/*!
\brief Sets bit rate tolerance in BSCFG register. Allowed values are 0:(0%), 1(3,125%), 2:(6,25%) and 3:(12,5%).
\param brt Bit rate tolerance to be set.
\returns \ref status_codes
*/
int16_t setBitRateTolerance(uint8_t brt);

/*!
\brief Sets receiver bandwidth. Allowed values are 58, 68, 81, 102, 116, 135, 162,
203, 232, 270, 325, 406, 464, 541, 650 and 812 kHz.
Expand Down

0 comments on commit 61a4cae

Please sign in to comment.