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

Si4430.cpp (988B)

      1 #include "Si4430.h"
      2 #if !defined(RADIOLIB_EXCLUDE_SI443X)
      3 
      4 Si4430::Si4430(Module* mod) : Si4432(mod) {
      5 
      6 }
      7 
      8 int16_t Si4430::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\tSi4430"));
     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 Si4430::setFrequency(float freq) {
     25   RADIOLIB_CHECK_RANGE(freq, 900.0, 960.0, RADIOLIB_ERR_INVALID_FREQUENCY);
     26 
     27   // set frequency
     28   return(Si443x::setFrequencyRaw(freq));
     29 }
     30 
     31 int16_t Si4430::setOutputPower(int8_t power) {
     32   RADIOLIB_CHECK_RANGE(power, -8, 13, RADIOLIB_ERR_INVALID_OUTPUT_POWER);
     33 
     34   // set output power
     35   return(_mod->SPIsetRegValue(RADIOLIB_SI443X_REG_TX_POWER, (uint8_t)((power + 8) / 3), 2, 0));
     36 }
     37 
     38 #endif