Direct Memory Access:直接存储器访问 是所有现代计算设备的重要特色,它允许不同速度的硬件装置来沟通,而不需要依赖于CPU的大量中断负载。否则,CPU需要从来源把每一片段的资料复制到暂存器,然后把它们再次写回到新的地方。在这个时间中,CPU对于其他的工作来说就无法使用。DMA传输将数据从一个地址空间复制到另外一个地址空间。当CPU初始化这个传输动作,传输动作本身是由DMA控制器来实行和完成。典型的例子就是移动一个外部内存的区块到芯片内部更快的内存区。像是这样的操作并没有让处理器工作拖延,反而可以被重新排程去处理其他的工作。DMA传输是高效能嵌入式系统算法和网络最关键的部分。
/* Includes ------------------------------------------------------------------*/ #include"main.h"
/* Private includes ----------------------------------------------------------*/ /* USER CODE BEGIN Includes */ #include"string.h" /* USER CODE END Includes */
/* Private typedef -----------------------------------------------------------*/ /* USER CODE BEGIN PTD */
/* USER CODE END PTD */
/* Private define ------------------------------------------------------------*/ /* USER CODE BEGIN PD */ /* USER CODE END PD */
/* Private macro -------------------------------------------------------------*/ /* USER CODE BEGIN PM */
/* Private function prototypes -----------------------------------------------*/ voidSystemClock_Config(void); staticvoidMX_GPIO_Init(void); staticvoidMX_DMA_Init(void); staticvoidMX_UART7_Init(void); /* USER CODE BEGIN PFP */
/* USER CODE END PFP */
/* Private user code ---------------------------------------------------------*/ /* USER CODE BEGIN 0 */ char msg[]="\r\n" " %@@@@@@@#\r\n" " .(&@&, &@@@@@@@% *@@&(\r\n" " %@@@@@@@@%%&@@@@@@@@@@@@@@@@@@@&%&@@@@@@@@#\r\n" " &@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%\r\n" " #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@/\r\n" " ,. .&@@@@@@@@@@@@@&(. ,(&@@@@@@@@@@@@@&. .,\r\n" " &@@@@&@@@@@@@@@@@&, ###%#%%%%#%%%#### *&@@@@@@@@@@@&@@@@%\r\n" " /@@@@@@@@@@@@@@@& ,@@@@@@@@&. .&@@@@@@@@@@@@@@@,\r\n" " (&@@@@@@@@@@@@@# (@@@@@@@/ %@@@@@@@@@@@@@&*\r\n" " &@@@@@@@@&. ,%@@@@&@@@@@@@&@@@&%, ,&@@@@@@@@%\r\n" " /@@@@@@@@% #@@@@@( *@@@@@@&, %@@@@&( &@@@@@@@@/\r\n" " .&@@@@@@@% #@@@@@% *@@@@@@&, &@@@@@# &@@@@@@@&. # \"There is no truth in flesh, only betrayal.\"\r\n" " ,%%%%&@@@@@@@@* &@@@@@% *@@@@@@&, %@@@@@% ,@@@@@@@@&%%%% # \"There is no strength in flesh, only weakness.\"\r\n" " /@@@@@@@@@@@@&. #@@@@@@, *@@@@@@&, ,@@@@@@( .&@@@@@@@@@@@&, # \"There is no constancy in flesh, only decay .\"\r\n" " /@@@@@@@@@@@@& %@@@@@@, *@@@@@@&, ,@@@@@@# .&@@@@@@@@@@@&, # \"There is no certainty in flesh, but death .\"\r\n" " *&@@@@@@@@@@@&, .@@@@@@# *@@@@@@&, %@@@@@& ,@@@@@@@@@@@@&. # — Credo Omnissiah\r\n" " .&@@@@@@@# .&@@@@@( *@@@@@@&, %@@@@@& %@@@@@@@&.\r\n" " (@@@@@@@@( ,&@@@@&. *@@@@@@&, *&@@@@%. #@@@@@@@@( Welcome back to Adeptus Mechanicus, Alchemic Ronin!\r\n" " %@@@@@@@@% .%@@@@&%@@@@@@@%&@@@@#. %@@@@@@@@%\r\n" " .(&@@@@@@@@@@@@, *%@@@@@@@%* (@@@@@@@@@@@@&/\r\n" " %@@@@@@@@@@@@@@@/ .(@@@@@@@@@(. #@@@@@@@@@@@@@@@#\r\n" " .&@@@@@@@@@@@@@@@@( ,***************, #&@@@@@@@@@@@@@@@&.\r\n" " %( #@@@@@@@@@@@@@%*. ./&@@@@@@@@@@@@@/ .##\r\n" " .&@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%.\r\n" " #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@(\r\n" " &@@@@@@@@@&@@@@@@@@@@@@@@@@@@@@@&@@@@@@@@@%\r\n" " /&@@@/ .*&@@@@@@@&,. (@@@&/\r\n" " %@@@@@@@#\r\n" " .,,,,,,,.\r\n" "\r\n"; /* USER CODE END 0 */
/** * @brief The application entry point. * @retval int */ intmain(void) { /* USER CODE BEGIN 1 */
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */ HAL_Init();
/* USER CODE BEGIN Init */
/* USER CODE END Init */
/* Configure the system clock */ SystemClock_Config();
/* USER CODE BEGIN SysInit */
/* USER CODE END SysInit */
/* Initialize all configured peripherals */ MX_GPIO_Init(); MX_DMA_Init(); MX_UART7_Init(); /* USER CODE BEGIN 2 */ HAL_GPIO_WritePin(LD_RED_GPIO_Port,LD_RED_Pin,GPIO_PIN_SET); /* USER CODE END 2 */
/* Infinite loop */ /* USER CODE BEGIN WHILE */ while (1) { /* USER CODE END WHILE */
/* USER CODE BEGIN 4 */ voidHAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin){ if(GPIO_Pin == Button_Pin){ HAL_Delay(500); HAL_DMA_Start(&hdma_uart7_tx,(uint32_t)msg,(uint32_t)&huart7.Instance->DR,strlen(msg)); huart7.Instance->CR3|=USART_CR3_DMAT; HAL_DMA_PollForTransfer(&hdma_uart7_tx,HAL_DMA_FULL_TRANSFER,HAL_MAX_DELAY); huart7.Instance->CR3&=~USART_CR3_DMAT; HAL_GPIO_TogglePin(LD_RED_GPIO_Port,LD_RED_Pin); HAL_Delay(200); HAL_GPIO_TogglePin(LD_RED_GPIO_Port,LD_RED_Pin); } } /* USER CODE END 4 */
/** * @brief This function is executed in case of error occurrence. * @retval None */ voidError_Handler(void) { /* USER CODE BEGIN Error_Handler_Debug */ /* User can add his own implementation to report the HAL error return state */
/* USER CODE END Error_Handler_Debug */ }
#ifdef USE_FULL_ASSERT /** * @brief Reports the name of the source file and the source line number * where the assert_param error has occurred. * @param file: pointer to the source file name * @param line: assert_param error line source number * @retval None */ voidassert_failed(uint8_t *file, uint32_t line) { /* USER CODE BEGIN 6 */ /* User can add his own implementation to report the file name and line number, tex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */ /* USER CODE END 6 */ } #endif/* USE_FULL_ASSERT */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
/* Includes ------------------------------------------------------------------*/ #include"main.h"
/* Private includes ----------------------------------------------------------*/ /* USER CODE BEGIN Includes */ #include"string.h" /* USER CODE END Includes */
/* Private typedef -----------------------------------------------------------*/ /* USER CODE BEGIN PTD */
/* USER CODE END PTD */
/* Private define ------------------------------------------------------------*/ /* USER CODE BEGIN PD */ /* USER CODE END PD */
/* Private macro -------------------------------------------------------------*/ /* USER CODE BEGIN PM */
/* Private function prototypes -----------------------------------------------*/ voidSystemClock_Config(void); staticvoidMX_GPIO_Init(void); staticvoidMX_DMA_Init(void); staticvoidMX_UART7_Init(void); /* USER CODE BEGIN PFP */
/* USER CODE END PFP */
/* Private user code ---------------------------------------------------------*/ /* USER CODE BEGIN 0 */ char msg[]="\r\n" " %@@@@@@@#\r\n" " .(&@&, &@@@@@@@% *@@&(\r\n" " %@@@@@@@@%%&@@@@@@@@@@@@@@@@@@@&%&@@@@@@@@#\r\n" " &@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%\r\n" " #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@/\r\n" " ,. .&@@@@@@@@@@@@@&(. ,(&@@@@@@@@@@@@@&. .,\r\n" " &@@@@&@@@@@@@@@@@&, ###%#%%%%#%%%#### *&@@@@@@@@@@@&@@@@%\r\n" " /@@@@@@@@@@@@@@@& ,@@@@@@@@&. .&@@@@@@@@@@@@@@@,\r\n" " (&@@@@@@@@@@@@@# (@@@@@@@/ %@@@@@@@@@@@@@&*\r\n" " &@@@@@@@@&. ,%@@@@&@@@@@@@&@@@&%, ,&@@@@@@@@%\r\n" " /@@@@@@@@% #@@@@@( *@@@@@@&, %@@@@&( &@@@@@@@@/\r\n" " .&@@@@@@@% #@@@@@% *@@@@@@&, &@@@@@# &@@@@@@@&. # \"There is no truth in flesh, only betrayal.\"\r\n" " ,%%%%&@@@@@@@@* &@@@@@% *@@@@@@&, %@@@@@% ,@@@@@@@@&%%%% # \"There is no strength in flesh, only weakness.\"\r\n" " /@@@@@@@@@@@@&. #@@@@@@, *@@@@@@&, ,@@@@@@( .&@@@@@@@@@@@&, # \"There is no constancy in flesh, only decay .\"\r\n" " /@@@@@@@@@@@@& %@@@@@@, *@@@@@@&, ,@@@@@@# .&@@@@@@@@@@@&, # \"There is no certainty in flesh, but death .\"\r\n" " *&@@@@@@@@@@@&, .@@@@@@# *@@@@@@&, %@@@@@& ,@@@@@@@@@@@@&. # — Credo Omnissiah\r\n" " .&@@@@@@@# .&@@@@@( *@@@@@@&, %@@@@@& %@@@@@@@&.\r\n" " (@@@@@@@@( ,&@@@@&. *@@@@@@&, *&@@@@%. #@@@@@@@@( Welcome back to Adeptus Mechanicus, Alchemic Ronin!\r\n" " %@@@@@@@@% .%@@@@&%@@@@@@@%&@@@@#. %@@@@@@@@%\r\n" " .(&@@@@@@@@@@@@, *%@@@@@@@%* (@@@@@@@@@@@@&/\r\n" " %@@@@@@@@@@@@@@@/ .(@@@@@@@@@(. #@@@@@@@@@@@@@@@#\r\n" " .&@@@@@@@@@@@@@@@@( ,***************, #&@@@@@@@@@@@@@@@&.\r\n" " %( #@@@@@@@@@@@@@%*. ./&@@@@@@@@@@@@@/ .##\r\n" " .&@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%.\r\n" " #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@(\r\n" " &@@@@@@@@@&@@@@@@@@@@@@@@@@@@@@@&@@@@@@@@@%\r\n" " /&@@@/ .*&@@@@@@@&,. (@@@&/\r\n" " %@@@@@@@#\r\n" " .,,,,,,,.\r\n" "\r\n"; /* USER CODE END 0 */
/** * @brief The application entry point. * @retval int */ intmain(void) { /* USER CODE BEGIN 1 */
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */ HAL_Init();
/* USER CODE BEGIN Init */
/* USER CODE END Init */
/* Configure the system clock */ SystemClock_Config();
/* USER CODE BEGIN SysInit */
/* USER CODE END SysInit */
/* Initialize all configured peripherals */ MX_GPIO_Init(); MX_DMA_Init(); MX_UART7_Init(); /* USER CODE BEGIN 2 */ HAL_GPIO_WritePin(LD_RED_GPIO_Port,LD_RED_Pin,GPIO_PIN_SET); /* USER CODE END 2 */
/* Infinite loop */ /* USER CODE BEGIN WHILE */ while (1) { /* USER CODE END WHILE */
/* USER CODE BEGIN 4 */ voidHAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin){ if(GPIO_Pin == Button_Pin){ HAL_Delay(500); HAL_DMA_Start_IT(&hdma_uart7_tx,(uint32_t)msg,(uint32_t)&huart7.Instance->DR,strlen(msg)); huart7.Instance->CR3|=USART_CR3_DMAT; } }
voidXferCpltCallback(DMA_HandleTypeDef *hdma){ if(hdma->Instance == DMA1_Stream1){ huart7.Instance->CR3&=~USART_CR3_DMAT; HAL_GPIO_TogglePin(LD_RED_GPIO_Port,LD_RED_Pin); HAL_Delay(200); HAL_GPIO_TogglePin(LD_RED_GPIO_Port,LD_RED_Pin); } } /* USER CODE END 4 */
/** * @brief This function is executed in case of error occurrence. * @retval None */ voidError_Handler(void) { /* USER CODE BEGIN Error_Handler_Debug */ /* User can add his own implementation to report the HAL error return state */
/* USER CODE END Error_Handler_Debug */ }
#ifdef USE_FULL_ASSERT /** * @brief Reports the name of the source file and the source line number * where the assert_param error has occurred. * @param file: pointer to the source file name * @param line: assert_param error line source number * @retval None */ voidassert_failed(uint8_t *file, uint32_t line) { /* USER CODE BEGIN 6 */ /* User can add his own implementation to report the file name and line number, tex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */ /* USER CODE END 6 */ } #endif/* USE_FULL_ASSERT */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
/* Includes ------------------------------------------------------------------*/ #include"main.h"
/* Private includes ----------------------------------------------------------*/ /* USER CODE BEGIN Includes */ #include"string.h" /* USER CODE END Includes */
/* Private typedef -----------------------------------------------------------*/ /* USER CODE BEGIN PTD */
/* USER CODE END PTD */
/* Private define ------------------------------------------------------------*/ /* USER CODE BEGIN PD */ /* USER CODE END PD */
/* Private macro -------------------------------------------------------------*/ /* USER CODE BEGIN PM */
/* Private function prototypes -----------------------------------------------*/ voidSystemClock_Config(void); staticvoidMX_GPIO_Init(void); staticvoidMX_DMA_Init(void); staticvoidMX_UART7_Init(void); /* USER CODE BEGIN PFP */
/* USER CODE END PFP */
/* Private user code ---------------------------------------------------------*/ /* USER CODE BEGIN 0 */ char msg[]="\r\n" " %@@@@@@@#\r\n" " .(&@&, &@@@@@@@% *@@&(\r\n" " %@@@@@@@@%%&@@@@@@@@@@@@@@@@@@@&%&@@@@@@@@#\r\n" " &@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%\r\n" " #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@/\r\n" " ,. .&@@@@@@@@@@@@@&(. ,(&@@@@@@@@@@@@@&. .,\r\n" " &@@@@&@@@@@@@@@@@&, ###%#%%%%#%%%#### *&@@@@@@@@@@@&@@@@%\r\n" " /@@@@@@@@@@@@@@@& ,@@@@@@@@&. .&@@@@@@@@@@@@@@@,\r\n" " (&@@@@@@@@@@@@@# (@@@@@@@/ %@@@@@@@@@@@@@&*\r\n" " &@@@@@@@@&. ,%@@@@&@@@@@@@&@@@&%, ,&@@@@@@@@%\r\n" " /@@@@@@@@% #@@@@@( *@@@@@@&, %@@@@&( &@@@@@@@@/\r\n" " .&@@@@@@@% #@@@@@% *@@@@@@&, &@@@@@# &@@@@@@@&. # \"There is no truth in flesh, only betrayal.\"\r\n" " ,%%%%&@@@@@@@@* &@@@@@% *@@@@@@&, %@@@@@% ,@@@@@@@@&%%%% # \"There is no strength in flesh, only weakness.\"\r\n" " /@@@@@@@@@@@@&. #@@@@@@, *@@@@@@&, ,@@@@@@( .&@@@@@@@@@@@&, # \"There is no constancy in flesh, only decay .\"\r\n" " /@@@@@@@@@@@@& %@@@@@@, *@@@@@@&, ,@@@@@@# .&@@@@@@@@@@@&, # \"There is no certainty in flesh, but death .\"\r\n" " *&@@@@@@@@@@@&, .@@@@@@# *@@@@@@&, %@@@@@& ,@@@@@@@@@@@@&. # — Credo Omnissiah\r\n" " .&@@@@@@@# .&@@@@@( *@@@@@@&, %@@@@@& %@@@@@@@&.\r\n" " (@@@@@@@@( ,&@@@@&. *@@@@@@&, *&@@@@%. #@@@@@@@@( Welcome back to Adeptus Mechanicus, Alchemic Ronin!\r\n" " %@@@@@@@@% .%@@@@&%@@@@@@@%&@@@@#. %@@@@@@@@%\r\n" " .(&@@@@@@@@@@@@, *%@@@@@@@%* (@@@@@@@@@@@@&/\r\n" " %@@@@@@@@@@@@@@@/ .(@@@@@@@@@(. #@@@@@@@@@@@@@@@#\r\n" " .&@@@@@@@@@@@@@@@@( ,***************, #&@@@@@@@@@@@@@@@&.\r\n" " %( #@@@@@@@@@@@@@%*. ./&@@@@@@@@@@@@@/ .##\r\n" " .&@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%.\r\n" " #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@(\r\n" " &@@@@@@@@@&@@@@@@@@@@@@@@@@@@@@@&@@@@@@@@@%\r\n" " /&@@@/ .*&@@@@@@@&,. (@@@&/\r\n" " %@@@@@@@#\r\n" " .,,,,,,,.\r\n" "\r\n"; /* USER CODE END 0 */
/** * @brief The application entry point. * @retval int */ intmain(void) { /* USER CODE BEGIN 1 */
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */ HAL_Init();
/* USER CODE BEGIN Init */
/* USER CODE END Init */
/* Configure the system clock */ SystemClock_Config();
/* USER CODE BEGIN SysInit */
/* USER CODE END SysInit */
/* Initialize all configured peripherals */ MX_GPIO_Init(); MX_DMA_Init(); MX_UART7_Init(); /* USER CODE BEGIN 2 */ HAL_GPIO_WritePin(LD_RED_GPIO_Port,LD_RED_Pin,GPIO_PIN_SET); /* USER CODE END 2 */
/* Infinite loop */ /* USER CODE BEGIN WHILE */ while (1) { /* USER CODE END WHILE */
/* USER CODE BEGIN 4 */ voidHAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin){ if(GPIO_Pin == Button_Pin){ HAL_Delay(500); HAL_UART_Transmit_DMA(&huart7,(uint8_t*)msg,strlen(msg)); } }
voidHAL_UART_TxCpltCallback(UART_HandleTypeDef *huart){ HAL_GPIO_TogglePin(LD_RED_GPIO_Port,LD_RED_Pin); HAL_Delay(200); HAL_GPIO_TogglePin(LD_RED_GPIO_Port,LD_RED_Pin); } /* USER CODE END 4 */
/** * @brief This function is executed in case of error occurrence. * @retval None */ voidError_Handler(void) { /* USER CODE BEGIN Error_Handler_Debug */ /* User can add his own implementation to report the HAL error return state */
/* USER CODE END Error_Handler_Debug */ }
#ifdef USE_FULL_ASSERT /** * @brief Reports the name of the source file and the source line number * where the assert_param error has occurred. * @param file: pointer to the source file name * @param line: assert_param error line source number * @retval None */ voidassert_failed(uint8_t *file, uint32_t line) { /* USER CODE BEGIN 6 */ /* User can add his own implementation to report the file name and line number, tex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */ /* USER CODE END 6 */ } #endif/* USE_FULL_ASSERT */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
/* Includes ------------------------------------------------------------------*/ #include"main.h"
/* Private includes ----------------------------------------------------------*/ /* USER CODE BEGIN Includes */ #include"string.h" #include"stdbool.h" /* USER CODE END Includes */
/* Private typedef -----------------------------------------------------------*/ /* USER CODE BEGIN PTD */
/* USER CODE END PTD */
/* Private define ------------------------------------------------------------*/ /* USER CODE BEGIN PD */ /* USER CODE END PD */
/* Private macro -------------------------------------------------------------*/ /* USER CODE BEGIN PM */
/* Private function prototypes -----------------------------------------------*/ voidSystemClock_Config(void); staticvoidMX_GPIO_Init(void); staticvoidMX_DMA_Init(void); staticvoidMX_UART7_Init(void); /* USER CODE BEGIN PFP */
/* USER CODE END PFP */
/* Private user code ---------------------------------------------------------*/ /* USER CODE BEGIN 0 */ char msg[]="\r\n" " %@@@@@@@#\r\n" " .(&@&, &@@@@@@@% *@@&(\r\n" " %@@@@@@@@%%&@@@@@@@@@@@@@@@@@@@&%&@@@@@@@@#\r\n" " &@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%\r\n" " #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@/\r\n" " ,. .&@@@@@@@@@@@@@&(. ,(&@@@@@@@@@@@@@&. .,\r\n" " &@@@@&@@@@@@@@@@@&, ###%#%%%%#%%%#### *&@@@@@@@@@@@&@@@@%\r\n" " /@@@@@@@@@@@@@@@& ,@@@@@@@@&. .&@@@@@@@@@@@@@@@,\r\n" " (&@@@@@@@@@@@@@# (@@@@@@@/ %@@@@@@@@@@@@@&*\r\n" " &@@@@@@@@&. ,%@@@@&@@@@@@@&@@@&%, ,&@@@@@@@@%\r\n" " /@@@@@@@@% #@@@@@( *@@@@@@&, %@@@@&( &@@@@@@@@/\r\n" " .&@@@@@@@% #@@@@@% *@@@@@@&, &@@@@@# &@@@@@@@&. # \"There is no truth in flesh, only betrayal.\"\r\n" " ,%%%%&@@@@@@@@* &@@@@@% *@@@@@@&, %@@@@@% ,@@@@@@@@&%%%% # \"There is no strength in flesh, only weakness.\"\r\n" " /@@@@@@@@@@@@&. #@@@@@@, *@@@@@@&, ,@@@@@@( .&@@@@@@@@@@@&, # \"There is no constancy in flesh, only decay .\"\r\n" " /@@@@@@@@@@@@& %@@@@@@, *@@@@@@&, ,@@@@@@# .&@@@@@@@@@@@&, # \"There is no certainty in flesh, but death .\"\r\n" " *&@@@@@@@@@@@&, .@@@@@@# *@@@@@@&, %@@@@@& ,@@@@@@@@@@@@&. # — Credo Omnissiah\r\n" " .&@@@@@@@# .&@@@@@( *@@@@@@&, %@@@@@& %@@@@@@@&.\r\n" " (@@@@@@@@( ,&@@@@&. *@@@@@@&, *&@@@@%. #@@@@@@@@( Welcome back to Adeptus Mechanicus, Alchemic Ronin!\r\n" " %@@@@@@@@% .%@@@@&%@@@@@@@%&@@@@#. %@@@@@@@@%\r\n" " .(&@@@@@@@@@@@@, *%@@@@@@@%* (@@@@@@@@@@@@&/\r\n" " %@@@@@@@@@@@@@@@/ .(@@@@@@@@@(. #@@@@@@@@@@@@@@@#\r\n" " .&@@@@@@@@@@@@@@@@( ,***************, #&@@@@@@@@@@@@@@@&.\r\n" " %( #@@@@@@@@@@@@@%*. ./&@@@@@@@@@@@@@/ .##\r\n" " .&@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%.\r\n" " #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@(\r\n" " &@@@@@@@@@&@@@@@@@@@@@@@@@@@@@@@&@@@@@@@@@%\r\n" " /&@@@/ .*&@@@@@@@&,. (@@@&/\r\n" " %@@@@@@@#\r\n" " .,,,,,,,.\r\n" "\r\n"; uint8_t data[1]; bool flag=false; /* USER CODE END 0 */
/** * @brief The application entry point. * @retval int */ intmain(void) { /* USER CODE BEGIN 1 */
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */ HAL_Init();
/* USER CODE BEGIN Init */
/* USER CODE END Init */
/* Configure the system clock */ SystemClock_Config();
/* USER CODE BEGIN SysInit */
/* USER CODE END SysInit */
/* Initialize all configured peripherals */ MX_GPIO_Init(); MX_DMA_Init(); MX_UART7_Init(); /* USER CODE BEGIN 2 */ HAL_GPIO_WritePin(LD_RED_GPIO_Port,LD_RED_Pin,GPIO_PIN_SET); HAL_GPIO_WritePin(LD_GREEN_GPIO_Port,LD_GREEN_Pin,GPIO_PIN_SET); HAL_UART_Receive_DMA(&huart7,data,1); /* USER CODE END 2 */
/* Infinite loop */ /* USER CODE BEGIN WHILE */ while (1) { /* USER CODE END WHILE */
voidHAL_UART_RxCpltCallback(UART_HandleTypeDef *huart){ HAL_UART_Transmit_DMA(&huart7,data,1); HAL_UART_Receive_DMA(&huart7,data,1); } /* USER CODE END 4 */
/** * @brief This function is executed in case of error occurrence. * @retval None */ voidError_Handler(void) { /* USER CODE BEGIN Error_Handler_Debug */ /* User can add his own implementation to report the HAL error return state */
/* USER CODE END Error_Handler_Debug */ }
#ifdef USE_FULL_ASSERT /** * @brief Reports the name of the source file and the source line number * where the assert_param error has occurred. * @param file: pointer to the source file name * @param line: assert_param error line source number * @retval None */ voidassert_failed(uint8_t *file, uint32_t line) { /* USER CODE BEGIN 6 */ /* User can add his own implementation to report the file name and line number, tex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */ /* USER CODE END 6 */ } #endif/* USE_FULL_ASSERT */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/