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

SX1261.cpp (756B)

      1 #include "SX1261.h"
      2 #if !defined(RADIOLIB_EXCLUDE_SX126X)
      3 
      4 SX1261::SX1261(Module* mod): SX1262(mod) {
      5 
      6 }
      7 
      8 int16_t SX1261::setOutputPower(int8_t power) {
      9   RADIOLIB_CHECK_RANGE(power, -17, 14, RADIOLIB_ERR_INVALID_OUTPUT_POWER);
     10 
     11   // get current OCP configuration
     12   uint8_t ocp = 0;
     13   int16_t state = readRegister(RADIOLIB_SX126X_REG_OCP_CONFIGURATION, &ocp, 1);
     14   RADIOLIB_ASSERT(state);
     15 
     16   // set PA config
     17   state = SX126x::setPaConfig(0x04, RADIOLIB_SX126X_PA_CONFIG_SX1261, 0x00);
     18   RADIOLIB_ASSERT(state);
     19 
     20   // set output power
     21   /// \todo power ramp time configuration
     22   state = SX126x::setTxParams(power);
     23   RADIOLIB_ASSERT(state);
     24 
     25   // restore OCP configuration
     26   return(writeRegister(RADIOLIB_SX126X_REG_OCP_CONFIGURATION, &ocp, 1));
     27 }
     28 
     29 #endif