1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-23 19:21:59 +03:00

weak hook preinit() #2111 #2133 #2136 (#5395)

* weak hook early_setup() #2111 #2133 #2136

* rename to early_init (more "c" vs early_setup which is more "c++arduino")

* example

* improve earlyWiFi example, slightly change AddrList interface, move WiFi sketches into WiFi examples

* fix CI

* fix local CI runner

* fix local CI runner

* rename early_init() to preinit()

* + static ESP8266WiFiClass::preinit_wifi_off()

* update early disable wifi example

* example update

* IPv6 example update

* Update ESP8266WiFiGeneric.h

camelCase for static method name

* Update ESP8266WiFiGeneric.cpp

camelCase for static method name

* Update EarlyDisableWiFi.ino

Expand comment, fix static method name

* Update core_esp8266_main.cpp

Expanded comment.

* Update core_esp8266_main.cpp

Expanded comment

* Update EarlyDisableWiFi.ino

Expanded comment
This commit is contained in:
david gauchard
2018-12-04 05:54:27 +01:00
committed by Earle F. Philhower, III
parent 2ec3daa225
commit 216680bb57
5 changed files with 92 additions and 2 deletions

View File

@ -219,6 +219,7 @@ uint8_t shiftIn(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder);
void attachInterrupt(uint8_t pin, void (*)(void), int mode);
void detachInterrupt(uint8_t pin);
void preinit(void);
void setup(void);
void loop(void);

View File

@ -63,7 +63,7 @@ static uint32_t s_micros_at_task_start;
extern "C" {
extern const uint32_t __attribute__((section(".ver_number"))) core_version = ARDUINO_ESP8266_GIT_VER;
const char* core_release =
const char* core_release =
#ifdef ARDUINO_ESP8266_RELEASE
ARDUINO_ESP8266_RELEASE;
#else
@ -243,18 +243,26 @@ extern "C" void ICACHE_RAM_ATTR app_entry (void)
return app_entry_custom();
}
extern "C" void preinit (void) __attribute__((weak));
extern "C" void preinit (void)
{
/* do nothing by default */
}
extern "C" void user_init(void) {
struct rst_info *rtc_info_ptr = system_get_rst_info();
memcpy((void *) &resetInfo, (void *) rtc_info_ptr, sizeof(resetInfo));
uart_div_modify(0, UART_CLK_FREQ / (115200));
init();
init(); // in core_esp8266_wiring.c, inits hw regs and sdk timer
initVariant();
cont_init(g_pcont);
preinit(); // Prior to C++ Dynamic Init (not related to above init() ). Meant to be user redefinable.
ets_task(loop_task,
LOOP_TASK_PRIORITY, s_loop_queue,
LOOP_QUEUE_SIZE);