You've already forked arduino-LoRa
mirror of
https://github.com/sandeepmistry/arduino-LoRa.git
synced 2025-08-18 00:21:05 +03:00
Add setFrequency API
This commit is contained in:
11
src/LoRa.cpp
11
src/LoRa.cpp
@@ -264,6 +264,17 @@ void LoRaClass::sleep()
|
||||
writeRegister(REG_OP_MODE, MODE_LONG_RANGE_MODE | MODE_SLEEP);
|
||||
}
|
||||
|
||||
void LoRaClass::setFrequency(long frequency)
|
||||
{
|
||||
_frequency = frequency;
|
||||
|
||||
uint64_t frf = ((uint64_t)frequency << 19) / 32000000;
|
||||
|
||||
writeRegister(REG_FRF_MSB, (uint8_t)(frf >> 16));
|
||||
writeRegister(REG_FRF_MID, (uint8_t)(frf >> 8));
|
||||
writeRegister(REG_FRF_LSB, (uint8_t)(frf >> 0));
|
||||
}
|
||||
|
||||
void LoRaClass::setTxPower(int level)
|
||||
{
|
||||
if (level < 2) {
|
||||
|
Reference in New Issue
Block a user