MCPcopy Create free account
hub / github.com/LowPowerLab/RFM69 / setPowerLevel

Method setPowerLevel

RFM69.cpp:260–286  ·  view source on GitHub ↗

Control transmitter output power (this is NOT a dBm value!) the power configurations are explained in the SX1231H datasheet (Table 10 on p21; RegPaLevel p66): http://www.semtech.com/images/datasheet/sx1231h.pdf valid powerLevel parameter values are 0-31 and result in a directly proportional effect on the output/transmission power this function implements 2 modes as follows: - for RFM69 W/CW the ra

Source from the content-addressed store, hash-verified

258// The HW/HCW range overlaps are to smooth out transitions between the 3 PA domains, based on actual current/RSSI measurements
259// Any changes to this function also demand changes in dependent function setPowerDBm()
260void RFM69::setPowerLevel(uint8_t powerLevel) {
261 uint8_t PA_SETTING;
262 if (_isRFM69HW) {
263 if (powerLevel > 23) powerLevel = 23;
264 _powerLevel = powerLevel;
265
266 //now set Pout value & active PAs based on _powerLevel range as outlined in summary above
267 if (_powerLevel < 16) {
268 powerLevel += 16;
269 PA_SETTING = RF_PALEVEL_PA1_ON; // enable PA1 only
270 } else {
271 if (_powerLevel < 20)
272 powerLevel += 10;
273 else
274 powerLevel += 8;
275 PA_SETTING = RF_PALEVEL_PA1_ON | RF_PALEVEL_PA2_ON; // enable PA1+PA2
276 }
277 setHighPowerRegs(true); //always call this in case we're crossing power boundaries in TX mode
278 } else { //this is a W/CW, register value is the same as _powerLevel
279 if (powerLevel > 31) powerLevel = 31;
280 _powerLevel = powerLevel;
281 PA_SETTING = RF_PALEVEL_PA0_ON; // enable PA0 only
282 }
283
284 //write value to REG_PALEVEL
285 writeReg(REG_PALEVEL, PA_SETTING | powerLevel);
286}
287
288uint8_t RFM69::getOutputPower() {
289 // _RegisterBits(_REG_PA_LEVEL, offset=0, bits=5)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected