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