Loading...
Searching...
No Matches
LoRa radio driver

Driver for the sx1280 LoRa radio device. More...

Detailed Description

Driver for the sx1280 LoRa radio device.

Files

file  sx1280.h
 
file  sx1280_constants.h
 Internal addresses, registers and constants.
 
file  sx1280_netdev.h
 Netdev driver definitions for LoRa SX1280 Driver driver.
 
file  sx1280_params.h
 Default configuration.
 

Data Structures

struct  sx1280_params_t
 Device initialization parameters. More...
 
struct  sx1280
 Device descriptor for the driver. More...
 

Typedefs

typedef struct sx1280 sx1280_t
 

Functions

void sx1280_setup (sx1280_t *dev, const sx1280_params_t *params, uint8_t index)
 Setup the radio device.
 
int sx1280_init (sx1280_t *dev)
 Initialize the given device.
 
uint32_t sx1280_get_channel (const sx1280_t *dev)
 Gets the channel RF frequency.
 
uint32_t sx1280_random (const sx1280_t *dev)
 Gets a random number.
 
void sx1280_set_channel (sx1280_t *dev, uint32_t freq)
 Sets the channel RF frequency.
 
uint32_t sx1280_get_bandwidth (const sx1280_t *dev)
 Gets the LoRa bandwidth.
 
void sx1280_set_bandwidth (sx1280_t *dev, uint16_t bandwidth)
 Sets the LoRa bandwidth.
 
uint8_t sx1280_get_spreading_factor (const sx1280_t *dev)
 Gets the LoRa spreading factor.
 
void sx1280_set_spreading_factor (sx1280_t *dev, uint8_t sf)
 Sets the LoRa spreading factor.
 
uint8_t sx1280_get_coding_rate (const sx1280_t *dev)
 Gets the LoRa coding rate.
 
void sx1280_set_coding_rate (sx1280_t *dev, uint8_t cr)
 Sets the LoRa coding rate.
 
uint8_t sx1280_get_lora_payload_length (const sx1280_t *dev)
 Gets the payload length.
 
void sx1280_set_lora_payload_length (sx1280_t *dev, uint8_t len)
 Sets the payload length.
 
bool sx1280_get_lora_crc (const sx1280_t *dev)
 Checks if CRC verification mode is enabled.
 
void sx1280_set_lora_crc (sx1280_t *dev, bool crc)
 Enable/Disable CRC verification mode.
 
bool sx1280_get_lora_implicit_header (const sx1280_t *dev)
 Gets the LoRa implicit header mode.
 
void sx1280_set_lora_implicit_header (sx1280_t *dev, bool mode)
 Sets LoRa implicit header mode.
 
uint16_t sx1280_get_lora_preamble_length (const sx1280_t *dev)
 Gets the LoRa preamble length.
 
void sx1280_set_lora_preamble_length (sx1280_t *dev, uint16_t preamble)
 Sets the LoRa preamble length.
 
bool sx1280_get_lora_iq_invert (const sx1280_t *dev)
 Checks if the LoRa inverted IQ mode is enabled/disabled.
 
void sx1280_set_lora_iq_invert (sx1280_t *dev, bool iq_invert)
 Enable/disable the LoRa IQ inverted mode.
 

SX1280 device default configuration

#define SX1280_CHANNEL_DEFAULT   (2403000000UL)
 Default channel frequency, 2403MHz.
 
#define SX1280_RADIO_TX_POWER   (SX1280_PWR_MAX)
 Radio power in dBm.
 

Macro Definition Documentation

◆ SX1280_CHANNEL_DEFAULT

#define SX1280_CHANNEL_DEFAULT   (2403000000UL)

Default channel frequency, 2403MHz.

Definition at line 47 of file sx1280.h.

◆ SX1280_RADIO_TX_POWER

#define SX1280_RADIO_TX_POWER   (SX1280_PWR_MAX)

Radio power in dBm.

Definition at line 48 of file sx1280.h.

Typedef Documentation

◆ sx1280_t

typedef struct sx1280 sx1280_t
  • Note
    Forward declaration of the sx1280 device descriptor

Definition at line 54 of file sx1280.h.

Function Documentation

◆ sx1280_get_bandwidth()

uint32_t sx1280_get_bandwidth ( const sx1280_t dev)

Gets the LoRa bandwidth.

Parameters
[in]devDevice descriptor of the driver
Returns
the bandwidth

◆ sx1280_get_channel()

uint32_t sx1280_get_channel ( const sx1280_t dev)

Gets the channel RF frequency.

Parameters
[in]devDevice descriptor of the driver
Returns
The channel frequency

◆ sx1280_get_coding_rate()

uint8_t sx1280_get_coding_rate ( const sx1280_t dev)

