![]() |
Pico Led Controller 1.0.3
A project to control LEDs using Raspberry Pi Pico W
|
#include "ntp.h"
#include <string.h>
#include <time.h>
#include "pico/stdlib.h"
#include "pico/cyw43_arch.h"
#include "lwip/dns.h"
#include "lwip/pbuf.h"
#include "lwip/udp.h"
Go to the source code of this file.
Functions | |
static void | ntp_result (NTP_T *state, int status, time_t *result) |
static void | ntp_request (NTP_T *state) |
static int64_t | ntp_failed_handler (alarm_id_t id, void *user_data) |
static void | ntp_dns_found (const char *hostname, const ip_addr_t *ipaddr, void *arg) |
static void | ntp_recv (void *arg, struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *addr, u16_t port) |
static NTP_T * | ntp_init (void) |
void | ntp_deinit (void) |
NTP deinit. More... | |
void | ntp_update_time (void) |
NTP update time. More... | |
Variables | |
volatile struct tm * | utc = NULL |
UTC time struct. More... | |
volatile struct tm * | current_utc = NULL |
UTC time struct. More... | |
void ntp_deinit | ( | void | ) |
|
static |
Definition at line 56 of file ntp.c.
References ntp_request(), ntp_result(), and NTP_T_::ntp_server_address.
Referenced by ntp_update_time().
|
static |
|
static |
Definition at line 95 of file ntp.c.
References NTP_T_::ntp_pcb, and ntp_recv().
Referenced by ntp_update_time().
|
static |
Definition at line 72 of file ntp.c.
References NTP_DELTA, NTP_MSG_LEN, NTP_PORT, ntp_result(), and NTP_T_::ntp_server_address.
Referenced by ntp_init().
|
static |
Definition at line 36 of file ntp.c.
References NTP_MSG_LEN, NTP_T_::ntp_pcb, NTP_PORT, and NTP_T_::ntp_server_address.
Referenced by ntp_dns_found(), and ntp_update_time().
|
static |
Definition at line 16 of file ntp.c.
References current_utc, NTP_T_::dns_request_sent, NTP_T_::ntp_resend_alarm, NTP_TEST_TIME, NTP_T_::ntp_test_time, and utc.
Referenced by ntp_dns_found(), ntp_failed_handler(), ntp_recv(), and ntp_update_time().
void ntp_update_time | ( | void | ) |
NTP update time.
Function updates the NTP time.
Definition at line 123 of file ntp.c.
References NTP_T_::dns_request_sent, ntp_dns_found(), ntp_failed_handler(), ntp_init(), ntp_request(), NTP_T_::ntp_resend_alarm, NTP_RESEND_TIME, ntp_result(), NTP_SERVER, NTP_T_::ntp_server_address, and NTP_T_::ntp_test_time.
volatile struct tm* current_utc = NULL |
UTC time struct.
Struct for the last checked UTC time.
Definition at line 14 of file ntp.c.
Referenced by ntp_result().
volatile struct tm* utc = NULL |
UTC time struct.
Struct for the UTC time of program start.
Definition at line 13 of file ntp.c.
Referenced by ntp_deinit(), ntp_result(), and ssi_handler().