Ares LoRa Firmware
Loading...
Searching...
No Matches
lora.h File Reference

LoRa API. More...

#include <lora/packet.h>
#include <zephyr/drivers/lora.h>
#include <zephyr/kernel.h>
#include <lora/lora_backend.h>
Include dependency graph for lora.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ares_lora_transport_api
 Unified LoRa transport interface. More...
struct  ares_lora_transport
 Transfer interface. More...
struct  ares_lora_buf
 Unified buffer structure for LoRa. More...
struct  ares_lora_command
 LoRa packet payload handler descriptor. More...
struct  ares_lora_ctx
 Ares LoRa instance context. More...
struct  ares_lora
 Ares LoRa internals. More...

Macros

#define ARES_LORA_TRX_BUF_SIZE   512
#define ARES_LORA_DEFINE(_name, _transport)
 Macro for defining an ares_lora instance.

Typedefs

typedef void(* lora_transport_handler_t) (enum lora_transport_evt evt, void *ctx)
 LoRa transport event handler prototype.

Enumerations

enum  lora_transport_evt { LORA_TRANSPORT_EVT_RX_RDY , LORA_TRANSPORT_EVT_TX_RDY }
enum  ares_lora_signal { ARES_LORA_SIGNAL_RXRDY , ARES_LORA_SIGNAL_TXDONE , ARES_LORA_SIGNALS }
 Signals for the LoRa interface. More...

Functions

int ares_lora_init (const struct ares_lora *lora, const void *transport_config)
 Function for initializing a transport layer and internal lora state.
int ares_lora_register_command_callbacks (const struct ares_lora *lora, const struct ares_lora_command *commands, size_t num_commands)
 Function for registering the lora packet handlers.
int ares_lora_write_packet (const struct ares_lora *lora, const struct ares_packet *packet)
 Function to write a packet to the LoRa transfer layer.
int ares_lora_configure_lora (const struct ares_lora *lora, const struct lora_modem_config *config)
 Function to send new configurations to the LoRa transfer layer.
int ares_lora_set_packet_id (const struct ares_lora *lora, struct ares_packet *packet)
 Function to update the packet ID of the given packet from the lora instance.

Detailed Description

LoRa API.

Date
3/24/26
Author
Tom Schmitz <tschm.nosp@m.itz@.nosp@m.andre.nosp@m.w.cm.nosp@m.u.edu>

Macro Definition Documentation

◆ ARES_LORA_DEFINE

#define ARES_LORA_DEFINE ( _name,
_transport )
Value:
static struct ares_lora_ctx UTIL_CAT(_name, _ctx); \
static K_KERNEL_STACK_DEFINE(UTIL_CAT(_name, _stack), \
CONFIG_ARES_LORA_STACK_SIZE); \
static struct k_thread UTIL_CAT(_name, _thread); \
static const struct ares_lora _name = {.iface = (_transport), \
.ctx = &UTIL_CAT(_name, _ctx), \
.name = STRINGIFY(_name), \
.thread = \
&UTIL_CAT(_name, _thread), \
.stack = UTIL_CAT(_name, _stack)}
Ares LoRa instance context.
Definition lora.h:206
Ares LoRa internals.
Definition lora.h:262

Macro for defining an ares_lora instance.

Parameters
[in]_nameInstance name.
[in]_transportPointer to the transport interface.

◆ ARES_LORA_TRX_BUF_SIZE

#define ARES_LORA_TRX_BUF_SIZE   512

Unified LoRa buffer size for transmitting and receiving.

Typedef Documentation

◆ lora_transport_handler_t

typedef void(* lora_transport_handler_t) (enum lora_transport_evt evt, void *ctx)

LoRa transport event handler prototype.

Parameters
[in]evtThe event that occurred.
[in]ctxPointer to the event context.

Enumeration Type Documentation

◆ ares_lora_signal

Signals for the LoRa interface.

Enumerator
ARES_LORA_SIGNAL_RXRDY 

Rx data ready.

ARES_LORA_SIGNAL_TXDONE 

Done transmitting. Must be last one before ARES_LORA_SIGNALS

ARES_LORA_SIGNALS 

Last enumerator.

◆ lora_transport_evt

LoRa transport events.

Enumerator
LORA_TRANSPORT_EVT_RX_RDY 

LoRa Rx data ready.

LORA_TRANSPORT_EVT_TX_RDY 

LoRa Tx ready.

Function Documentation

◆ ares_lora_configure_lora()

int ares_lora_configure_lora ( const struct ares_lora * lora,
const struct lora_modem_config * config )

Function to send new configurations to the LoRa transfer layer.

Parameters
[in]loraPointer to lora instance.
[in]configPointer to new LoRa modem configurations.
Returns
0 on success.
-EINVAL if parameters are invalid.
negative error code otherwise.

◆ ares_lora_init()

int ares_lora_init ( const struct ares_lora * lora,
const void * transport_config )

Function for initializing a transport layer and internal lora state.

Parameters
[in]loraPointer to lora instance.
[in]transport_configTransport configuration during initialization.
Returns
0 on success.
negative error code otherwise.

◆ ares_lora_register_command_callbacks()

int ares_lora_register_command_callbacks ( const struct ares_lora * lora,
const struct ares_lora_command * commands,
size_t num_commands )

Function for registering the lora packet handlers.

Parameters
[in]loraPointer to lora instance.
[in]commandsThe array of lora packet handlers.
[in]num_commandsThe number of entries in the array.
Returns
0 on success.
-EINVAL if parameters are invalid.

◆ ares_lora_set_packet_id()

int ares_lora_set_packet_id ( const struct ares_lora * lora,
struct ares_packet * packet )

Function to update the packet ID of the given packet from the lora instance.

Parameters
[in]loraPointer to lora instance.
[in,out]packetPointer to packet to update the packet ID for.
Returns
0 on success.
-EINVAL if parameters are invalid.

◆ ares_lora_write_packet()

int ares_lora_write_packet ( const struct ares_lora * lora,
const struct ares_packet * packet )

Function to write a packet to the LoRa transfer layer.

Parameters
[in]loraPointer to lora instance.
[in]packetPointer to packet to send over LoRa.
Returns
0 on success.
-EINVAL if parameters are invalid.
negative error code otherwise.
Note
This automatically manages the sequence number of the packet.