summaryrefslogtreecommitdiff
path: root/ota-test/main/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'ota-test/main/main.cpp')
-rw-r--r--ota-test/main/main.cpp52
1 files changed, 52 insertions, 0 deletions
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 <assert.h>
+
+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);
+}