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 |
LLCC68.cpp (1521B)
1 #include "LLCC68.h" 2 #if !defined(RADIOLIB_EXCLUDE_SX126X) 3 4 LLCC68::LLCC68(Module* mod) : SX1262(mod) { 5 6 } 7 8 int16_t LLCC68::begin(float freq, float bw, uint8_t sf, uint8_t cr, uint8_t syncWord, int8_t power, uint16_t preambleLength, float tcxoVoltage, bool useRegulatorLDO) { 9 // execute common part 10 int16_t state = SX126x::begin(cr, syncWord, preambleLength, tcxoVoltage, useRegulatorLDO); 11 RADIOLIB_ASSERT(state); 12 13 // configure publicly accessible settings 14 state = setFrequency(freq); 15 RADIOLIB_ASSERT(state); 16 17 state = setBandwidth(bw); 18 RADIOLIB_ASSERT(state); 19 20 state = setSpreadingFactor(sf); 21 RADIOLIB_ASSERT(state); 22 23 state = setOutputPower(power); 24 RADIOLIB_ASSERT(state); 25 26 state = SX126x::fixPaClamping(); 27 RADIOLIB_ASSERT(state); 28 29 return(state); 30 } 31 32 int16_t LLCC68::setBandwidth(float bw) { 33 RADIOLIB_CHECK_RANGE(bw, 100.0, 510.0, RADIOLIB_ERR_INVALID_BANDWIDTH); 34 return(SX1262::setBandwidth(bw)); 35 } 36 37 int16_t LLCC68::setSpreadingFactor(uint8_t sf) { 38 switch(SX126x::_bw) { 39 case RADIOLIB_SX126X_LORA_BW_125_0: 40 RADIOLIB_CHECK_RANGE(sf, 5, 9, RADIOLIB_ERR_INVALID_SPREADING_FACTOR); 41 break; 42 case RADIOLIB_SX126X_LORA_BW_250_0: 43 RADIOLIB_CHECK_RANGE(sf, 5, 10, RADIOLIB_ERR_INVALID_SPREADING_FACTOR); 44 break; 45 case RADIOLIB_SX126X_LORA_BW_500_0: 46 RADIOLIB_CHECK_RANGE(sf, 5, 11, RADIOLIB_ERR_INVALID_SPREADING_FACTOR); 47 break; 48 default: 49 return(RADIOLIB_ERR_INVALID_SPREADING_FACTOR); 50 } 51 52 return(SX1262::setSpreadingFactor(sf)); 53 } 54 55 #endif