Nol.A SDK Library 26.11.2
For IoT System Software Development
Loading...
Searching...
No Matches
SX127xChip Class Referenceabstract

저전력 LoRaTM 및 FSK 무선 통신을 지원하는 Semtech의 SX1272/SX1276을 지원합니다. More...

#include <SX127xChip.hpp>

Inheritance diagram for SX127xChip:
LoRaRadioChip PacketRadioChip SX1272Chip SX1276Chip SystemFeatherM0::RFM9x SystemPLM100S::SX1276

Public Member Functions

 SX127xChip (SPI &s, int8_t pinRxTx, int8_t pinReset, int8_t pinCs, int8_t pinDio0, int8_t pinDio1, int8_t pinDio2, int8_t pinDio3, int8_t pinDio4)
virtual error_t begin ()
error_t readFrame (RadioPacket *frame)
 수신 버퍼에서 프레임을 읽습니다.
bool bufferIsEmpty ()
void flushBuffer ()
virtual void sleep ()
virtual void wakeup ()
error_t transmit (RadioPacket *frame)
bool cca () override
 채널이 혼잡한지 아닌지 검사합니다.
bool supportsLoRaSpreadingFactor (Radio::LoRaSF_t sf) const override
 Returns whether this driver supports the given LoRa spreading factor.
void setTxPower (int8_t dBm)
 송신 출력을 설정합니다.
int8_t getTxPower ()
 현재 설정된 송신 출력을 반환합니다.
void setChannel (uint32_t channel) override
 Sets the channels configuration.
uint32_t getChannel ()
 Gets the channels configuration.
void setPublicNetwork (bool) override
 Syncword를 설정합니다.
void setSyncword (uint8_t syncword)
void doCAD () override
 CAD (Carrier Activity Detection) 검사를 수행합니다. (LoRa 전용).
void setIQMode (bool normal)
 LoRa I&Q 신호 모드를 설정합니다.
void transmitCW () override
 Continuous Wave (CW) 신호를 송출합니다. (LoRa 전용).
void transmitCW (bool enable)
void setOcp (bool enable, uint8_t iMax)
 Overload Current Protection (OCP) 설정을 합니다.
void setStandby () override
State_t getStatus () override
virtual void setLoRaSymbolTimeout (uint16_t nSymbols)=0
Public Member Functions inherited from LoRaRadioChip
virtual void setRadio (Radio::LoRaSF_t sf, Radio::LoRaBW_t bw, Radio::LoRaCR_t cr, bool crcOn=true, bool iqInverted=false, uint16_t symbTimeout=0, uint16_t preambleLen=8, uint8_t payloadLen=0, bool freqHopOn=false, uint8_t hopPeriod=0)
virtual void setRadio (uint32_t datarate, uint32_t bandwidth, uint32_t bandwidthAfc, uint32_t fDev, bool crcOn=true, uint16_t symbTimeout=0, uint16_t preambleLen=5, uint8_t payloadLen=0)
uint32_t getTimeOnAir (uint8_t payloadLen)
virtual int16_t getRssi ()=0
 RSSI를 dB 단위로 읽습니다.
virtual void setFreqOffset (int32_t offsetHz)
 중심 주파수 오차를 제거하기 위한 offset을 설정합니다.
virtual int32_t getFreqOffset ()
 중심 주파수 오차를 제거하기 위한 offset을 가져옵니다.
Public Member Functions inherited from PacketRadioChip
void setCcaThreshold (int16_t dBthreshold)
virtual int64_t getDeviceTimestamp ()
 장치 내부의 timestamp 값을 읽습니다.

Protected Member Functions

virtual void reset ()
virtual void select ()
virtual void deselect ()
virtual void setAntSwLowPower (bool status)
virtual void setAntSwRx ()
virtual void setAntSwTx ()
virtual bool usingPaBoost (uint32_t channel)
void ccaTask () override
void rxTimeout ()
void writeBuffer (uint8_t addr, uint8_t *buffer, uint8_t size)
void write (uint8_t addr, uint8_t data)
void writeFifo (uint8_t *buf, uint8_t size)
void readBuffer (uint8_t addr, uint8_t *buffer, uint8_t size)
uint8_t read (uint8_t addr)
void readFifo (uint8_t *buffer, uint8_t size)
void setOpMode (uint8_t opMode)
void setTx ()
virtual void dio0Interrupt (GPIOInterruptInfo_t &)=0
void dio1Interrupt (GPIOInterruptInfo_t &)
void dio2Interrupt (GPIOInterruptInfo_t &)
void dio3Interrupt (GPIOInterruptInfo_t &)
void dio4Interrupt (GPIOInterruptInfo_t &)
virtual void setTxConfig (Radio::Modulation_t modem, int8_t power, uint32_t fdev, uint32_t bandwidth, uint32_t datarate, uint8_t coderate, uint16_t preambleLen, bool fixLen, bool crcOn, bool freqHopOn, uint8_t hopPeriod, bool iqInverted, uint32_t timeout)=0
virtual void setRxConfig (Radio::Modulation_t modem, uint32_t bandwidth, uint32_t datarate, uint8_t coderate, uint32_t bandwidthAfc, uint16_t preambleLen, uint16_t symbTimeout, bool fixLen, uint8_t payloadLen, bool crcOn, bool freqHopOn, uint8_t hopPeriod, bool iqInverted, bool rxContinuous)=0
void setModemFsk ()
void setModemLoRa ()

Static Protected Member Functions

static uint8_t GetFskBandwidthRegValue (uint32_t bandwidth)
Static Protected Member Functions inherited from LoRaRadioChip
static void CCATask (void *)

Protected Attributes

SPI & spi
const int8_t pinReset
const int8_t pinCs
const int8_t pinDio0
const int8_t pinDio1
const int8_t pinDio2
const int8_t pinDio3
const int8_t pinDio4
const int8_t pinRxTx
bool began = false
bool rxCrcOk = false
Radio::Modulation_t modem
State_t state
uint32_t channel
struct { 
   uint8_t   PreambleDetected 
   uint8_t   SyncWordDetected 
   uint16_t   NbBytes 
   RadioPacket *   txFrame 
   Timer   timeoutTimer 
   uint16_t   timeoutValue 
   uint32_t   Bandwidth 
   uint32_t   Datarate 
   uint8_t   FixedPayloadLen 
   bool   CrcOn 
} fskPacketHandler
struct { 
   int8_t   SnrValue 
   Radio::LoRaCR_t   CodingRate 
   Radio::LoRaBW_t   Bandwidth 
   Radio::LoRaSF_t   Datarate 
   bool   iqInverted 
} loraPacketHandler
uint8_t rxBuffer [RX_BUFFER_SIZE]
uint16_t rxPacketSize
int16_t rssiValue
Protected Attributes inherited from LoRaRadioChip
struct { 
   uint32_t   channel 
   Radio::Modulation_t   modulation 
   int8_t   txPower 
   uint32_t   txTimeout 
   union { 
      struct { 
         uint32_t   drHz 
         uint32_t   bwHz 
         uint32_t   afcBwHz 
         uint32_t   fDevHz 
         uint16_t   symbTimeout 
         bool   addCrc 
         uint16_t   preambleLength 
         uint8_t   fixedPayloadLength 
      }   FSK
      struct { 
         Radio::LoRaSF_t   sf 
         Radio::LoRaCR_t   cr 
         Radio::LoRaBW_t   bw 
         uint16_t   preambleLength 
         uint8_t   fixedPayloadLength 
         bool   iqInverted 
         bool   addCrc 
         uint16_t   symbTimeout 
      }   LoRa
   } 
} defaultSetting
volatile bool inCca = false
bool inChannelBusyHandler = false
int32_t freqOffset

Additional Inherited Members

Public Types inherited from LoRaRadioChip
enum  State_t { RF_IDLE = 0 , RF_RX_RUNNING = 1 , RF_TX_RUNNING = 2 , RF_CAD = 3 }
Static Public Member Functions inherited from LoRaRadioChip
static uint32_t TimeOnAir (Radio::LoRaSF_t, Radio::LoRaBW_t, Radio::LoRaCR_t, uint16_t preambleLen, bool fixLen, uint8_t payloadLen, bool crcOn)
static uint32_t TimeOnAir (uint32_t datarate, uint32_t bandwidth, uint16_t preambleLen, bool fixLen, uint8_t payloadLen, bool crcOn)
Public Attributes inherited from LoRaRadioChip
void(* onCADCompleted )(void *ctx, bool) = nullptr
 LoRa CAD (Carrier Activity Detection) 검사가 완료되면 호출될 콜백함수 포인터
void * ctxOnCADCompleted
 onCADCompleted 가 호출될 때 함께 전달될 context
int8_t antennaGain = 0
 Antenna gain을 고려한 송신 출력(EIRP)을 사용하기 위한 antenna gain (단위: dBi).
void(* onRxTimeout )(void *, GPIOInterruptInfo_t *) = nullptr
void * ctxOnRxTimeout
Public Attributes inherited from PacketRadioChip
void(* onRxStarted )(void *, GPIOInterruptInfo_t *)
 수신이 시작될 때 호출될 콜백함수 포인터
void * ctxOnRxStarted
 onRxStarted 가 호출될 때 함께 전달될 context
void(* onRxDone )(void *, GPIOInterruptInfo_t *)
 수신이 완료될 때 호출될 콜백함수 포인터
void * ctxOnRxDone
 onRxDone 이 호출될 때 함께 전달될 context
void(* onTxDone )(void *, bool, GPIOInterruptInfo_t *)
 transmit() 후, 송신이 완료될 때 호출될 콜백함수 포인터
void * ctxOnTxDone
 onTxDone 이 호출될 때 함께 전달될 context
void(* onChannelBusy )(void *, GPIOInterruptInfo_t *)
 cca() 시 채널이 혼잡할 때 호출될 콜백함수 포인터
void * ctxOnChannelBusy
 onChannelBusy 가 호출될 때 함께 전달될 context
int16_t dBccaThreshold = -65
 cca() 시 채널이 혼잡하다고 판단하기 위한 에너지 레벨을 설정합니다. (단위: dB, 기본값: -65)

Detailed Description

저전력 LoRaTM 및 FSK 무선 통신을 지원하는 Semtech의 SX1272/SX1276을 지원합니다.

Supported Boards

SX1272/SX1276을 지원하는 개발보드는 다음과 같습니다.

BoardChipsetTx power (dBm)Frequency range (MHz)Examples
PLNetworks PLM100SX1276-1 ~ 20525 ~ 1020
Arduino-M0SX1276MB1LAS
  • HF: -1 ~ 20
  • LF: -1 ~ 14
  • HF: 525 ~ 1020
  • LF: 137 ~ 525
ST Nucleo L152RESX1276MB1LAS
  • HF: -1 ~ 20
  • LF: -1 ~ 14
  • HF: 525 ~ 1020
  • LF: 137 ~ 525

Member Function Documentation

◆ begin()

virtual error_t SX127xChip::begin ( )
virtual

Implements PacketRadioChip.

Reimplemented in SX1272Chip, and SX1276Chip.

◆ bufferIsEmpty()

bool SX127xChip::bufferIsEmpty ( )
virtual

Implements PacketRadioChip.

◆ cca()

bool SX127xChip::cca ( )
overridevirtual

채널이 혼잡한지 아닌지 검사합니다.

채널이 혼잡하다고 감지되는 순간, onChannelBusy 가 가리키는 콜백함수가 호출됩니다.

Reimplemented from LoRaRadioChip.

◆ ccaTask()

void SX127xChip::ccaTask ( )
overrideprotectedvirtual

Reimplemented from LoRaRadioChip.

◆ doCAD()

void SX127xChip::doCAD ( )
overridevirtual

CAD (Carrier Activity Detection) 검사를 수행합니다. (LoRa 전용).

Implements LoRaRadioChip.

◆ flushBuffer()

void SX127xChip::flushBuffer ( )
virtual

Implements PacketRadioChip.

◆ getChannel()

uint32_t SX127xChip::getChannel ( )
virtual

Gets the channels configuration.

Returns
Channel RF frequency in unit of Hz.

Implements PacketRadioChip.

◆ getStatus()

State_t SX127xChip::getStatus ( )
overridevirtual

Implements LoRaRadioChip.

◆ getTxPower()

int8_t SX127xChip::getTxPower ( )
virtual

현재 설정된 송신 출력을 반환합니다.

Returns
송신 출력 (단위: dBm)

Reimplemented from LoRaRadioChip.

◆ readFrame()

error_t SX127xChip::readFrame ( RadioPacket * frame)
virtual

수신 버퍼에서 프레임을 읽습니다.

Returns
  • ERROR_SUCCESS : 성공
  • ERROR_FAIL : 실패 (수신한 프레임이 없음)
  • ERROR_INVALID_ARGS : frame 이 NULL 이거나, frame 내부 버퍼가 충분히 크지 않아서 실패

Implements PacketRadioChip.

◆ setChannel()

void SX127xChip::setChannel ( uint32_t channel)
overridevirtual

Sets the channels configuration.

Parameters
freqHzChannel RF frequency in unit of Hz

Implements PacketRadioChip.

◆ setIQMode()

void SX127xChip::setIQMode ( bool normal)

LoRa I&Q 신호 모드를 설정합니다.

Parameters
normaltrue는 normal mode, false는 invert mode

◆ setOcp()

void SX127xChip::setOcp ( bool enable,
uint8_t iMax )

Overload Current Protection (OCP) 설정을 합니다.

기본적으로 100mA로 설정되어 있으며, 하드웨어 구성에 따라 설정을 바꿔줘야 합니다.

Parameters
enableOCP의 사용여부
iMaxTrimming of OCP current. 45가 가장 낮은 값입니다. 45보다 작으면 45로 설정됩니다. 240이 가장 높은 값이며, 240 보다 크면 240으로 설정됩니다.

◆ setPublicNetwork()

void SX127xChip::setPublicNetwork ( bool enable)
overridevirtual

Syncword를 설정합니다.

Parameters
valueenable (true: LoRaWAN, false: non-LoRaWAN)

Implements LoRaRadioChip.

◆ setStandby()

void SX127xChip::setStandby ( )
overridevirtual

Implements LoRaRadioChip.

◆ setSyncword()

void SX127xChip::setSyncword ( uint8_t syncword)
inline
165 {
166 if (syncword == 0x12) {
167 setPublicNetwork(false);
168 } else if (syncword == 0x34) {
169 setPublicNetwork(true);
170 }
171 }
void setPublicNetwork(bool) override
Syncword를 설정합니다.

◆ setTxPower()

void SX127xChip::setTxPower ( int8_t dBm)
virtual

송신 출력을 설정합니다.

Parameters
dBm송신 출력 세기 (단위: dBm)

Reimplemented from LoRaRadioChip.

◆ sleep()

virtual void SX127xChip::sleep ( )
virtual

Implements PacketRadioChip.

◆ supportsLoRaSpreadingFactor()

bool SX127xChip::supportsLoRaSpreadingFactor ( Radio::LoRaSF_t sf) const
inlineoverridevirtual

Returns whether this driver supports the given LoRa spreading factor.

Parameters
sfLoRa spreading factor; unknown values must return false.

Implements LoRaRadioChip.

142 {
143 return sf >= Radio::SF7 && sf <= Radio::SF12;
144 }
@ SF12
Definition Radio.hpp:87
@ SF7
Definition Radio.hpp:82

◆ transmit()

error_t SX127xChip::transmit ( RadioPacket * frame)
virtual

Reimplemented from LoRaRadioChip.

◆ transmitCW() [1/2]

void SX127xChip::transmitCW ( )
overridevirtual

Continuous Wave (CW) 신호를 송출합니다. (LoRa 전용).

Implements LoRaRadioChip.

◆ transmitCW() [2/2]

void SX127xChip::transmitCW ( bool enable)
inline
185 {
186 if (enable) {
187 transmitCW();
188 }
189 }
void transmitCW() override
Continuous Wave (CW) 신호를 송출합니다. (LoRa 전용).

◆ wakeup()

virtual void SX127xChip::wakeup ( )
virtual

Implements PacketRadioChip.

Member Data Documentation

◆ [struct]

struct { ... } SX127xChip::fskPacketHandler

Radio FSK packet handler state

◆ [struct]

struct { ... } SX127xChip::loraPacketHandler

Radio LoRa packet handler state


The documentation for this class was generated from the following file: