From fadeb06d74c3d739dc1202031e1eea1374e8917e Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Sun, 3 Jun 2018 23:35:52 +0200 Subject: wip --- ota-test/main/main.cpp | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 ota-test/main/main.cpp (limited to 'ota-test/main/main.cpp') diff --git a/ota-test/main/main.cpp b/ota-test/main/main.cpp new file mode 100644 index 0000000..a64f03f --- /dev/null +++ b/ota-test/main/main.cpp @@ -0,0 +1,52 @@ +#include "esp_misc.h" +#include "esp_sta.h" +#include "esp_system.h" +#include "esp_wifi.h" +#include "esp_spiffs.h" +#include "sdkconfig.h" + +#include + +extern "C" +uint32_t user_rf_cal_sector_set(); + +extern "C" +void user_init(); + +enum events { + EVENTS_GOT_IP = (1 << 0), + EVENTS_LOST_IP = (1 << 1), +}; + +static void set_wifi_mode() { + if (wifi_get_opmode_default() != NULL_MODE) { + printf("Setting default station mode"); + wifi_set_opmode(NULL_MODE); + } + + wifi_set_opmode_current(NULL_MODE); +} + +void main_task(void* ctx) { + (void) ctx; + + int count = 0; + while (1) { + printf("Hello World! %d\n", count++); + + vTaskDelay(pdMS_TO_TICKS(1000)); + } +} + +#define THREAD_NAME "main" +#define THREAD_STACK_WORDS 2048 +#define THREAD_PRIO 8 + +TaskHandle_t main_task_handle; +void user_init() { + os_printf("SDK version: %s, free: %d, app build: %s\n", system_get_sdk_version(), system_get_free_heap_size(), __TIMESTAMP__); + + set_wifi_mode(); + + assert(xTaskCreate(main_task, THREAD_NAME, THREAD_STACK_WORDS, NULL, THREAD_PRIO, &main_task_handle) == pdPASS); +} -- cgit v1.2.3