aboutsummaryrefslogtreecommitdiff
path: root/stm32f091/setup.c
diff options
context:
space:
mode:
Diffstat (limited to 'stm32f091/setup.c')
-rw-r--r--stm32f091/setup.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/stm32f091/setup.c b/stm32f091/setup.c
index 39cff07..98ef8cd 100644
--- a/stm32f091/setup.c
+++ b/stm32f091/setup.c
@@ -30,8 +30,8 @@ UART_HandleTypeDef huart1 = {
.Init.Mode = UART_MODE_TX_RX,
.Init.HwFlowCtl = UART_HWCONTROL_NONE,
.Init.OverSampling = UART_OVERSAMPLING_16,
- .Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE,
- .AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT,
+// .Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE,
+// .AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT,
};
UART_HandleTypeDef huart2 = {
@@ -81,6 +81,7 @@ void ws_io_setup() {
ws_io_clock_setup();
ws_io_i2c_setup();
+ ws_io_dma_setup();
ws_io_usart1_setup();
ws_io_usart2_setup();
ws_io_dma_setup();
@@ -132,7 +133,11 @@ static void ws_io_usart1_setup() {
if (HAL_UART_Init(&huart1) != HAL_OK)
return ws_setup_error_handler();
+ // HAL_UARTEx_ReceiveToIdle_DMA(&huart2, RX_DMA_buffer, RX_DMA_BUFFER_SIZE);
+ HAL_UART_Receive_DMA(&huart1, g_ws_esp8266_dma_rx_buffer, WS_DMA_RX_BUFFER_SIZE);
__HAL_DMA_DISABLE_IT(&hdma_usart1_rx, DMA_IT_HT);
+ // __HAL_DMA_ENABLE_IT(&hdma_usart1_rx, DMA_IT_TC);
+ // __HAL_UART_ENABLE_IT(&huart1, UART_IT_TC);
}
static void ws_io_usart2_setup() {
@@ -191,7 +196,7 @@ void HAL_UART_MspInit(UART_HandleTypeDef *huart) {
__HAL_LINKDMA(huart, hdmatx, hdma_usart1_tx);
// USART1 interrupt Init
- HAL_NVIC_SetPriority(USART1_IRQn, 0, 0);
+ HAL_NVIC_SetPriority(USART1_IRQn, 5, 0);
HAL_NVIC_EnableIRQ(USART1_IRQn);
} else if (huart->Instance == USART2) {
__HAL_RCC_USART2_CLK_ENABLE();