Gets the LoRa coding rate.

Parameters
[in]devDevice descriptor of the driver
Returns
the current LoRa coding rate

◆ sx1280_get_lora_crc()

bool sx1280_get_lora_crc ( const sx1280_t dev)

Checks if CRC verification mode is enabled.

Parameters
[in]devDevice descriptor of the driver
Returns
the LoRa single mode

◆ sx1280_get_lora_implicit_header()

bool sx1280_get_lora_implicit_header ( const sx1280_t dev)

Gets the LoRa implicit header mode.

Parameters
[in]devDevice descriptor of the driver
Returns
the LoRa implicit mode

◆ sx1280_get_lora_iq_invert()

bool sx1280_get_lora_iq_invert ( const sx1280_t dev)

Checks if the LoRa inverted IQ mode is enabled/disabled.

Parameters
[in]devDevice descriptor of the driver
Returns
the LoRa IQ inverted mode

◆ sx1280_get_lora_payload_length()

uint8_t sx1280_get_lora_payload_length ( const sx1280_t dev)

Gets the payload length.

Parameters
[in]devDevice descriptor of the driver
Returns
the payload length

◆ sx1280_get_lora_preamble_length()

uint16_t sx1280_get_lora_preamble_length ( const sx1280_t dev)

Gets the LoRa preamble length.

Parameters
[in]devDevice descriptor of the driver
Returns
the preamble length

◆ sx1280_get_spreading_factor()

uint8_t sx1280_get_spreading_factor ( const sx1280_t dev)

Gets the LoRa spreading factor.

Parameters
[in]devDevice descriptor of the driver
Returns
the spreading factor

◆ sx1280_init()

int sx1280_init ( sx1280_t dev)

Initialize the given device.

Parameters
[in,out]devDevice descriptor of the driver
Returns
0 on success

◆ sx1280_random()

uint32_t sx1280_random ( const sx1280_t dev)

Gets a random number.

Parameters
[in]devDevice descriptor of the driver
Returns
a random number

◆ sx1280_set_bandwidth()

void sx1280_set_bandwidth ( sx1280_t dev,
uint16_t  bandwidth 
)

Sets the LoRa bandwidth.

Parameters
[in]devDevice descriptor of the driver
[in]bandwidthThe new bandwidth

◆ sx1280_set_channel()

void sx1280_set_channel ( sx1280_t dev,
uint32_t  freq 
)

Sets the channel RF frequency.

Parameters
[in]devDevice descriptor of the driver
[in]freqChannel RF frequency

◆ sx1280_set_coding_rate()

void sx1280_set_coding_rate ( sx1280_t dev,
uint8_t  cr 
)

Sets the LoRa coding rate.

Parameters
[in]devDevice descriptor of the driver
[in]crThe LoRa coding rate

◆ sx1280_set_lora_crc()

void sx1280_set_lora_crc ( sx1280_t dev,
bool  crc 
)

Enable/Disable CRC verification mode.

Parameters
[in]devDevice descriptor of the driver
[in]crcThe CRC check mode

◆ sx1280_set_lora_implicit_header()

void sx1280_set_lora_implicit_header ( sx1280_t dev,
bool  mode 
)

Sets LoRa implicit header mode.

Parameters
[in]devDevice descriptor of the driver
[in]modeThe header mode

◆ sx1280_set_lora_iq_invert()

void sx1280_set_lora_iq_invert ( sx1280_t dev,
bool  iq_invert 
)

Enable/disable the LoRa IQ inverted mode.

Parameters
[in]devDevice descriptor of the driver
[in]iq_invertThe LoRa IQ inverted mode

◆ sx1280_set_lora_payload_length()

void sx1280_set_lora_payload_length ( sx1280_t dev,
uint8_t  len 
)

Sets the payload length.

Parameters
[in]devDevice descriptor of the driver
[in]lenThe payload len

◆ sx1280_set_lora_preamble_length()

void sx1280_set_lora_preamble_length ( sx1280_t dev,
uint16_t  preamble 
)

Sets the LoRa preamble length.

Parameters
[in]devDevice descriptor of the driver
[in]preambleThe LoRa preamble length

◆ sx1280_set_spreading_factor()

void sx1280_set_spreading_factor ( sx1280_t dev,
uint8_t  sf 
)

Sets the LoRa spreading factor.

Parameters
[in]devDevice descriptor of the driver
[in]sfThe spreading factor

◆ sx1280_setup()

void sx1280_setup ( sx1280_t dev,
const sx1280_params_t params,
uint8_t  index 
)

Setup the radio device.

Parameters
[in]devDevice descriptor
[in]paramsParameters for device initialization
[in]indexIndex of params in a global parameter struct array. If initialized manually, pass a unique identifier instead.