[SX127x] Sync with LoRaLib v5.2.1
This commit is contained in:
parent
17f6e585c3
commit
c8aa9f57fd
3 changed files with 29 additions and 5 deletions
|
@ -421,9 +421,9 @@ int16_t SX127x::directMode(uint32_t FRF) {
|
|||
|
||||
// user requested to start transmitting immediately (required for RTTY)
|
||||
if(FRF != 0) {
|
||||
_mod->SPIsetRegValue(SX127X_REG_FRF_MSB, (FRF & 0xFF0000) >> 16);
|
||||
_mod->SPIsetRegValue(SX127X_REG_FRF_MID, (FRF & 0x00FF00) >> 8);
|
||||
_mod->SPIsetRegValue(SX127X_REG_FRF_LSB, FRF & 0x0000FF);
|
||||
_mod->SPIwriteRegister(SX127X_REG_FRF_MSB, (FRF & 0xFF0000) >> 16);
|
||||
_mod->SPIwriteRegister(SX127X_REG_FRF_MID, (FRF & 0x00FF00) >> 8);
|
||||
_mod->SPIwriteRegister(SX127X_REG_FRF_LSB, FRF & 0x0000FF);
|
||||
|
||||
return(setMode(SX127X_TX));
|
||||
}
|
||||
|
@ -902,7 +902,7 @@ int16_t SX127x::setSyncWord(uint8_t* syncWord, size_t len) {
|
|||
}
|
||||
|
||||
// check constraints
|
||||
if(len > 7) {
|
||||
if(len >= 7) {
|
||||
return(ERR_INVALID_SYNC_WORD);
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
#include "TypeDef.h"
|
||||
#include "Module.h"
|
||||
|
||||
#include "../protocols/PhysicalLayer.h"
|
||||
|
||||
// SX127x series common LoRa registers
|
||||
#define SX127X_REG_FIFO 0x00
|
||||
#define SX127X_REG_OP_MODE 0x01
|
||||
|
@ -515,7 +517,7 @@
|
|||
#define SX127X_PLL_BANDWIDTH_225_KHZ 0b10000000 // 7 6 225 kHz
|
||||
#define SX127X_PLL_BANDWIDTH_300_KHZ 0b11000000 // 7 6 300 kHz (default)
|
||||
|
||||
class SX127x {
|
||||
class SX127x: public PhysicalLayer {
|
||||
public:
|
||||
// constructor
|
||||
SX127x(Module* mod);
|
||||
|
|
22
src/protocols/PhysicalLayer.h
Normal file
22
src/protocols/PhysicalLayer.h
Normal file
|
@ -0,0 +1,22 @@
|
|||
#ifndef _KITELIB_PHYSICAL_LAYER_H
|
||||
#define _KITELIB_PHYSICAL_LAYER_H
|
||||
|
||||
#include "TypeDef.h"
|
||||
|
||||
class PhysicalLayer {
|
||||
public:
|
||||
// constructor
|
||||
// this class is purely virtual and does not require explicit constructor
|
||||
|
||||
// basic methods
|
||||
virtual int16_t directMode(uint32_t FRF = 0) = 0;
|
||||
virtual int16_t transmit(const char* data, uint8_t addr = 0) = 0;
|
||||
virtual int16_t transmit(uint8_t* data, size_t len, uint8_t addr = 0) = 0;
|
||||
virtual int16_t receive(uint8_t* data, size_t len) = 0;
|
||||
|
||||
// configuration methods
|
||||
virtual int16_t setFrequencyDeviation(float freqDev) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Add table
Reference in a new issue