ESP32-PaxCounter/include/lorawan.h

56 lines
1.5 KiB
C
Raw Permalink Normal View History

2022-02-21 10:44:13 +01:00
#if (HAS_LORA)
2018-07-17 15:15:58 +02:00
#ifndef _LORAWAN_H
#define _LORAWAN_H
#include "globals.h"
#include "rcommand.h"
2019-02-24 01:44:55 +01:00
#include "timekeeper.h"
#include <driver/rtc_io.h>
2018-07-15 14:28:05 +02:00
// LMIC-Arduino LoRaWAN Stack
#include <lmic.h>
#include <hal/hal.h>
#include <SPI.h>
#include <arduino_lmic_hal_boards.h>
2018-07-15 14:28:05 +02:00
#include "loraconf.h"
// Needed for 24AA02E64, does not hurt anything if included and not used
#ifdef MCP_24AA02E64_I2C_ADDRESS
#include <Wire.h>
#endif
2019-08-30 18:54:53 +02:00
extern TaskHandle_t lmicTask, lorasendTask;
extern char lmic_event_msg[LMIC_EVENTMSG_LEN]; // display buffer
2020-12-09 10:15:12 +01:00
esp_err_t lmic_init(void);
void lora_setupForNetwork(bool preJoin);
2022-11-13 22:27:06 +01:00
void SaveLMICToRTC(uint32_t deepsleep_sec);
2020-12-09 10:15:12 +01:00
void LoadLMICFromRTC();
void lmictask(void *pvParameters);
void gen_lora_deveui(uint8_t *pdeveui);
void RevBytes(unsigned char *b, size_t c);
void get_hard_deveui(uint8_t *pdeveui);
2018-07-15 14:28:05 +02:00
void os_getDevKey(u1_t *buf);
void os_getArtEui(u1_t *buf);
void os_getDevEui(u1_t *buf);
void lora_send(void *pvParameters);
void lora_enqueuedata(MessageBuffer_t *message);
2018-11-03 20:29:02 +01:00
void lora_queuereset(void);
2022-11-20 17:17:07 +01:00
void lora_waitforidle(uint16_t timeout_sec);
2020-12-09 10:15:12 +01:00
uint32_t lora_queuewaiting(void);
2022-02-26 17:26:14 +01:00
void myEventCallback(void *pUserData, ev_t ev);
void myRxCallback(void *pUserData, uint8_t port, const uint8_t *pMsg,
2020-03-06 19:24:58 +01:00
size_t nMsg);
2022-02-26 17:26:14 +01:00
void myTxCallback(void *pUserData, int fSuccess);
2019-09-20 09:51:33 +02:00
const char *getSfName(rps_t rps);
2019-09-20 13:22:45 +02:00
const char *getBwName(rps_t rps);
const char *getCrName(rps_t rps);
2020-03-06 19:24:58 +01:00
2020-03-07 00:03:05 +01:00
#if (VERBOSE)
2020-03-06 19:24:58 +01:00
void showLoraKeys(void);
2020-03-07 00:03:05 +01:00
#endif // VERBOSE
2019-08-31 18:36:49 +02:00
2022-02-21 10:44:13 +01:00
#endif
#endif // HAS_LORA