[Si443x] Changed shaping datatype to uint8_t
This commit is contained in:
parent
be346eb6aa
commit
3312645d90
2 changed files with 20 additions and 15 deletions
|
@ -495,29 +495,33 @@ int16_t Si443x::setEncoding(uint8_t encoding) {
|
|||
// set encoding
|
||||
// TODO - add inverted Manchester?
|
||||
switch(encoding) {
|
||||
case 0:
|
||||
case RADIOLIB_ENCODING_NRZ:
|
||||
return(_mod->SPIsetRegValue(SI443X_REG_MODULATION_MODE_CONTROL_1, SI443X_MANCHESTER_INVERTED_OFF | SI443X_MANCHESTER_OFF | SI443X_WHITENING_OFF, 2, 0));
|
||||
case 1:
|
||||
case RADIOLIB_ENCODING_MANCHESTER:
|
||||
return(_mod->SPIsetRegValue(SI443X_REG_MODULATION_MODE_CONTROL_1, SI443X_MANCHESTER_INVERTED_OFF | SI443X_MANCHESTER_ON | SI443X_WHITENING_OFF, 2, 0));
|
||||
case 2:
|
||||
case RADIOLIB_ENCODING_WHITENING:
|
||||
return(_mod->SPIsetRegValue(SI443X_REG_MODULATION_MODE_CONTROL_1, SI443X_MANCHESTER_INVERTED_OFF | SI443X_MANCHESTER_OFF | SI443X_WHITENING_ON, 2, 0));
|
||||
default:
|
||||
return(ERR_INVALID_ENCODING);
|
||||
}
|
||||
}
|
||||
|
||||
int16_t Si443x::setDataShaping(float sh) {
|
||||
int16_t Si443x::setDataShaping(uint8_t sh) {
|
||||
// set mode to standby
|
||||
int16_t state = standby();
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
if(sh == 0.0) {
|
||||
// set modulation to FSK
|
||||
return(_mod->SPIsetRegValue(SI443X_REG_MODULATION_MODE_CONTROL_2, SI443X_MODULATION_FSK, 1, 0));
|
||||
} else {
|
||||
// set modulation to GFSK
|
||||
// TODO implement fiter configuration - docs claim this should be possible, but seems undocumented
|
||||
return(_mod->SPIsetRegValue(SI443X_REG_MODULATION_MODE_CONTROL_2, SI443X_MODULATION_GFSK, 1, 0));
|
||||
// set data shaping
|
||||
switch(sh) {
|
||||
case RADIOLIB_SHAPING_NONE:
|
||||
return(_mod->SPIsetRegValue(SI443X_REG_MODULATION_MODE_CONTROL_1, SI443X_MANCHESTER_INVERTED_OFF | SI443X_MANCHESTER_OFF | SI443X_WHITENING_OFF, 2, 0));
|
||||
case RADIOLIB_SHAPING_0_3:
|
||||
case RADIOLIB_SHAPING_0_5:
|
||||
case RADIOLIB_SHAPING_1_0:
|
||||
// TODO implement fiter configuration - docs claim this should be possible, but seems undocumented
|
||||
return(_mod->SPIsetRegValue(SI443X_REG_MODULATION_MODE_CONTROL_1, SI443X_MANCHESTER_INVERTED_OFF | SI443X_MANCHESTER_OFF | SI443X_WHITENING_ON, 2, 0));
|
||||
default:
|
||||
return(ERR_INVALID_ENCODING);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -746,22 +746,23 @@ class Si443x: public PhysicalLayer {
|
|||
|
||||
/*!
|
||||
\brief Sets transmission encoding. Only available in FSK mode.
|
||||
Allowed values are RADIOLIB_ENCODING_NRZ, RADIOLIB_ENCODING_MANCHESTER and RADIOLIB_ENCODING_WHITENING.
|
||||
|
||||
\param encoding Encoding to be used. Set to 0 for NRZ, 1 for Manchester and 2 for whitening.
|
||||
\param encoding Encoding to be used.
|
||||
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t setEncoding(uint8_t encoding) override;
|
||||
|
||||
/*!
|
||||
\brief Sets Gaussian filter bandwidth-time product that will be used for data shaping.
|
||||
Allowed values are 0.3, 0.5 or 1.0. Set to 0 to disable data shaping. Only available in FSK mode with FSK modulation.
|
||||
\brief Sets Gaussian filter bandwidth-time product that will be used for data shaping. Only available in FSK mode with FSK modulation.
|
||||
Allowed values are RADIOLIB_SHAPING_0_3, RADIOLIB_SHAPING_0_5 or RADIOLIB_SHAPING_1_0. Set to RADIOLIB_SHAPING_NONE to disable data shaping.
|
||||
|
||||
\param sh Gaussian shaping bandwidth-time product that will be used for data shaping
|
||||
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t setDataShaping(float sh) override;
|
||||
int16_t setDataShaping(uint8_t sh) override;
|
||||
|
||||
/*!
|
||||
\brief Some modules contain external RF switch controlled by two pins. This function gives RadioLib control over those two pins to automatically switch Rx and Tx state.
|
||||
|
|
Loading…
Add table
Reference in a new issue