|
Zephyr API Documentation 4.3.0-rc1
A Scalable Open Source RTOS
|
Interfaces for LoRa transceivers. More...
Files | |
| file | lora.h |
| Main header file for LoRa driver API. | |
Data Structures | |
| struct | lora_modem_config |
| Structure containing the configuration of a LoRa modem. More... | |
Enumerations | |
| enum | lora_signal_bandwidth { BW_125_KHZ = 0 , BW_250_KHZ , BW_500_KHZ } |
| LoRa signal bandwidth. More... | |
| enum | lora_datarate { SF_6 = 6 , SF_7 , SF_8 , SF_9 , SF_10 , SF_11 , SF_12 } |
| LoRa data-rate. More... | |
| enum | lora_coding_rate { CR_4_5 = 1 , CR_4_6 = 2 , CR_4_7 = 3 , CR_4_8 = 4 } |
| LoRa coding rate. More... | |
Functions | |
| static int | lora_config (const struct device *dev, struct lora_modem_config *config) |
| Configure the LoRa modem. | |
| static int | lora_send (const struct device *dev, uint8_t *data, uint32_t data_len) |
| Send data over LoRa. | |
| static int | lora_send_async (const struct device *dev, uint8_t *data, uint32_t data_len, struct k_poll_signal *async) |
| Asynchronously send data over LoRa. | |
| static int | lora_recv (const struct device *dev, uint8_t *data, uint8_t size, k_timeout_t timeout, int16_t *rssi, int8_t *snr) |
| Receive data over LoRa. | |
| static int | lora_recv_async (const struct device *dev, lora_recv_cb cb, void *user_data) |
| Receive data asynchronously over LoRa. | |
| static int | lora_test_cw (const struct device *dev, uint32_t frequency, int8_t tx_power, uint16_t duration) |
| Transmit an unmodulated continuous wave at a given frequency. | |
Interfaces for LoRa transceivers.
| enum lora_coding_rate |
#include <zephyr/drivers/lora.h>
LoRa coding rate.
This enumeration defines the LoRa coding rate, used for forward error correction (FEC).
The coding rate is expressed as 4/x, where a lower denominator (e.g., 4/5) means less redundancy, resulting in a higher data rate but reduced robustness. Higher redundancy (e.g., 4/8) improves error tolerance at the cost of data rate.
| enum lora_datarate |
#include <zephyr/drivers/lora.h>
LoRa data-rate.
This enumeration represents the data rate of a LoRa signal, expressed as a Spreading Factor (SF).
The Spreading Factor determines how many chirps are used to encode each symbol (2^SF chips per symbol). Higher values result in lower data rates but increased range and robustness.
#include <zephyr/drivers/lora.h>
LoRa signal bandwidth.
This enumeration defines the bandwidth of a LoRa signal.
The bandwidth determines how much spectrum is used to transmit data. Wider bandwidths enable higher data rates but typically reduce sensitivity and range.
| Enumerator | |
|---|---|
| BW_125_KHZ | 125 kHz |
| BW_250_KHZ | 250 kHz |
| BW_500_KHZ | 500 kHz |
|
inlinestatic |
#include <zephyr/drivers/lora.h>
Configure the LoRa modem.
| dev | LoRa device |
| config | Data structure containing the intended configuration for the modem |
|
inlinestatic |
#include <zephyr/drivers/lora.h>
Receive data over LoRa.
| dev | LoRa device |
| data | Buffer to hold received data |
| size | Size of the buffer to hold the received data. Max size allowed is 255. |
| timeout | Duration to wait for a packet. |
| rssi | RSSI of received data |
| snr | SNR of received data |
|
inlinestatic |
#include <zephyr/drivers/lora.h>
Receive data asynchronously over LoRa.
Receive packets continuously under the configuration previously setup by lora_config.
Reception is cancelled by calling this function again with cb = NULL. This can be done within the callback handler.
| dev | Modem to receive data on. |
| cb | Callback to run on receiving data. If NULL, any pending asynchronous receptions will be cancelled. |
| user_data | User data passed to callback |
#include <zephyr/drivers/lora.h>
Send data over LoRa.
| dev | LoRa device |
| data | Data to be sent |
| data_len | Length of the data to be sent |
|
inlinestatic |
#include <zephyr/drivers/lora.h>
Asynchronously send data over LoRa.
| dev | LoRa device |
| data | Data to be sent |
| data_len | Length of the data to be sent |
| async | A pointer to a valid and ready to be signaled struct k_poll_signal. (Note: if NULL this function will not notify the end of the transmission). |
|
inlinestatic |
#include <zephyr/drivers/lora.h>
Transmit an unmodulated continuous wave at a given frequency.
| dev | LoRa device |
| frequency | Output frequency (Hertz) |
| tx_power | TX power (dBm) |
| duration | Transmission duration in seconds. |