MCPcopy Create free account
hub / github.com/PricelessToolkit/MailBoxGuard / setTxPower

Method setTxPower

Code/Arduino_libraries/LoRa/LoRa.cpp:425–460  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

423}
424
425void LoRaClass::setTxPower(int level, int outputPin)
426{
427 if (PA_OUTPUT_RFO_PIN == outputPin) {
428 // RFO
429 if (level < 0) {
430 level = 0;
431 } else if (level > 14) {
432 level = 14;
433 }
434
435 writeRegister(REG_PA_CONFIG, 0x70 | level);
436 } else {
437 // PA BOOST
438 if (level > 17) {
439 if (level > 20) {
440 level = 20;
441 }
442
443 // subtract 3 from level, so 18 - 20 maps to 15 - 17
444 level -= 3;
445
446 // High Power +20 dBm Operation (Semtech SX1276/77/78/79 5.4.3.)
447 writeRegister(REG_PA_DAC, 0x87);
448 setOCP(140);
449 } else {
450 if (level < 2) {
451 level = 2;
452 }
453 //Default value PA_HF/LF or +17dBm
454 writeRegister(REG_PA_DAC, 0x84);
455 setOCP(100);
456 }
457
458 writeRegister(REG_PA_CONFIG, PA_BOOST | (level - 2));
459 }
460}
461
462void LoRaClass::setFrequency(long frequency)
463{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected