SDK  23.9.2
For IoT System Software Development
Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
SX127xChip Class Referenceabstract

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

#include <SX127xChip.hpp>

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

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)
 수신 버퍼에서 프레임을 읽습니다. More...
 
bool bufferIsEmpty ()
 
void flushBuffer ()
 
virtual void sleep ()
 
virtual void wakeup ()
 
error_t transmit (RadioPacket *frame)
 
bool cca () override
 채널이 혼잡한지 아닌지 검사합니다. More...
 
void setTxPower (int8_t dBm)
 송신 출력을 설정합니다. More...
 
int8_t getTxPower ()
 현재 설정된 송신 출력을 반환합니다. More...
 
void setChannel (uint32_t channel) override
 Sets the channels configuration. More...
 
uint32_t getChannel ()
 Gets the channels configuration. More...
 
void setPublicNetwork (bool) override
 Syncword를 설정합니다. More...
 
void setSyncword (uint8_t syncword)
 
void doCAD (void(*func)(LoRaRadioChip &, bool)) override
 CAD (Carrier Activity Detection) 검사를 수행합니다. (LoRa 전용) More...
 
void setIQMode (bool normal)
 LoRa I&Q 신호 모드를 설정합니다. More...
 
void transmitCW () override
 Continuous Wave (CW) 신호를 송출합니다. (LoRa 전용)
 
void transmitCW (bool enable)
 
void setOcp (bool enable, uint8_t iMax)
 Overload Current Protection (OCP) 설정을 합니다. More...
 
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 단위로 읽습니다.
 
void setFreqOffset (int32_t offsetHz)
 중심 주파수 오차를 제거하기 위한 offset을 설정합니다. More...
 
int32_t getFreqOffset ()
 중심 주파수 오차를 제거하기 위한 offset을 가져옵니다.
 
- Public Member Functions inherited from PacketRadioChip
void setCcaThreshold (int16_t dBthreshold)
 

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

SPIspi
 
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
 
void(* cadCompletedHandler )(LoRaRadioChip &, bool) = nullptr
 
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
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 *)
 수신이 시작될 때 호출될 콜백함수 포인터 More...
 
void * ctxOnRxStarted
 onRxStarted 가 호출될 때 함께 전달될 context
 
void(* onRxDone )(void *, GPIOInterruptInfo_t *)
 수신이 완료될 때 호출될 콜백함수 포인터 More...
 
void * ctxOnRxDone
 onRxDone 이 호출될 때 함께 전달될 context
 
void(* onTxDone )(void *, bool, GPIOInterruptInfo_t *)
 transmit() 후, 송신이 완료될 때 호출될 콜백함수 포인터 More...
 
void * ctxOnTxDone
 onTxDone 이 호출될 때 함께 전달될 context
 
void(* onChannelBusy )(void *, GPIOInterruptInfo_t *)
 cca() 시 채널이 혼잡할 때 호출될 콜백함수 포인터 More...
 
void * ctxOnChannelBusy
 onChannelBusy 가 호출될 때 함께 전달될 context
 
int16_t dBccaThreshold = -65
 cca() 시 채널이 혼잡하다고 판단하기 위한 에너지 레벨을 설정합니다. (단위: dB, 기본값: -65)
 

Detailed Description

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

Supported Boards

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

Board Chipset Tx power (dBm) Frequency range (MHz) Examples
PLNetworks PLM100 SX1276 -1 ~ 20 525 ~ 1020
Arduino-M0 SX1276MB1LAS
  • HF: -1 ~ 20
  • LF: -1 ~ 14
  • HF: 525 ~ 1020
  • LF: 137 ~ 525
ST Nucleo L152RE SX1276MB1LAS
  • HF: -1 ~ 20
  • LF: -1 ~ 14
  • HF: 525 ~ 1020
  • LF: 137 ~ 525

Member Function Documentation

◆ cca()

bool SX127xChip::cca ( )
overridevirtual

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

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

Reimplemented from LoRaRadioChip.

◆ doCAD()

void SX127xChip::doCAD ( void(*)(LoRaRadioChip &, bool)  func)
overridevirtual

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

Parameters
funcCAD 검사가 완료될 때 호출될 콜백함수 포인터

Implements LoRaRadioChip.

◆ getChannel()

uint32_t SX127xChip::getChannel ( )
virtual

Gets the channels configuration.

Returns
Channel RF frequency in unit of Hz.

Implements PacketRadioChip.

◆ 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.

◆ setTxPower()

void SX127xChip::setTxPower ( int8_t  dBm)
virtual

송신 출력을 설정합니다.

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

Reimplemented from LoRaRadioChip.

Member Data Documentation

◆ fskPacketHandler

struct { ... } SX127xChip::fskPacketHandler

Radio FSK packet handler state

◆ loraPacketHandler

struct { ... } SX127xChip::loraPacketHandler

Radio LoRa packet handler state


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