diff options
author | lonkaars <loek@pipeframe.xyz> | 2022-10-26 15:51:18 +0200 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2022-10-26 15:51:18 +0200 |
commit | e2ae9e96ba05baa389ebc49a65a941bada87e3aa (patch) | |
tree | abf2df32e15d5cf7adfb4caaa8bb99f59abf9d7b /stm32f091/test.c | |
parent | fbd5ed29043c4094f1209ec8935a577f5ce9e7a6 (diff) |
dma write working
Diffstat (limited to 'stm32f091/test.c')
-rw-r--r-- | stm32f091/test.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/stm32f091/test.c b/stm32f091/test.c new file mode 100644 index 0000000..4d1b936 --- /dev/null +++ b/stm32f091/test.c @@ -0,0 +1,25 @@ +#include <stm32f0xx_hal.h> +#include <FreeRTOS.h> +#include <task.h> + +#include "setup.h" + +uint8_t tx_buffer[] = "AT\r\n"; + +void ws_test_read_task() { + uint8_t* buf; // TODO: not working + while (1) { + HAL_UART_Receive_DMA(&huart1, buf, 1); + HAL_UART_Transmit(&huart2, buf, 1, 100); + } +} + +void ws_test_write_task() { + while (1) { + HAL_UART_Transmit_DMA(&huart1, tx_buffer, sizeof(tx_buffer)); + __HAL_UART_ENABLE_IT(&huart1, UART_IT_TXE); + + HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_5); + vTaskDelay(portTICK_PERIOD_MS * 1000 * 1); + } +} |