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

Method setGain

Code/Arduino_libraries/LoRa/LoRa.cpp:620–644  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

618}
619
620void LoRaClass::setGain(uint8_t gain)
621{
622 // check allowed range
623 if (gain > 6) {
624 gain = 6;
625 }
626
627 // set to standby
628 idle();
629
630 // set gain
631 if (gain == 0) {
632 // if gain = 0, enable AGC
633 writeRegister(REG_MODEM_CONFIG_3, 0x04);
634 } else {
635 // disable AGC
636 writeRegister(REG_MODEM_CONFIG_3, 0x00);
637
638 // clear Gain and set LNA boost
639 writeRegister(REG_LNA, 0x03);
640
641 // set gain
642 writeRegister(REG_LNA, readRegister(REG_LNA) | (gain << 5));
643 }
644}
645
646byte LoRaClass::random()
647{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected