Rhys.Williams 58eee3d07d Allow single byte read from flash so that save() works
Implement `wifi.save()` and `wifi.restore()` using inbuilt API (rather than save to flash like ESP8266)
2016-11-24 12:09:34 +13:00

40 lines
889 B
C

#include "freertos/FreeRTOS.h"
#include "esp_wifi.h"
#include "esp_system.h"
#include "esp_event.h"
#include "esp_event_loop.h"
#include "nvs_flash.h"
#include <stdio.h>
#include <jsdevices.h>
#include <jsinteractive.h>
extern void jswrap_ESP32_wifi_restore(void) ;
static void espruinoTask(void *data) {
vTaskDelay(1000 / portTICK_PERIOD_MS);
printf("Espruino on ESP32 starting ...\n");
jshInit(); // Initialize the hardware
jsvInit(); // Initialize the variables
jsiInit(true); // Initialize the interactive subsystem
jswrap_ESP32_wifi_restore();
while(1) {
jsiLoop(); // Perform the primary loop processing
}
}
/**
* The main entry point into Espruino on an ESP32.
*/
int app_main(void)
{
nvs_flash_init();
system_init();
tcpip_adapter_init();
xTaskCreatePinnedToCore(&espruinoTask, "espruinoTask", 10000, NULL, 5, NULL, 0);
return 0;
}