板子是L053R8
程式寫完好像無法傳輸
不清楚問題在哪?
#include "main.h"#include "dma.h"#include "usart.h"#include "gpio.h"
void SystemClock_Config(void);
uint8_t temp1[]="hello";uint8_t temp2[8];
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart){ if (huart==&huart1) HAL_UART_Transmit_DMA(&huart1,temp2,sizeof(temp2));}void HAL_UART_TxCpltCallback(UART_HandleTypeDef *huart){ if (huart==&huart1) HAL_GPIO_TogglePin(GPIOA,GPIO_PIN_0);}
int main(void){ HAL_Init();
SystemClock_Config();
MX_GPIO_Init(); MX_USART1_UART_Init(); MX_DMA_Init(); HAL_UART_Receive_DMA(&huart1,temp2,sizeof(temp2));
while (1) { HAL_UART_Transmit_DMA(&huart1,temp1,sizeof(temp1)); HAL_Delay(1000); }