| 618 | } |
| 619 | |
| 620 | void 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 | |
| 646 | byte LoRaClass::random() |
| 647 | { |
nothing calls this directly
no outgoing calls
no test coverage detected