Configurable SPI & Uart channels

This commit is contained in:
Sil333033
2023-07-27 19:49:39 +02:00
parent c20d2344a7
commit d36c7cc183
35 changed files with 476 additions and 98 deletions

View File

@@ -14,10 +14,14 @@
#include <assets_icons.h>
#include <dialogs/dialogs.h>
#include <xtreme.h>
#define NUM_MENU_ITEMS (4)
#define EVIL_PORTAL_TEXT_BOX_STORE_SIZE (4096)
#define UART_CH (FuriHalUartIdUSART1)
#define UART_CH \
(XTREME_SETTINGS()->uart_esp_channel == UARTDefault ? FuriHalUartIdUSART1 : \
FuriHalUartIdLPUART1)
#define SET_HTML_CMD "sethtml"
#define SET_AP_CMD "setap"

View File

@@ -121,10 +121,16 @@ Evil_PortalUart* evil_portal_uart_init(Evil_PortalApp* app) {
furi_thread_start(uart->rx_thread);
furi_hal_console_disable();
if(UART_CH == FuriHalUartIdUSART1) {
furi_hal_console_disable();
} else if(UART_CH == FuriHalUartIdLPUART1) {
furi_hal_uart_init(UART_CH, app->BAUDRATE);
}
if(app->BAUDRATE == 0) {
app->BAUDRATE = 115200;
}
furi_hal_uart_set_br(UART_CH, app->BAUDRATE);
furi_hal_uart_set_irq_cb(UART_CH, evil_portal_uart_on_irq_cb, uart);
@@ -139,7 +145,12 @@ void evil_portal_uart_free(Evil_PortalUart* uart) {
furi_thread_free(uart->rx_thread);
furi_hal_uart_set_irq_cb(UART_CH, NULL, NULL);
furi_hal_console_enable();
if(UART_CH == FuriHalUartIdLPUART1) {
furi_hal_uart_deinit(UART_CH);
} else {
furi_hal_console_enable();
}
free(uart);
}