From 537f6824bba79f06d440049498d5b0cb8f23cbb4 Mon Sep 17 00:00:00 2001 From: Aryan Kashem <130705280+Akashem06@users.noreply.github.com> Date: Sun, 3 Nov 2024 23:53:39 -0500 Subject: [PATCH] Fixed hardfault (#342) * Fixed hardfault * Formatting * Formatting --- libraries/ms-common/inc/arm/uart_mcu.h | 5 +---- libraries/ms-common/inc/uart.h | 2 +- libraries/ms-common/inc/x86/uart_mcu.h | 2 -- libraries/ms-common/src/arm/uart.c | 9 --------- 4 files changed, 2 insertions(+), 16 deletions(-) diff --git a/libraries/ms-common/inc/arm/uart_mcu.h b/libraries/ms-common/inc/arm/uart_mcu.h index d2be9c130..8279805e8 100644 --- a/libraries/ms-common/inc/arm/uart_mcu.h +++ b/libraries/ms-common/inc/arm/uart_mcu.h @@ -1,10 +1,7 @@ #pragma once -#define NUM_UART_PORTS 3 - typedef enum { UART_PORT_1 = 0, UART_PORT_2, - UART_PORT_3, - UART_PORT_4, + NUM_UART_PORTS, } UartPort; diff --git a/libraries/ms-common/inc/uart.h b/libraries/ms-common/inc/uart.h index 0dc133d0a..9398ab7f1 100644 --- a/libraries/ms-common/inc/uart.h +++ b/libraries/ms-common/inc/uart.h @@ -12,7 +12,7 @@ // Module is not thread safe - do not access a single port from // two locations at the same time -#define UART_MAX_BUFFER_LEN 512 +#define UART_MAX_BUFFER_LEN 256 typedef struct { GpioAddress tx; // tx pin diff --git a/libraries/ms-common/inc/x86/uart_mcu.h b/libraries/ms-common/inc/x86/uart_mcu.h index 80a6f5b3d..8279805e8 100644 --- a/libraries/ms-common/inc/x86/uart_mcu.h +++ b/libraries/ms-common/inc/x86/uart_mcu.h @@ -3,7 +3,5 @@ typedef enum { UART_PORT_1 = 0, UART_PORT_2, - UART_PORT_3, - UART_PORT_4, NUM_UART_PORTS, } UartPort; diff --git a/libraries/ms-common/src/arm/uart.c b/libraries/ms-common/src/arm/uart.c index 48f83dc7b..2b84cacff 100644 --- a/libraries/ms-common/src/arm/uart.c +++ b/libraries/ms-common/src/arm/uart.c @@ -34,10 +34,6 @@ static UartPortData s_port[] = { .periph = RCC_APB1Periph_USART2, .irq = USART2_IRQn, .base = USART2 }, - [UART_PORT_3] = { .rcc_cmd = RCC_APB1PeriphClockCmd, - .periph = RCC_APB1Periph_USART3, - .irq = USART3_IRQn, - .base = USART3 }, }; static void prv_handle_irq(UartPort uart); @@ -169,8 +165,3 @@ void USART1_IRQHandler(void) { void USART2_IRQHandler(void) { prv_handle_irq(UART_PORT_2); } - -void USART3_4_IRQHandler(void) { - prv_handle_irq(UART_PORT_3); - prv_handle_irq(UART_PORT_4); -}