2021-10-14 09:04:00 +01:00
|
|
|
#include <stdint.h>
|
|
|
|
#include <esp_log.h>
|
2021-11-22 11:24:16 +00:00
|
|
|
#include <freertos/FreeRTOS.h>
|
|
|
|
#include <freertos/task.h>
|
|
|
|
#include <rom/ets_sys.h>
|
|
|
|
|
2021-10-14 09:04:00 +01:00
|
|
|
#include "usb-cdc.h"
|
2021-10-14 09:30:43 +01:00
|
|
|
#include "nvs.h"
|
2021-10-17 15:06:53 +01:00
|
|
|
#include "gdb_main.h"
|
2021-10-24 20:22:24 +01:00
|
|
|
#include "led.h"
|
2021-10-26 10:37:49 +01:00
|
|
|
#include "uart.h"
|
|
|
|
#include "i2c.h"
|
2021-11-22 11:24:16 +00:00
|
|
|
#include "network.h"
|
|
|
|
#include "network-http.h"
|
2021-11-22 22:13:12 +00:00
|
|
|
#include "network-uart.h"
|
2021-10-14 09:04:00 +01:00
|
|
|
|
|
|
|
static const char* TAG = "main";
|
|
|
|
|
2021-10-17 15:06:53 +01:00
|
|
|
void gdb_application_thread(void* pvParameters) {
|
|
|
|
ESP_LOGI("gdb", "start");
|
|
|
|
while(1) {
|
|
|
|
gdb_main();
|
|
|
|
}
|
|
|
|
ESP_LOGI("gdb", "end");
|
|
|
|
}
|
|
|
|
|
|
|
|
#include <platform.h>
|
|
|
|
#include <driver/gpio.h>
|
|
|
|
|
|
|
|
void pins_init() {
|
|
|
|
gpio_config_t io_conf;
|
|
|
|
// disable interrupt
|
|
|
|
io_conf.intr_type = GPIO_PIN_INTR_DISABLE;
|
|
|
|
// set as output mode
|
|
|
|
io_conf.mode = GPIO_MODE_OUTPUT;
|
|
|
|
// bit mask of the pins that you want to set
|
|
|
|
io_conf.pin_bit_mask = ((1 << SWCLK_PIN) | (1 << SWDIO_PIN));
|
|
|
|
// disable pull-down mode
|
|
|
|
io_conf.pull_down_en = 0;
|
|
|
|
// disable pull-up mode
|
|
|
|
io_conf.pull_up_en = 0;
|
|
|
|
// configure GPIO with the given settings
|
|
|
|
gpio_config(&io_conf);
|
|
|
|
}
|
|
|
|
|
2021-11-22 11:24:16 +00:00
|
|
|
void tcp_uart_init(void);
|
|
|
|
void tcp_web_log(void);
|
|
|
|
|
2021-10-14 09:04:00 +01:00
|
|
|
void app_main(void) {
|
|
|
|
ESP_LOGI(TAG, "start");
|
2021-11-22 11:24:16 +00:00
|
|
|
|
2021-10-28 06:03:33 +01:00
|
|
|
led_init();
|
|
|
|
led_set_blue(255);
|
2021-10-14 09:04:00 +01:00
|
|
|
|
2021-11-22 11:24:16 +00:00
|
|
|
nvs_init();
|
|
|
|
network_init();
|
|
|
|
network_http_server_init();
|
2021-11-22 22:13:12 +00:00
|
|
|
network_uart_server_init();
|
2021-11-22 11:24:16 +00:00
|
|
|
|
2021-10-14 09:04:00 +01:00
|
|
|
usb_cdc_init();
|
2021-11-19 19:14:52 +00:00
|
|
|
|
2021-10-26 10:37:49 +01:00
|
|
|
// TODO uart and i2c share the same pins, need switching mechanics
|
|
|
|
// uart_init();
|
|
|
|
// uart_print("Uart inited");
|
|
|
|
|
|
|
|
// i2c_init();
|
|
|
|
// i2c_scan();
|
|
|
|
|
2021-11-22 11:53:19 +00:00
|
|
|
pins_init();
|
|
|
|
xTaskCreate(&gdb_application_thread, "gdb_thread", 16 * 4096, NULL, 5, NULL);
|
2021-10-28 06:03:33 +01:00
|
|
|
led_set_blue(0);
|
2021-10-14 09:04:00 +01:00
|
|
|
ESP_LOGI(TAG, "end");
|
|
|
|
}
|