84 lines
1.3 KiB
C++
Executable File
84 lines
1.3 KiB
C++
Executable File
extern "C" {
|
|
#include "ets_sys.h"
|
|
#include "c_types.h"
|
|
#include "osapi.h"
|
|
//#include "gpio.h"
|
|
|
|
//#include "os_type.h"
|
|
//#include "user_config.h"
|
|
#include "user_interface.h"
|
|
//#include "wpa2_enterprise.h"
|
|
//#include "inttypes.h"
|
|
#include "mem.h"
|
|
#include "espconn.h"
|
|
|
|
#include "ESP8266lib/c++.h"
|
|
|
|
//#include "driver/uart.h"
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#define user_procTaskQueueLen 1
|
|
|
|
#define WEMOS_D1_MINI 1
|
|
#define NODE_MCU 2
|
|
|
|
#define PLATFORM WEMOS_D1_MINI
|
|
#define LED_PIN GPIO5
|
|
//#define PLATFORM NODE_MCU
|
|
|
|
#include "run_Buzzer.h"
|
|
|
|
|
|
static os_event_t user_procTaskQueue[user_procTaskQueueLen];
|
|
|
|
|
|
extern "C" void ICACHE_FLASH_ATTR user_init();
|
|
|
|
|
|
bool once = true;
|
|
|
|
//Main code function
|
|
void ICACHE_FLASH_ATTR user_loop(os_event_t*) {
|
|
|
|
// custome once-code
|
|
if (once) {
|
|
my_once();
|
|
once = false;
|
|
}
|
|
|
|
// custome loop code
|
|
my_loop();
|
|
|
|
// run again
|
|
system_os_post(USER_TASK_PRIO_0, 0, 0 );
|
|
|
|
}
|
|
|
|
void ICACHE_FLASH_ATTR user_init() {
|
|
|
|
// basic hardware setup
|
|
os_delay_us(1000*50);
|
|
gpio_init();
|
|
uart_div_modify(0, UART_CLK_FREQ / 115200);
|
|
|
|
|
|
os_delay_us(1000*50);
|
|
|
|
os_printf("init\r\n");
|
|
|
|
// ensure global constructors are called
|
|
do_global_ctors();
|
|
|
|
// custom one-time init code
|
|
my_init();
|
|
|
|
// start the loop-task
|
|
system_os_task(user_loop, USER_TASK_PRIO_0, user_procTaskQueue, user_procTaskQueueLen);
|
|
system_os_post(USER_TASK_PRIO_0, 0, 0 );
|
|
|
|
}
|