#include "esp_err.h"
#include <stdbool.h>
#include <stdint.h>
#include "master/ttn_credentials.h"
Go to the source code of this file.
◆ LORA_BANDWIDTH
◆ LORA_CODING_RATE
| #define LORA_CODING_RATE 1 |
◆ LORA_FREQUENCY
| #define LORA_FREQUENCY 868100000 |
◆ LORA_PIN_CS
◆ LORA_PIN_DIO0
◆ LORA_PIN_DIO1
◆ LORA_PIN_DIO2
◆ LORA_PIN_MISO
◆ LORA_PIN_MOSI
◆ LORA_PIN_RST
◆ LORA_PIN_SCK
◆ LORA_SPI_HOST
| #define LORA_SPI_HOST SPI2_HOST |
◆ LORA_SPREADING_FACTOR
| #define LORA_SPREADING_FACTOR 7 |
◆ LORA_TX_POWER
◆ lorawan_tx_done_cb_t
| typedef void(* lorawan_tx_done_cb_t) (bool success) |
◆ lorawan_status_t
| Enumerator |
|---|
| LORAWAN_STATUS_IDLE | |
| LORAWAN_STATUS_JOINING | |
| LORAWAN_STATUS_JOINED | |
| LORAWAN_STATUS_SENDING | |
| LORAWAN_STATUS_TX_COMPLETE | |
| LORAWAN_STATUS_ERROR | |
◆ lorawan_deinit()
| void lorawan_deinit |
( |
void |
| ) |
|
Deinitialize LoRaWAN handler.
◆ lorawan_get_status()
Get current LoRaWAN status.
- Returns
- Current status
◆ lorawan_init()
| int lorawan_init |
( |
void |
| ) |
|
Initialize the LoRaWAN handler.
Initializes SPI, configures the SX1276, and prepares for OTAA join.
- Returns
- ESP_OK on success, error code otherwise
◆ lorawan_is_joined()
| bool lorawan_is_joined |
( |
void |
| ) |
|
Check if device has joined the network.
- Returns
- true if joined, false otherwise
◆ lorawan_join()
| int lorawan_join |
( |
void |
| ) |
|
Start OTAA join procedure.
Attempts to join The Things Network using OTAA. This is a non-blocking call - use lorawan_get_status() to check progress.
- Returns
- ESP_OK if join request sent, error code otherwise
◆ lorawan_process()
| void lorawan_process |
( |
void |
| ) |
|
Process LoRaWAN events (call periodically from main loop)
This should be called regularly to process radio events.
◆ lorawan_send()
| int lorawan_send |
( |
uint8_t |
port, |
|
|
const uint8_t * |
data, |
|
|
uint8_t |
len, |
|
|
bool |
confirmed |
|
) |
| |
Send data uplink to TTN.
- Parameters
-
| port | LoRaWAN port (1-223) |
| data | Pointer to data buffer |
| len | Length of data (max 51 bytes for SF7-SF12) |
| confirmed | Whether to request confirmation (ACK) |
- Returns
- ESP_OK if data queued for sending, error code otherwise
◆ lorawan_set_tx_done_callback()
Set callback for TX complete event.
- Parameters
-
| callback | Function to call when TX is complete |