mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-13 23:18:35 -07:00
Configurable SPI & Uart channels
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user