acid-drop- Hacking the planet from a LilyGo T-Deck using custom firmware |
git clone git://git.acid.vegas/acid-drop.git |
Log | Files | Refs | Archive | README | LICENSE |
Si4432.cpp (988B)
1 #include "Si4432.h" 2 #if !defined(RADIOLIB_EXCLUDE_SI443X) 3 4 Si4432::Si4432(Module* mod) : Si443x(mod) { 5 6 } 7 8 int16_t Si4432::begin(float freq, float br, float freqDev, float rxBw, int8_t power, uint8_t preambleLen) { 9 // execute common part 10 int16_t state = Si443x::begin(br, freqDev, rxBw, preambleLen); 11 RADIOLIB_ASSERT(state); 12 RADIOLIB_DEBUG_PRINTLN(F("M\tSi4432")); 13 14 // configure publicly accessible settings 15 state = setFrequency(freq); 16 RADIOLIB_ASSERT(state); 17 18 state = setOutputPower(power); 19 RADIOLIB_ASSERT(state); 20 21 return(state); 22 } 23 24 int16_t Si4432::setFrequency(float freq) { 25 RADIOLIB_CHECK_RANGE(freq, 240.0, 930.0, RADIOLIB_ERR_INVALID_FREQUENCY); 26 27 // set frequency 28 return(Si443x::setFrequencyRaw(freq)); 29 } 30 31 int16_t Si4432::setOutputPower(int8_t power) { 32 RADIOLIB_CHECK_RANGE(power, -1, 20, RADIOLIB_ERR_INVALID_OUTPUT_POWER); 33 34 // set output power 35 return(_mod->SPIsetRegValue(RADIOLIB_SI443X_REG_TX_POWER, (uint8_t)((power + 1) / 3), 2, 0)); 36 } 37 38 #endif