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 |
RFM97.cpp (946B)
1 #include "RFM97.h" 2 #if !defined(RADIOLIB_EXCLUDE_RFM9X) 3 4 RFM97::RFM97(Module* mod) : RFM95(mod) { 5 6 }; 7 8 int16_t RFM97::setSpreadingFactor(uint8_t sf) { 9 // check active modem 10 if(getActiveModem() != RADIOLIB_SX127X_LORA) { 11 return(RADIOLIB_ERR_WRONG_MODEM); 12 } 13 14 uint8_t newSpreadingFactor; 15 16 // check allowed spreading factor values 17 switch(sf) { 18 case 6: 19 newSpreadingFactor = RADIOLIB_SX127X_SF_6; 20 break; 21 case 7: 22 newSpreadingFactor = RADIOLIB_SX127X_SF_7; 23 break; 24 case 8: 25 newSpreadingFactor = RADIOLIB_SX127X_SF_8; 26 break; 27 case 9: 28 newSpreadingFactor = RADIOLIB_SX127X_SF_9; 29 break; 30 default: 31 return(RADIOLIB_ERR_INVALID_SPREADING_FACTOR); 32 } 33 34 // set spreading factor and if successful, save the new setting 35 int16_t state = SX1278::setSpreadingFactorRaw(newSpreadingFactor); 36 if(state == RADIOLIB_ERR_NONE) { 37 SX127x::_sf = sf; 38 } 39 return(state); 40 } 41 42 #endif