mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-09 20:41:14 +00:00
Merge branch 'master' into feature/lwip_sntp_max_servers
This commit is contained in:
@@ -33,9 +33,7 @@
|
||||
#define __LWIPOPTS_H__
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/fcntl.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/types.h>
|
||||
@@ -44,6 +42,7 @@
|
||||
#include "esp_system.h"
|
||||
#include "sdkconfig.h"
|
||||
#include "netif/dhcp_state.h"
|
||||
#include "sntp/sntp_get_set_time.h"
|
||||
|
||||
/* Enable all Espressif-only options */
|
||||
|
||||
@@ -1063,25 +1062,6 @@
|
||||
------------ SNTP options ------------
|
||||
--------------------------------------
|
||||
*/
|
||||
/*
|
||||
* SNTP update delay - in milliseconds
|
||||
*/
|
||||
|
||||
/*
|
||||
* Forward declarations of weak definitions from lwip's sntp.c which could
|
||||
* be redefined by user application. This is needed to provide custom definition
|
||||
* of the below macros in lwip's sntp.c.
|
||||
* Full declaration is provided in IDF's port layer in esp_sntp.h
|
||||
*/
|
||||
#ifdef __cplusplus
|
||||
#define LWIP_FORWARD_DECLARE_C_CXX extern "C"
|
||||
#else
|
||||
#define LWIP_FORWARD_DECLARE_C_CXX
|
||||
#endif
|
||||
|
||||
LWIP_FORWARD_DECLARE_C_CXX void sntp_sync_time(struct timeval *tv);
|
||||
|
||||
LWIP_FORWARD_DECLARE_C_CXX uint32_t sntp_get_sync_interval(void);
|
||||
|
||||
// Max number of SNTP servers handled (default equal to LWIP_DHCP_MAX_NTP_SERVERS)
|
||||
#if defined CONFIG_LWIP_SNTP_MAX_SERVERS
|
||||
@@ -1101,22 +1081,9 @@ LWIP_FORWARD_DECLARE_C_CXX uint32_t sntp_get_sync_interval(void);
|
||||
// It disables a check of SNTP_UPDATE_DELAY it is done in sntp_set_sync_interval
|
||||
#define SNTP_SUPPRESS_DELAY_CHECK
|
||||
|
||||
#define SNTP_UPDATE_DELAY (sntp_get_sync_interval())
|
||||
|
||||
#define SNTP_SET_SYSTEM_TIME_US(sec, us) \
|
||||
do { \
|
||||
struct timeval tv = { .tv_sec = sec, .tv_usec = us }; \
|
||||
sntp_sync_time(&tv); \
|
||||
} while (0);
|
||||
|
||||
#define SNTP_GET_SYSTEM_TIME(sec, us) \
|
||||
do { \
|
||||
struct timeval tv = { .tv_sec = 0, .tv_usec = 0 }; \
|
||||
gettimeofday(&tv, NULL); \
|
||||
(sec) = tv.tv_sec; \
|
||||
(us) = tv.tv_usec; \
|
||||
sntp_set_sync_status(SNTP_SYNC_STATUS_RESET); \
|
||||
} while (0);
|
||||
#define SNTP_UPDATE_DELAY (sntp_get_sync_interval())
|
||||
#define SNTP_SET_SYSTEM_TIME_US(sec, us) (sntp_set_system_time(sec, us))
|
||||
#define SNTP_GET_SYSTEM_TIME(sec, us) (sntp_get_system_time(&(sec), &(us)))
|
||||
|
||||
#define SOC_SEND_LOG //printf
|
||||
|
||||
|
Reference in New Issue
Block a user