Method SetBitrateTolerance added for CC1101, Updated error handling (#1152)

* Update TypeDef.h

* Update CC1101.h

* Update CC1101.cpp

* Update CC1101.cpp

Update of error handling
pull/1158/head
Oliver 2024-07-08 22:37:09 +02:00 zatwierdzone przez GitHub
rodzic ace0997359
commit 61a4cae935
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: B5690EEEBB952194
3 zmienionych plików z 21 dodań i 0 usunięć

Wyświetl plik

@ -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
/*!

Wyświetl plik

@ -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);

Wyświetl plik

@ -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.