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

Si4431.cpp (805B)

      1 #include "Si4431.h"
      2 #if !defined(RADIOLIB_EXCLUDE_SI443X)
      3 
      4 Si4431::Si4431(Module* mod) : Si4432(mod) {
      5 
      6 }
      7 
      8 int16_t Si4431::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\tSi4431"));
     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 Si4431::setOutputPower(int8_t power) {
     25   RADIOLIB_CHECK_RANGE(power, -8, 13, RADIOLIB_ERR_INVALID_OUTPUT_POWER);
     26 
     27   // set output power
     28   return(_mod->SPIsetRegValue(RADIOLIB_SI443X_REG_TX_POWER, (uint8_t)((power + 8) / 3), 2, 0));
     29 }
     30 
     31 #endif