mirror of
https://github.com/manuelbl/ttn-esp32.git
synced 2025-07-17 16:12:52 +02:00
Upgrade to version 2.3.2 of mcci-catena/arduino-lmic
This commit is contained in:
49
src/lmic/lmic.h
Normal file → Executable file
49
src/lmic/lmic.h
Normal file → Executable file
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright (c) 2014-2016 IBM Corporation.
|
||||
* Copyright (c) 2016 Matthijs Kooijman.
|
||||
* Copyright (c) 2016-2018 MCCI Corporation.
|
||||
* Copyright (c) 2016-2019 MCCI Corporation.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -105,7 +105,7 @@ extern "C"{
|
||||
#define ARDUINO_LMIC_VERSION_CALC(major, minor, patch, local) \
|
||||
(((major) << 24u) | ((minor) << 16u) | ((patch) << 8u) | (local))
|
||||
|
||||
#define ARDUINO_LMIC_VERSION ARDUINO_LMIC_VERSION_CALC(2, 2, 2, 0)
|
||||
#define ARDUINO_LMIC_VERSION ARDUINO_LMIC_VERSION_CALC(2, 3, 2, 0) /* v2.3.2 */
|
||||
|
||||
#define ARDUINO_LMIC_VERSION_GET_MAJOR(v) \
|
||||
(((v) >> 24u) & 0xFFu)
|
||||
@ -243,6 +243,35 @@ enum {
|
||||
MAX_CLOCK_ERROR = 65536,
|
||||
};
|
||||
|
||||
// network time request callback function
|
||||
// defined unconditionally, because APIs and types can't change based on config.
|
||||
// This is called when a time-request succeeds or when we get a downlink
|
||||
// without time request, "completing" the pending time request.
|
||||
typedef void LMIC_ABI_STD lmic_request_network_time_cb_t(void *pUserData, int flagSuccess);
|
||||
|
||||
// how the network represents time.
|
||||
typedef u4_t lmic_gpstime_t;
|
||||
|
||||
// rather than deal with 1/256 second tick, we adjust ostime back
|
||||
// (as it's high res) to match tNetwork.
|
||||
typedef struct lmic_time_reference_s lmic_time_reference_t;
|
||||
|
||||
struct lmic_time_reference_s {
|
||||
// our best idea of when we sent the uplink (end of packet).
|
||||
ostime_t tLocal;
|
||||
// the network's best idea of when we sent the uplink.
|
||||
lmic_gpstime_t tNetwork;
|
||||
};
|
||||
|
||||
enum lmic_request_time_state_e {
|
||||
lmic_RequestTimeState_idle = 0, // we're not doing anything
|
||||
lmic_RequestTimeState_tx, // we want to tx a time request on next uplink
|
||||
lmic_RequestTimeState_rx, // we have tx'ed, next downlink completes.
|
||||
lmic_RequestTimeState_success // we sucessfully got time.
|
||||
};
|
||||
|
||||
typedef u1_t lmic_request_time_state_t;
|
||||
|
||||
struct lmic_t {
|
||||
// Radio settings TX/RX (also accessed by HAL)
|
||||
ostime_t txend;
|
||||
@ -306,6 +335,14 @@ struct lmic_t {
|
||||
devaddr_t devaddr;
|
||||
u4_t seqnoDn; // device level down stream seqno
|
||||
u4_t seqnoUp;
|
||||
#if LMIC_ENABLE_DeviceTimeReq
|
||||
// put here for alignment, to reduce RAM use.
|
||||
ostime_t localDeviceTime; // the LMIC.txend value for last DeviceTimeAns
|
||||
lmic_gpstime_t netDeviceTime; // the netDeviceTime for lastDeviceTimeAns
|
||||
// zero ==> not valid.
|
||||
lmic_request_network_time_cb_t *pNetworkTimeCb; // call-back routine
|
||||
void *pNetworkTimeUserData; // call-back data
|
||||
#endif // LMIC_ENABLE_DeviceTimeReq
|
||||
|
||||
u1_t dnConf; // dn frame confirm pending: LORA::FCT_ACK or 0
|
||||
s1_t adrAckReq; // counter until we reset data rate (0=off)
|
||||
@ -329,6 +366,10 @@ struct lmic_t {
|
||||
bit_t txParamSetupAns; // transmit setup answer pending.
|
||||
u1_t txParam; // the saved TX param byte.
|
||||
#endif
|
||||
#if LMIC_ENABLE_DeviceTimeReq
|
||||
lmic_request_time_state_t txDeviceTimeReqState; // current state, initially idle.
|
||||
u1_t netDeviceTimeFrac; // updated on any DeviceTimeAns.
|
||||
#endif
|
||||
|
||||
// rx1DrOffset is the offset from uplink to downlink datarate
|
||||
u1_t rx1DrOffset; // captured from join. zero by default.
|
||||
@ -368,6 +409,7 @@ struct lmic_t {
|
||||
|
||||
u1_t noRXIQinversion;
|
||||
};
|
||||
|
||||
//! \var struct lmic_t LMIC
|
||||
//! The state of LMIC MAC layer is encapsulated in this variable.
|
||||
DECLARE_LMIC; //!< \internal
|
||||
@ -417,6 +459,9 @@ u4_t LMIC_getSeqnoUp (void);
|
||||
u4_t LMIC_setSeqnoUp (u4_t);
|
||||
void LMIC_getSessionKeys (u4_t *netid, devaddr_t *devaddr, xref2u1_t nwkKey, xref2u1_t artKey);
|
||||
|
||||
void LMIC_requestNetworkTime(lmic_request_network_time_cb_t *pCallbackfn, void *pUserData);
|
||||
int LMIC_getNetworkTimeReference(lmic_time_reference_t *pReference);
|
||||
|
||||
// Declare onEvent() function, to make sure any definition will have the
|
||||
// C conventions, even when in a C++ file.
|
||||
DECL_ON_LMIC_EVENT;
|
||||
|
Reference in New Issue
Block a user