[beken-72xx] Update Arduino core to new structure
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
/* Copyright (c) Kuba Szczodrzyński 2022-08-26. */
|
||||
|
||||
#pragma once
|
||||
|
||||
#define LWIP_TIMEVAL_PRIVATE 0
|
||||
#define LWIP_NETIF_HOSTNAME 1 // to support hostname changing
|
||||
#define LWIP_SO_RCVBUF 1 // for ioctl(FIONREAD)
|
||||
@@ -9,6 +11,8 @@
|
||||
|
||||
#include_next "lwipopts.h"
|
||||
|
||||
#include <sys/time.h>
|
||||
|
||||
// set lwIP debugging options according to LT config
|
||||
#if LT_DEBUG_LWIP
|
||||
#undef LWIP_DEBUG
|
||||
@@ -64,24 +68,24 @@
|
||||
#undef IP6_DEBUG
|
||||
#undef MDNS_DEBUG
|
||||
|
||||
#undef LWIP_DONT_PROVIDE_BYTEORDER_FUNCTIONS
|
||||
|
||||
/** Set this to 1 to support DNS names (or IP address strings) to set sntp servers
|
||||
* One server address/name can be defined as default if SNTP_SERVER_DNS == 1:
|
||||
* \#define SNTP_SERVER_ADDRESS "pool.ntp.org"
|
||||
*/
|
||||
#define SNTP_SERVER_DNS 1
|
||||
#define SNTP_SERVER_DNS 1
|
||||
|
||||
#define SNTP_SET_SYSTEM_TIME_US(sec, us) \
|
||||
do { \
|
||||
struct timeval tv = { .tv_sec = sec, .tv_usec = us }; \
|
||||
settimeofday(&tv, NULL); \
|
||||
} 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; \
|
||||
} while (0);
|
||||
#define SNTP_SET_SYSTEM_TIME_US(sec, us) \
|
||||
do { \
|
||||
struct timeval tv = {.tv_sec = sec, .tv_usec = us}; \
|
||||
settimeofday(&tv, NULL); \
|
||||
} 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; \
|
||||
} while (0);
|
||||
|
||||
@@ -3,7 +3,9 @@
|
||||
#pragma once
|
||||
|
||||
// C standard libraries
|
||||
#include <errno.h>
|
||||
#include <inttypes.h>
|
||||
#include <math.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
@@ -35,7 +37,7 @@
|
||||
|
||||
// Types & macros
|
||||
#include "lt_chip.h" // ChipType enum
|
||||
#include "lt_config.h" // configuration macros
|
||||
#include "lt_config.h" // platform configuration options
|
||||
#include "lt_types.h" // other types & enums
|
||||
// Family-specific macros
|
||||
#include <lt_family.h>
|
||||
|
||||
@@ -8,6 +8,27 @@
|
||||
extern "C" {
|
||||
#endif // __cplusplus
|
||||
|
||||
/**
|
||||
* @brief Initialize the family core (optional).
|
||||
* This method is family-specific; the family core can do whatever it wants to.
|
||||
* This method is empty if not implemented, and shouldn't be called manually.
|
||||
*/
|
||||
void lt_init_family() __attribute__((weak));
|
||||
|
||||
/**
|
||||
* @brief Initialize the board (variant).
|
||||
* This method is empty if not implemented (which is usually the case),
|
||||
* and shouldn't be called manually.
|
||||
*/
|
||||
void lt_init_variant() __attribute__((weak));
|
||||
|
||||
/**
|
||||
* @brief Initialize the family's Arduino core (optional).
|
||||
* This method is family-specific; the family core can do whatever it wants to.
|
||||
* This method is empty if not implemented, and shouldn't be called manually.
|
||||
*/
|
||||
void lt_init_arduino() __attribute__((weak));
|
||||
|
||||
/**
|
||||
* @brief Get the reason of last chip reset.
|
||||
*/
|
||||
|
||||
@@ -12,6 +12,9 @@ void __libc_init_array(void);
|
||||
int main(void);
|
||||
|
||||
int lt_main(void) {
|
||||
// early initialize the family and variant
|
||||
lt_init_family();
|
||||
lt_init_variant();
|
||||
// print a startup banner
|
||||
LT_BANNER();
|
||||
// initialize C library
|
||||
|
||||
Reference in New Issue
Block a user