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

@@ -12,6 +12,12 @@
#include <gui/modules/text_input.h>
#include <gui/modules/variable_item_list.h>
#include <xtreme.h>
#define UART_CH \
(XTREME_SETTINGS()->uart_esp_channel == UARTDefault ? FuriHalUartIdUSART1 : \
FuriHalUartIdLPUART1)
#define NUM_MENU_ITEMS (11)
#define WIFI_deauther_TEXT_BOX_STORE_SIZE (4096)

View File

@@ -3,7 +3,6 @@
#include <stream_buffer.h>
#define UART_CH (FuriHalUartIdUSART1)
#define BAUDRATE (115200)
struct WifideautherUart {
@@ -76,7 +75,12 @@ WifideautherUart* wifi_deauther_uart_init(WifideautherApp* 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, BAUDRATE);
}
furi_hal_uart_set_br(UART_CH, BAUDRATE);
furi_hal_uart_set_irq_cb(UART_CH, wifi_deauther_uart_on_irq_cb, uart);
@@ -91,7 +95,11 @@ void wifi_deauther_uart_free(WifideautherUart* 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);
}