deeply reworked timesync code

This commit is contained in:
Klaus K Wilting committed 2020-03-06 19:24:58 +01:00
1 parent f1b13f11fa
commit 73a612779b
6 files changed
+233 -212

No files matched your search

+16 -14
View File
@@ -20,13 +20,6 @@
extern TaskHandle_t lmicTask, lorasendTask;
// table of LORAWAN MAC commands
typedef struct {
const uint8_t opcode;
const char cmdname[20];
const uint8_t params;
} mac_t;
esp_err_t lora_stack_init(bool do_join);
void lora_setupForNetwork(bool preJoin);
void lmictask(void *pvParameters);
@@ -36,19 +29,28 @@ void get_hard_deveui(uint8_t *pdeveui);
void os_getDevKey(u1_t *buf);
void os_getArtEui(u1_t *buf);
void os_getDevEui(u1_t *buf);
void showLoraKeys(void);
void lora_send(void *pvParameters);
void lora_enqueuedata(MessageBuffer_t *message);
void lora_queuereset(void);
void IRAM_ATTR myEventCallback(void *pUserData, ev_t ev);
void IRAM_ATTR myRxCallback(void *pUserData, uint8_t port,
const uint8_t *pMsg, size_t nMsg);
//void IRAM_ATTR myTxCallback(void *pUserData, int fSuccess);
void mac_decode(const uint8_t cmd[], const uint8_t cmdlen, const mac_t table[],
const uint8_t tablesize);
//u1_t os_getBattLevel(void);
void IRAM_ATTR myRxCallback(void *pUserData, uint8_t port, const uint8_t *pMsg,
size_t nMsg);
void IRAM_ATTR myTxCallback(void *pUserData, int fSuccess);
const char *getSfName(rps_t rps);
const char *getBwName(rps_t rps);
const char *getCrName(rps_t rps);
// u1_t os_getBattLevel(void);
#if VERBOSE
// a table for storage of LORAWAN MAC commands
typedef struct {
const uint8_t opcode;
const char cmdname[20];
const uint8_t params;
} mac_t;
void mac_decode(const uint8_t cmd[], const uint8_t cmdlen, const mac_t table[],
const uint8_t tablesize);
void showLoraKeys(void);
#endif
#endif
+9 -6
View File
@@ -17,15 +17,18 @@ enum timesync_t {
timesync_rx,
gwtime_sec,
gwtime_msec,
gwtime_tzsec,
no_of_timestamps
};
void timesync_init(void);
void send_timesync_req(void);
int recv_timesync_ans(const uint8_t buf[], uint8_t buf_len);
void store_timestamp(uint32_t timestamp, timesync_t timestamp_type);
void IRAM_ATTR process_timesync_req(void *taskparameter);
void IRAM_ATTR process_timesync_req(void *pVoidUserUTCTime, int flagSuccess);
void timesync_sendReq(void);
void timesync_storeReq(uint32_t timestamp, timesync_t timestamp_type);
void IRAM_ATTR timesync_processReq(void *taskparameter);
#if (TIME_SYNC_LORASERVER)
int recv_timeserver_ans(const uint8_t buf[], uint8_t buf_len);
#elif (TIME_SYNC_LORAWAN)
void IRAM_ATTR DevTimeAns_Cb(void *pUserData, int flagSuccess);
#endif
#endif