Juergen Marsch 8e38a5aae2 - Added suport for ADC(pin32-39)
please have in mind, ADC do not work linear.
  Espressif will change this later
- added support for DAC(pin 25-26)
- changed interrupt handling for GPIO and UART to virtual interrupts
Changes to be committed:
	modified:   Makefile
	modified:   targets/esp32/jshardware.c
	new file:   targets/esp32/jshardwareAnalog.c
	new file:   targets/esp32/jshardwareAnalog.h
	modified:   targets/esp32/jshardwareUart.c
	modified:   targets/esp32/jswrap_esp32.c
	modified:   targets/esp32/main.c
2016-12-13 18:58:57 +01:00

56 lines
1.3 KiB
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>
#include "rtosutil.h"
#include "jshardwareUart.h"
#include "jshardwareAnalog.h"
extern void jswrap_ESP32_wifi_restore(void) ;
static void uartTask(void *data) {
initConsole();
initADC(1);
while(1) {
consoleToEspruino();
}
}
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();
tcpip_adapter_init();
#ifdef RTOS
queues_init();
tasks_init();
task_init(espruinoTask,"EspruinoTask",10000,5,0);
task_init(uartTask,"ConsoleTask",2000,20,0);
#else
xTaskCreatePinnedToCore(&espruinoTask, "espruinoTask", 10000, NULL, 5, NULL, 0);
xTaskCreatePinnedToCore(&uartTask,"uartTask",2000,NULL,20,NULL,0);
#endif
return 0;
}