diff options
author | Oxore <oxore@protonmail.com> | 2023-03-09 02:43:56 +0300 |
---|---|---|
committer | Oxore <oxore@protonmail.com> | 2023-03-09 02:43:56 +0300 |
commit | 7a0b96bf5c46521d6d8d2b527eb7099420a97aad (patch) | |
tree | 54b1d67b84d56f542b8733e6546eac21207ab765 | |
parent | 03c9475bc378171a1018c4e56cc453844ddd2b08 (diff) |
Init NVIC alongside with UARTs
-rw-r--r-- | CMakeLists.txt | 2 | ||||
-rw-r--r-- | app/platform/stm32f0-gcc/platform.cpp | 17 |
2 files changed, 18 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 5d89e4e..af639db 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -128,7 +128,7 @@ target_include_directories(${PROJECT_NAME} PRIVATE ) target_compile_definitions(${PROJECT_NAME} PRIVATE - STM32F0XX=1 + STM32F072=1 LED_DRIVER=1 __FREERTOS__=1 ) diff --git a/app/platform/stm32f0-gcc/platform.cpp b/app/platform/stm32f0-gcc/platform.cpp index 00bc391..c74a3c4 100644 --- a/app/platform/stm32f0-gcc/platform.cpp +++ b/app/platform/stm32f0-gcc/platform.cpp @@ -1,9 +1,11 @@ #include "platform/platform.h" #include "retarget.h" +#include "third_party/CMSIS/Device/Include/stm32f0xx.h" #include "third_party/CMSIS/Device/Include/system_stm32f0xx.h" #include "third_party/STM32F0xx_StdPeriph_Driver/inc/stm32f0xx_usart.h" #include "third_party/STM32F0xx_StdPeriph_Driver/inc/stm32f0xx_rcc.h" #include "third_party/STM32F0xx_StdPeriph_Driver/inc/stm32f0xx_gpio.h" +#include "third_party/STM32F0xx_StdPeriph_Driver/inc/stm32f0xx_misc.h" #if defined(__GNUC__) #pragma GCC diagnostic push @@ -36,6 +38,11 @@ static void USART1Init(void) USART1->CR1 |= USART_CR1_RXNEIE; USART1->CR3 |= USART_CR3_OVRDIS; USART_Cmd(USART1, ENABLE); + NVIC_InitTypeDef NVIC_InitStructure; + NVIC_InitStructure.NVIC_IRQChannel = USART1_IRQn; + NVIC_InitStructure.NVIC_IRQChannelPriority = 1; + NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; + NVIC_Init(&NVIC_InitStructure); // TODO get rid of SPL } @@ -65,6 +72,11 @@ static void USART4Init(void) USART4->CR1 |= USART_CR1_RXNEIE; USART4->CR3 |= USART_CR3_OVRDIS; USART_Cmd(USART4, ENABLE); + NVIC_InitTypeDef NVIC_InitStructure; + NVIC_InitStructure.NVIC_IRQChannel = USART3_4_IRQn; + NVIC_InitStructure.NVIC_IRQChannelPriority = 1; + NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; + NVIC_Init(&NVIC_InitStructure); // TODO get rid of SPL } @@ -117,6 +129,11 @@ static void USART3Init(void) USART3->CR1 |= USART_CR1_RXNEIE; USART3->CR3 |= USART_CR3_OVRDIS; USART_Cmd(USART3, ENABLE); + NVIC_InitTypeDef NVIC_InitStructure; + NVIC_InitStructure.NVIC_IRQChannel = USART3_4_IRQn; + NVIC_InitStructure.NVIC_IRQChannelPriority = 1; + NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; + NVIC_Init(&NVIC_InitStructure); // TODO get rid of SPL } |