Loading...
Searching...
No Matches

SX1272 LoRa device driver. More...

Data Structures

struct  SX1272_Config
 SX1272 LoRa configuration struct. More...
 
struct  SX1272_t
 Struct definition for SX1272. Provides the interface for API consumers to interact with the SX1272 LoRa transceiver. More...
 

Enumerations

enum  SX1272_Bandwidth
 SX1272 bandwidth enum. More...
 
enum  SX1272_CodingRate
 SX1272 coding rate enum. More...
 
enum  SX1272_SpreadingFactor
 SX1272 spreading factor enum. More...
 
enum  SX1272_Mode
 SX1272 operating mode enum. More...
 

Functions

bool SX1272_init (SX1272_t *lora, SPI_t *spi, GPIOpin_t cs, SX1272_Config *config)
 Initializes the LoRa module with specified configuration parameters.
 
bool SX1272_updateConfig (SX1272_t *lora, SX1272_Config *config)
 Update SX1272 configuration.
 
void SX1272_transmit (LoRa_t *lora, uint8_t *data, uint8_t length)
 Transmits data using the SX1272.
 
void SX1272_startReceive (LoRa_t *lora)
 Begins continuous receive on the SX1272.
 
uint8_t SX1272_readReceive (LoRa_t *lora, uint8_t *data, uint8_t byffSize)
 Reads contents of received packet to local buffer from the SX1272.
 
void SX1272_standby (SX1272_t *)
 Sets the operational mode of the LoRa module to standby.
 
void SX1272_clearIRQ (LoRa_t *, uint8_t)
 Sets the value of RegIrqFlags in the SX1272 to the provided argument value. Writing a 1 to a bit in the register will clear the associated flag.
 

Detailed Description

SX1272 LoRa device driver.


Data Structure Documentation

◆ SX1272_Config

struct SX1272_Config

SX1272 LoRa configuration struct.

Describes the configuration of SX1272 LoRa parameters.

Definition at line 159 of file sx1272.h.

Data Fields
float freq SX1272 LoRa carrier frequency.
SX1272_SpreadingFactor sf SX1272 LoRa modem spreading factor.
SX1272_Bandwidth bw SX1272 LoRa modem bandwidth.
SX1272_CodingRate cr SX1272 LoRa modem coding rate.
bool implicitHeader SX1272 LoRa modem implicit header enable.
bool crc SX1272 LoRa modem CRC enable.
bool paSelect SX1272 LoRa modem power amp output select.
uint8_t outputPower SX1272 LoRa modem power amp output power.
bool ocp SX1272 LoRa modem overcurrent protection enable.
uint8_t ocpTrim SX1272 LoRa modem overcurrent protection trim.
uint8_t rxFifoBaseAddr Base address for RX fifo.
uint8_t txFifoBaseAddr Base address for TX fifo.
uint8_t maxPayloadLength Maximum allowed length of payload.

◆ SX1272_t

struct SX1272_t

Struct definition for SX1272. Provides the interface for API consumers to interact with the SX1272 LoRa transceiver.

Definition at line 189 of file sx1272.h.

Data Fields
LoRa_t base Base LoRa API.
SX1272_Config config Configuration parameters for the SX1272 driver.
SPI_t * spi Parent SPI interface.
GPIOpin_t cs Chip select GPIO.
SX1272_Mode currentMode Current operating mode.
void(*)(struct SX1272 *) standby SX1272 standby method.
See also
SX1272_standby
bool(*)(struct SX1272 *, SX1272_Config *) updateConfig SX1272 configuration update method.
See also
SX1272_updateConfig

Enumeration Type Documentation

◆ SX1272_Bandwidth

SX1272 bandwidth enum.

Describes the occupied signal bandwidth

Definition at line 107 of file sx1272.h.

◆ SX1272_CodingRate

SX1272 coding rate enum.

Describes the LoRa coding rate TODO: describe what coding rate actually does

Definition at line 118 of file sx1272.h.

◆ SX1272_SpreadingFactor

SX1272 spreading factor enum.

Describes the LoRa spreading factor TODO: describe what spreading factor actually does

Definition at line 130 of file sx1272.h.

◆ SX1272_Mode

SX1272 operating mode enum.

Describes the available operating modes on the transceiver

Definition at line 144 of file sx1272.h.

Function Documentation

◆ SX1272_init()

bool SX1272_init ( SX1272_t * lora,
SPI_t * spi,
GPIOpin_t cs,
SX1272_Config * config )

Initializes the LoRa module with specified configuration parameters.

Parameters
*loraPointer to LoRa struct to be initialised.
*spiPointer to SPI peripheral struct.
*config
Returns
Ininitialised SX1272 device struct.

Definition at line 30 of file sx1272.c.

◆ SX1272_updateConfig()

bool SX1272_updateConfig ( SX1272_t * lora,
SX1272_Config * config )

Update SX1272 configuration.

Parameters
spiPointer to SPI_t struct.
Returns
NULL.

Definition at line 319 of file sx1272.c.

◆ SX1272_transmit()

void SX1272_transmit ( LoRa_t * lora,
uint8_t * pointerdata,
uint8_t length )

Transmits data using the SX1272.

Parameters
loraPointer to SX1272 struct.
pointerdataPointer to the data to be transmitted.

Definition at line 179 of file sx1272.c.

◆ SX1272_startReceive()

void SX1272_startReceive ( LoRa_t * lora)

Begins continuous receive on the SX1272.

Parameters
loraPointer to SX1272 struct.

Definition at line 223 of file sx1272.c.

◆ SX1272_readReceive()

uint8_t SX1272_readReceive ( LoRa_t * lora,
uint8_t * buffer,
uint8_t buffSize )

Reads contents of received packet to local buffer from the SX1272.

Parameters
loraPointer to SX1272 struct.
bufferPointer to the buffer to store received data.
buffSizeInteger representing the size of the buffer to to fill.
Returns
Boolean value indicating if a packet was successfully received and returned in buffer.

Definition at line 264 of file sx1272.c.

◆ SX1272_standby()

void SX1272_standby ( SX1272_t * lora)

Sets the operational mode of the LoRa module to standby.

Parameters
*loraPointer to LoRa struct.
Returns
NULL.

Definition at line 167 of file sx1272.c.

◆ SX1272_clearIRQ()

void SX1272_clearIRQ ( LoRa_t * lora,
uint8_t flags )

Sets the value of RegIrqFlags in the SX1272 to the provided argument value. Writing a 1 to a bit in the register will clear the associated flag.

Parameters
loraPointer to SX1272 struct.
flags8-bit value representing flag bits to be set.
Returns
NULL

Definition at line 305 of file sx1272.c.