59 lines
1.2 KiB
C
59 lines
1.2 KiB
C
/*
|
|
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
|
*
|
|
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
|
*/
|
|
|
|
#include <inttypes.h>
|
|
|
|
#include "freertos/FreeRTOS.h"
|
|
#include "freertos/task.h"
|
|
#include "freertos/semphr.h"
|
|
|
|
#include "esp_log.h"
|
|
#include "driver/uart.h"
|
|
|
|
#include "esp_lcd_panel_ops.h"
|
|
#include "driver/spi_common.h"
|
|
#include "esp_lcd_panel_io.h"
|
|
#include "esp_lcd_panel_commands.h"
|
|
#include "esp_lcd_ili9341.h"
|
|
#include "lvgl.h"
|
|
|
|
#include "dshot_esc_encoder.h"
|
|
#include "display.h"
|
|
#include "ui.h"
|
|
#include "motor.h"
|
|
|
|
|
|
static const char *TAG = "spincoat-plater-firmware";
|
|
|
|
static const uint16_t throttle = 200;
|
|
|
|
|
|
void app_main(void) {
|
|
init_display();
|
|
|
|
build_ui();
|
|
|
|
init_motor();
|
|
//init_rmt_esc_tx();
|
|
//throttle.throttle = 300;
|
|
update_throttle(throttle);
|
|
|
|
//xTaskCreate(&v_telemetry_packet_func, "v_telemetry_packet_func", 2048, NULL, 1, NULL);
|
|
|
|
//init_telemetry_uart_rx();
|
|
|
|
while(1) {
|
|
send_dshot_packet();
|
|
|
|
uint8_t length = 0;
|
|
ESP_ERROR_CHECK(uart_get_buffered_data_len(ESC_UART_NUM, (size_t*)&length));
|
|
|
|
if(length >= 10) {
|
|
parse_telemetry();
|
|
}
|
|
}
|
|
}
|