You've already forked arduino-LoRa
mirror of
https://github.com/sandeepmistry/arduino-LoRa.git
synced 2025-07-12 09:21:40 +03:00
Add setFrequency API
This commit is contained in:
@ -33,6 +33,7 @@ receive KEYWORD2
|
||||
idle KEYWORD2
|
||||
sleep KEYWORD2
|
||||
|
||||
setFrequency KEYWORD2
|
||||
setTxPower KEYWORD2
|
||||
setSpreadingFactor KEYWORD2
|
||||
setSignalBandwidth KEYWORD2
|
||||
|
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) {
|
||||
|
@ -37,6 +37,7 @@ public:
|
||||
void idle();
|
||||
void sleep();
|
||||
|
||||
void setFrequency(long frequency);
|
||||
void setTxPower(int level);
|
||||
void setSpreadingFactor(int sf);
|
||||
void setSignalBandwidth(long sbw);
|
||||
|
Reference in New Issue
Block a user