F439_CPP_TX-RX_LoRa_Project
Loading...
Searching...
No Matches
sx1262.h File Reference

SX1262 LoRa radio driver public interface. More...

#include "main.h"
#include "stm32f4xx_hal.h"
#include <stdint.h>
#include <stdbool.h>
Include dependency graph for sx1262.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  SX1262_Handle
 Hardware binding for a single SX1262 instance. More...
 
struct  SX1262_LoRaConfig
 LoRa modem configuration parameters. More...
 
struct  SX1262_IrqResult
 IRQ processing result and optional received payload data. More...
 

Enumerations

enum  SX1262_TxPollResult { SX1262_TXPOLL_NONE = 0 , SX1262_TXPOLL_DONE , SX1262_TXPOLL_TIMEOUT }
 Polling result for TX completion helper logic. More...
 

Functions

void SX1262_Init (SX1262_Handle *sx)
 Initialize the SX1262 hardware interface.
 
bool SX1262_ConfigureLoRa (SX1262_Handle *sx, const SX1262_LoRaConfig *cfg)
 Configure the SX1262 for LoRa operation.
 
bool SX1262_StartRxContinuous (SX1262_Handle *sx)
 Enter continuous receive mode.
 
bool SX1262_SendString (SX1262_Handle *sx, const char *s)
 Send a NUL-terminated string through the radio.
 
uint8_t SX1262_GetStatusRaw (SX1262_Handle *sx)
 Read the raw radio status byte.
 
uint16_t SX1262_GetIrqStatusRaw (SX1262_Handle *sx)
 Read the raw IRQ status bits.
 
uint16_t SX1262_ClearAndReadIrq (SX1262_Handle *sx)
 Read and clear IRQ status bits.
 
bool SX1262_TxDonePoll (SX1262_Handle *sx)
 Poll for TX completion.
 
void SX1262_ClearIrq (SX1262_Handle *sx, uint16_t mask)
 Clear selected IRQ bits.
 
bool SX1262_SetStandbyRc (SX1262_Handle *sx)
 Put the radio into RC standby mode.
 
bool SX1262_SendBuffer (SX1262_Handle *sx, const char *buf)
 Send a character buffer through the radio.
 
bool SX1262_SendStringPlainText (SX1262_Handle *sx, const char *s)
 Send a plaintext string without RadioLink framing.
 
bool SX1262_SendBytes (SX1262_Handle *sx, const uint8_t *buf, uint8_t len)
 Send a raw byte buffer through the radio.
 
bool SX1262_ProcessIrq (SX1262_Handle *sx, SX1262_IrqResult *out)
 Process a DIO1-driven IRQ event.
 

Detailed Description

SX1262 LoRa radio driver public interface.

Enumeration Type Documentation

◆ SX1262_TxPollResult

Polling result for TX completion helper logic.

Enumerator
SX1262_TXPOLL_NONE 
SX1262_TXPOLL_DONE 
SX1262_TXPOLL_TIMEOUT 

Function Documentation

◆ SX1262_ClearAndReadIrq()

uint16_t SX1262_ClearAndReadIrq ( SX1262_Handle * sx)

Read and clear IRQ status bits.

Parameters
sxDriver handle describing the SPI and GPIO bindings.
Returns
IRQ status mask captured before clearing.

◆ SX1262_ClearIrq()

void SX1262_ClearIrq ( SX1262_Handle * sx,
uint16_t mask )

Clear selected IRQ bits.

Parameters
sxDriver handle describing the SPI and GPIO bindings.
maskIRQ mask bits to clear.

◆ SX1262_ConfigureLoRa()

bool SX1262_ConfigureLoRa ( SX1262_Handle * sx,
const SX1262_LoRaConfig * cfg )

Configure the SX1262 for LoRa operation.

Parameters
sxDriver handle describing the SPI and GPIO bindings.
cfgRequested LoRa modem configuration.
Returns
true if configuration succeeded, otherwise false.

◆ SX1262_GetIrqStatusRaw()

uint16_t SX1262_GetIrqStatusRaw ( SX1262_Handle * sx)

Read the raw IRQ status bits.

Parameters
sxDriver handle describing the SPI and GPIO bindings.
Returns
Raw IRQ status mask.

◆ SX1262_GetStatusRaw()

uint8_t SX1262_GetStatusRaw ( SX1262_Handle * sx)

Read the raw radio status byte.

Parameters
sxDriver handle describing the SPI and GPIO bindings.
Returns
Raw SX1262 status byte.

◆ SX1262_Init()

void SX1262_Init ( SX1262_Handle * sx)

Initialize the SX1262 hardware interface.

Parameters
sxDriver handle describing the SPI and GPIO bindings.

◆ SX1262_ProcessIrq()

bool SX1262_ProcessIrq ( SX1262_Handle * sx,
SX1262_IrqResult * out )

Process a DIO1-driven IRQ event.

Parameters
sxDriver handle describing the SPI and GPIO bindings.
outOutput structure populated with decoded IRQ results.
Returns
true if IRQ handling succeeded, otherwise false.

◆ SX1262_SendBuffer()

bool SX1262_SendBuffer ( SX1262_Handle * sx,
const char * buf )

Send a character buffer through the radio.

Parameters
sxDriver handle describing the SPI and GPIO bindings.
bufBuffer to transmit.
Returns
true if the send request succeeded, otherwise false.

◆ SX1262_SendBytes()

bool SX1262_SendBytes ( SX1262_Handle * sx,
const uint8_t * buf,
uint8_t len )

Send a raw byte buffer through the radio.

Parameters
sxDriver handle describing the SPI and GPIO bindings.
bufBuffer to transmit.
lenNumber of bytes to transmit.
Returns
true if the send request succeeded, otherwise false.

◆ SX1262_SendString()

bool SX1262_SendString ( SX1262_Handle * sx,
const char * s )

Send a NUL-terminated string through the radio.

Parameters
sxDriver handle describing the SPI and GPIO bindings.
sNUL-terminated string to transmit.
Returns
true if the send request succeeded, otherwise false.

◆ SX1262_SendStringPlainText()

bool SX1262_SendStringPlainText ( SX1262_Handle * sx,
const char * s )

Send a plaintext string without RadioLink framing.

Parameters
sxDriver handle describing the SPI and GPIO bindings.
sNUL-terminated string to transmit.
Returns
true if the send request succeeded, otherwise false.

◆ SX1262_SetStandbyRc()

bool SX1262_SetStandbyRc ( SX1262_Handle * sx)

Put the radio into RC standby mode.

Parameters
sxDriver handle describing the SPI and GPIO bindings.
Returns
true if the command succeeded, otherwise false.

◆ SX1262_StartRxContinuous()

bool SX1262_StartRxContinuous ( SX1262_Handle * sx)

Enter continuous receive mode.

Parameters
sxDriver handle describing the SPI and GPIO bindings.
Returns
true if the command succeeded, otherwise false.

◆ SX1262_TxDonePoll()

bool SX1262_TxDonePoll ( SX1262_Handle * sx)

Poll for TX completion.

Parameters
sxDriver handle describing the SPI and GPIO bindings.
Returns
true when TX completed successfully, otherwise false.