Created
January 4, 2022 18:19
-
-
Save wybiral/8b99e8548a694aa23a5024614cc87b7a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Defaults: | |
// Bw = 125 kHz | |
// Cr = 4/5 | |
// Sf = 128chips/symbol | |
// CRC on | |
RH_RF95::ModemConfig modem = {0x72, 0x74, 0x00}; | |
void setBandwidth(uint32_t bw) { | |
uint8_t index; | |
uint32_t bandwidths[] = { | |
7800, | |
10400, | |
15600, | |
20800, | |
31250, | |
41700, | |
62500, | |
125000, | |
250000, | |
500000 | |
}; | |
for (index = 0x00; index < 9; index++) { | |
if (bw <= bandwidths[index]) { | |
break; | |
} | |
} | |
modem.reg_1d = (modem.reg_1d & 0x0f) | (index << 4); | |
} | |
void setSpreadingFactor(uint8_t sf) { | |
if (sf < 6 || sf > 12) { | |
return; | |
} | |
modem.reg_1e = (modem.reg_1e & 0x0f) | (sf << 4); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment