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

Method setSpreadingFactor

Code/Arduino_libraries/LoRa/LoRa.cpp:478–496  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

476}
477
478void LoRaClass::setSpreadingFactor(int sf)
479{
480 if (sf < 6) {
481 sf = 6;
482 } else if (sf > 12) {
483 sf = 12;
484 }
485
486 if (sf == 6) {
487 writeRegister(REG_DETECTION_OPTIMIZE, 0xc5);
488 writeRegister(REG_DETECTION_THRESHOLD, 0x0c);
489 } else {
490 writeRegister(REG_DETECTION_OPTIMIZE, 0xc3);
491 writeRegister(REG_DETECTION_THRESHOLD, 0x0a);
492 }
493
494 writeRegister(REG_MODEM_CONFIG_2, (readRegister(REG_MODEM_CONFIG_2) & 0x0f) | ((sf << 4) & 0xf0));
495 setLdoFlag();
496}
497
498long LoRaClass::getSignalBandwidth()
499{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected