mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-13 16:18:35 -07:00
Configurable SPI & Uart channels
This commit is contained in:
@@ -15,3 +15,9 @@
|
||||
#define FLIPPERZERO_SERIAL_BAUD 115200
|
||||
|
||||
#define NA 0
|
||||
|
||||
#include <xtreme.h>
|
||||
|
||||
#define UART_CH \
|
||||
(XTREME_SETTINGS()->uart_esp_channel == UARTDefault ? FuriHalUartIdUSART1 : \
|
||||
FuriHalUartIdLPUART1)
|
||||
|
||||
@@ -835,7 +835,7 @@ void send_serial_command(ESerialCommand command) {
|
||||
return;
|
||||
};
|
||||
|
||||
furi_hal_uart_tx(FuriHalUartIdUSART1, data, 1);
|
||||
furi_hal_uart_tx(UART_CH, data, 1);
|
||||
}
|
||||
|
||||
int32_t wifi_scanner_app(void* p) {
|
||||
@@ -905,11 +905,14 @@ int32_t wifi_scanner_app(void* p) {
|
||||
WIFI_APP_LOG_I("UART thread allocated");
|
||||
|
||||
// Enable uart listener
|
||||
#if DISABLE_CONSOLE
|
||||
furi_hal_console_disable();
|
||||
#endif
|
||||
furi_hal_uart_set_br(FuriHalUartIdUSART1, FLIPPERZERO_SERIAL_BAUD);
|
||||
furi_hal_uart_set_irq_cb(FuriHalUartIdUSART1, uart_on_irq_cb, app);
|
||||
if(UART_CH == FuriHalUartIdUSART1) {
|
||||
furi_hal_console_disable();
|
||||
} else if(UART_CH == FuriHalUartIdLPUART1) {
|
||||
furi_hal_uart_init(UART_CH, FLIPPERZERO_SERIAL_BAUD);
|
||||
}
|
||||
|
||||
furi_hal_uart_set_br(UART_CH, FLIPPERZERO_SERIAL_BAUD);
|
||||
furi_hal_uart_set_irq_cb(UART_CH, uart_on_irq_cb, app);
|
||||
WIFI_APP_LOG_I("UART Listener created");
|
||||
|
||||
// Because we assume that module was on before we launched the app. We need to ensure that module will be in initial state on app start
|
||||
@@ -1034,9 +1037,11 @@ int32_t wifi_scanner_app(void* p) {
|
||||
// Reset GPIO pins to default state
|
||||
furi_hal_gpio_init(&gpio_ext_pc0, GpioModeAnalog, GpioPullNo, GpioSpeedLow);
|
||||
|
||||
#if DISABLE_CONSOLE
|
||||
furi_hal_console_enable();
|
||||
#endif
|
||||
if(UART_CH == FuriHalUartIdLPUART1) {
|
||||
furi_hal_uart_deinit(UART_CH);
|
||||
} else {
|
||||
furi_hal_console_enable();
|
||||
}
|
||||
|
||||
view_port_enabled_set(view_port, false);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user