Library SX1276 Pinout for DISCO_B_L072CZ-LRWAN1 Board

Fork of SX1276Lib by Semtech

Embed: (wiki syntax)

« Back to documentation index

Radio Class Reference

Radio Class Reference

#include <radio.h>

Inherited by SX1276.

Public Member Functions

 Radio (RadioEvents_t *events)
 Constructor of the radio object, the parameters are the callback functions described in the header.
virtual void Init (RadioEvents_t *events)=0
 Initializes the radio.
virtual RadioState GetStatus (void)=0
 Return current radio status.
virtual void SetModem (RadioModems_t modem)=0
 Configures the radio with the given modem.
virtual void SetChannel (uint32_t freq)=0
 Sets the channel frequency.
virtual bool IsChannelFree (RadioModems_t modem, uint32_t freq, int16_t rssiThresh)=0
 Sets the channels configuration.
virtual uint32_t Random (void)=0
 Generates a 32 bits random value based on the RSSI readings.
virtual void SetRxConfig (RadioModems_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
 Sets the reception parameters.
virtual void SetTxConfig (RadioModems_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
 Sets the transmission parameters.
virtual bool CheckRfFrequency (uint32_t frequency)=0
 Checks if the given RF frequency is supported by the hardware.
virtual uint32_t TimeOnAir (RadioModems_t modem, uint8_t pktLen)=0
 Computes the packet time on air for the given payload.
virtual void Send (uint8_t *buffer, uint8_t size)=0
 Sends the buffer of size. Prepares the packet to be sent and sets the radio in transmission.
virtual void Sleep (void)=0
 Sets the radio in sleep mode.
virtual void Standby (void)=0
 Sets the radio in standby mode.
virtual void StartCad (void)=0
 Sets the radio in CAD mode.
virtual void Rx (uint32_t timeout)=0
 Sets the radio in reception mode for the given time.
virtual void Tx (uint32_t timeout)=0
 Sets the radio in transmission mode for the given time.
virtual void SetTxContinuousWave (uint32_t freq, int8_t power, uint16_t time)=0
 Sets the radio in continuous wave transmission mode.
virtual int16_t GetRssi (RadioModems_t modem)=0
 Reads the current RSSI value.
virtual void Write (uint8_t addr, uint8_t data)=0
 Writes the radio register at the specified address.
virtual uint8_t Read (uint8_t addr)=0
 Reads the radio register at the specified address.
virtual void Write (uint8_t addr, uint8_t *buffer, uint8_t size)=0
 Writes multiple radio registers starting at address.
virtual void Read (uint8_t addr, uint8_t *buffer, uint8_t size)=0
 Reads multiple radio registers starting at address.
virtual void WriteFifo (uint8_t *buffer, uint8_t size)=0
 Writes the buffer contents to the Radio FIFO.
virtual void ReadFifo (uint8_t *buffer, uint8_t size)=0
 Reads the contents of the Radio FIFO.
virtual void SetMaxPayloadLength (RadioModems_t modem, uint8_t max)=0
 Sets the maximum payload length.
virtual void SetPublicNetwork (bool enable)=0
 Sets the network to public or private. Updates the sync byte.

Detailed Description

Interface for the radios, contains the main functions that a radio needs, and 5 callback functions

Definition at line 71 of file radio.h.


Constructor & Destructor Documentation

Radio ( RadioEvents_t events )

Constructor of the radio object, the parameters are the callback functions described in the header.

Parameters:
[IN]events Structure containing the driver callback functions

Definition at line 17 of file radio.cpp.


Member Function Documentation

virtual bool CheckRfFrequency ( uint32_t  frequency ) [pure virtual]

Checks if the given RF frequency is supported by the hardware.

Parameters:
[IN]frequency RF frequency to be checked
Return values:
isSupported[true: supported, false: unsupported]

Implemented in SX1276MB1xAS, and SX1276.

virtual int16_t GetRssi ( RadioModems_t  modem ) [pure virtual]

Reads the current RSSI value.

Return values:
rssiValueCurrent RSSI value in [dBm]

Implemented in SX1276.

virtual RadioState GetStatus ( void   ) [pure virtual]

Return current radio status.

Parameters:
statusRadio status.[RF_IDLE, RF_RX_RUNNING, RF_TX_RUNNING]

Implemented in SX1276.

virtual void Init ( RadioEvents_t events ) [pure virtual]

Initializes the radio.

Parameters:
[IN]events Structure containing the driver callback functions

Implemented in SX1276.

virtual bool IsChannelFree ( RadioModems_t  modem,
uint32_t  freq,
int16_t  rssiThresh 
) [pure virtual]

Sets the channels configuration.

Parameters:
[IN]modem Radio modem to be used [0: FSK, 1: LoRa]
[IN]freq Channel RF frequency
[IN]rssiThresh RSSI threshold
Return values:
isFree[true: Channel is free, false: Channel is not free]

Implemented in SX1276.

virtual uint32_t Random ( void   ) [pure virtual]

Generates a 32 bits random value based on the RSSI readings.

Remarks:
This function sets the radio in LoRa modem mode and disables all interrupts. After calling this function either Radio.SetRxConfig or Radio.SetTxConfig functions must be called.
Return values:
randomValue32 bits random value

Implemented in SX1276.

virtual uint8_t Read ( uint8_t  addr ) [pure virtual]

Reads the radio register at the specified address.

Parameters:
[IN],:addr Register address
Return values:
dataRegister value

Implemented in SX1276MB1xAS, and SX1276.

virtual void Read ( uint8_t  addr,
uint8_t *  buffer,
uint8_t  size 
) [pure virtual]

Reads multiple radio registers starting at address.

Parameters:
[IN]addr First Radio register address
[OUT]buffer Buffer where to copy the registers data
[IN]size Number of registers to be read

Implemented in SX1276MB1xAS, and SX1276.

virtual void ReadFifo ( uint8_t *  buffer,
uint8_t  size 
) [pure virtual]

Reads the contents of the Radio FIFO.

Parameters:
[OUT]buffer Buffer where to copy the FIFO read data.
[IN]size Number of bytes to be read from the FIFO

Implemented in SX1276MB1xAS, and SX1276.

virtual void Rx ( uint32_t  timeout ) [pure virtual]

Sets the radio in reception mode for the given time.

Parameters:
[IN]timeout Reception timeout [us] [0: continuous, others timeout]

Implemented in SX1276.

virtual void Send ( uint8_t *  buffer,
uint8_t  size 
) [pure virtual]

Sends the buffer of size. Prepares the packet to be sent and sets the radio in transmission.

Parameters:
[IN],:buffer Buffer pointer
[IN],:size Buffer size

Implemented in SX1276.

virtual void SetChannel ( uint32_t  freq ) [pure virtual]

Sets the channel frequency.

Parameters:
[IN]freq Channel RF frequency

Implemented in SX1276.

virtual void SetMaxPayloadLength ( RadioModems_t  modem,
uint8_t  max 
) [pure virtual]

Sets the maximum payload length.

Parameters:
[IN]modem Radio modem to be used [0: FSK, 1: LoRa]
[IN]max Maximum payload length in bytes

Implemented in SX1276.

virtual void SetModem ( RadioModems_t  modem ) [pure virtual]

Configures the radio with the given modem.

Parameters:
[IN]modem Modem to be used [0: FSK, 1: LoRa]

Implemented in SX1276.

virtual void SetPublicNetwork ( bool  enable ) [pure virtual]

Sets the network to public or private. Updates the sync byte.

Remarks:
Applies to LoRa modem only
Parameters:
[IN]enable if true, it enables a public network

Implemented in SX1276.

virtual void SetRxConfig ( RadioModems_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 
) [pure virtual]

Sets the reception parameters.

Parameters:
[IN]modem Radio modem to be used [0: FSK, 1: LoRa]
[IN]bandwidth Sets the bandwidth FSK : >= 2600 and <= 250000 Hz LoRa: [0: 125 kHz, 1: 250 kHz, 2: 500 kHz, 3: Reserved]
[IN]datarate Sets the Datarate FSK : 600..300000 bits/s LoRa: [6: 64, 7: 128, 8: 256, 9: 512, 10: 1024, 11: 2048, 12: 4096 chips]
[IN]coderate Sets the coding rate ( LoRa only ) FSK : N/A ( set to 0 ) LoRa: [1: 4/5, 2: 4/6, 3: 4/7, 4: 4/8]
[IN]bandwidthAfc Sets the AFC Bandwidth ( FSK only ) FSK : >= 2600 and <= 250000 Hz LoRa: N/A ( set to 0 )
[IN]preambleLen Sets the Preamble length ( LoRa only ) FSK : N/A ( set to 0 ) LoRa: Length in symbols ( the hardware adds 4 more symbols )
[IN]symbTimeout Sets the RxSingle timeout value FSK : timeout number of bytes LoRa: timeout in symbols
[IN]fixLen Fixed length packets [0: variable, 1: fixed]
[IN]payloadLen Sets payload length when fixed lenght is used
[IN]crcOn Enables/Disables the CRC [0: OFF, 1: ON]
[IN]freqHopOn Enables disables the intra-packet frequency hopping [0: OFF, 1: ON] (LoRa only)
[IN]hopPeriod Number of symbols bewteen each hop (LoRa only)
[IN]iqInverted Inverts IQ signals ( LoRa only ) FSK : N/A ( set to 0 ) LoRa: [0: not inverted, 1: inverted]
[IN]rxContinuous Sets the reception in continuous mode [false: single mode, true: continuous mode]

Implemented in SX1276.

virtual void SetTxConfig ( RadioModems_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 
) [pure virtual]

Sets the transmission parameters.

Parameters:
[IN]modem Radio modem to be used [0: FSK, 1: LoRa]
[IN]power Sets the output power [dBm]
[IN]fdev Sets the frequency deviation ( FSK only ) FSK : [Hz] LoRa: 0
[IN]bandwidth Sets the bandwidth ( LoRa only ) FSK : 0 LoRa: [0: 125 kHz, 1: 250 kHz, 2: 500 kHz, 3: Reserved]
[IN]datarate Sets the Datarate FSK : 600..300000 bits/s LoRa: [6: 64, 7: 128, 8: 256, 9: 512, 10: 1024, 11: 2048, 12: 4096 chips]
[IN]coderate Sets the coding rate ( LoRa only ) FSK : N/A ( set to 0 ) LoRa: [1: 4/5, 2: 4/6, 3: 4/7, 4: 4/8]
[IN]preambleLen Sets the preamble length
[IN]fixLen Fixed length packets [0: variable, 1: fixed]
[IN]crcOn Enables disables the CRC [0: OFF, 1: ON]
[IN]freqHopOn Enables disables the intra-packet frequency hopping [0: OFF, 1: ON] (LoRa only)
[IN]hopPeriod Number of symbols bewteen each hop (LoRa only)
[IN]iqInverted Inverts IQ signals ( LoRa only ) FSK : N/A ( set to 0 ) LoRa: [0: not inverted, 1: inverted]
[IN]timeout Transmission timeout [us]

Implemented in SX1276.

virtual void SetTxContinuousWave ( uint32_t  freq,
int8_t  power,
uint16_t  time 
) [pure virtual]

Sets the radio in continuous wave transmission mode.

Parameters:
[IN],:freq Channel RF frequency
[IN],:power Sets the output power [dBm]
[IN],:time Transmission mode timeout [s]

Implemented in SX1276.

virtual void Sleep ( void   ) [pure virtual]

Sets the radio in sleep mode.

Implemented in SX1276.

virtual void Standby ( void   ) [pure virtual]

Sets the radio in standby mode.

Implemented in SX1276.

virtual void StartCad ( void   ) [pure virtual]

Sets the radio in CAD mode.

Implemented in SX1276.

virtual uint32_t TimeOnAir ( RadioModems_t  modem,
uint8_t  pktLen 
) [pure virtual]

Computes the packet time on air for the given payload.

Can only be called once SetRxConfig or SetTxConfig have been called

Parameters:
[IN]modem Radio modem to be used [0: FSK, 1: LoRa]
[IN]pktLen Packet payload length
Return values:
airTimeComputed airTime for the given packet payload length

Implemented in SX1276.

virtual void Tx ( uint32_t  timeout ) [pure virtual]

Sets the radio in transmission mode for the given time.

Parameters:
[IN]timeout Transmission timeout [us] [0: continuous, others timeout]

Implemented in SX1276.

virtual void Write ( uint8_t  addr,
uint8_t  data 
) [pure virtual]

Writes the radio register at the specified address.

Parameters:
[IN],:addr Register address
[IN],:data New register value

Implemented in SX1276MB1xAS, and SX1276.

virtual void Write ( uint8_t  addr,
uint8_t *  buffer,
uint8_t  size 
) [pure virtual]

Writes multiple radio registers starting at address.

Parameters:
[IN]addr First Radio register address
[IN]buffer Buffer containing the new register's values
[IN]size Number of registers to be written

Implemented in SX1276MB1xAS, and SX1276.

virtual void WriteFifo ( uint8_t *  buffer,
uint8_t  size 
) [pure virtual]

Writes the buffer contents to the Radio FIFO.

Parameters:
[IN]buffer Buffer containing data to be put on the FIFO.
[IN]size Number of bytes to be written to the FIFO

Implemented in SX1276MB1xAS, and SX1276.