Advertisement
flyxtop

Untitled

Dec 5th, 2015
298
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 23.47 KB | None | 0 0
  1.  
  2.  
  3. #################### main.h ######################
  4. /**
  5. ******************************************************************************
  6. * @file UART/UART_Printf/Inc/main.h
  7. * @author MCD Application Team
  8. * @version V1.2.2
  9. * @date 09-October-2015
  10. * @brief Header for main.c module
  11. ******************************************************************************
  12. * @attention
  13. *
  14. * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
  15. *
  16. * Redistribution and use in source and binary forms, with or without modification,
  17. * are permitted provided that the following conditions are met:
  18. * 1. Redistributions of source code must retain the above copyright notice,
  19. * this list of conditions and the following disclaimer.
  20. * 2. Redistributions in binary form must reproduce the above copyright notice,
  21. * this list of conditions and the following disclaimer in the documentation
  22. * and/or other materials provided with the distribution.
  23. * 3. Neither the name of STMicroelectronics nor the names of its contributors
  24. * may be used to endorse or promote products derived from this software
  25. * without specific prior written permission.
  26. *
  27. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  28. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  29. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  30. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  31. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  32. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  33. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  34. * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  35. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  36. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  37. *
  38. ******************************************************************************
  39. */
  40.  
  41. /* Define to prevent recursive inclusion -------------------------------------*/
  42. #ifndef __MAIN_H
  43. #define __MAIN_H
  44.  
  45. /* Includes ------------------------------------------------------------------*/
  46. #include "stm32f4xx_hal.h"
  47. #include "stm32f4xx_nucleo.h"
  48. #include "stdio.h"
  49.  
  50. /* Exported types ------------------------------------------------------------*/
  51. /* Exported constants --------------------------------------------------------*/
  52. /* User can use this section to tailor USARTx/UARTx instance used and associated
  53. resources */
  54. /* Definition for USARTx clock resources */
  55. #define USARTx USART2
  56. #define USARTx_CLK_ENABLE() __HAL_RCC_USART2_CLK_ENABLE();
  57. #define USARTx_RX_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE()
  58. #define USARTx_TX_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE()
  59.  
  60. #define USARTx_FORCE_RESET() __HAL_RCC_USART2_FORCE_RESET()
  61. #define USARTx_RELEASE_RESET() __HAL_RCC_USART2_RELEASE_RESET()
  62.  
  63. /* Definition for USARTx Pins */
  64. #define USARTx_TX_PIN GPIO_PIN_2
  65. #define USARTx_TX_GPIO_PORT GPIOA
  66. #define USARTx_TX_AF GPIO_AF7_USART2
  67. #define USARTx_RX_PIN GPIO_PIN_3
  68. #define USARTx_RX_GPIO_PORT GPIOA
  69. #define USARTx_RX_AF GPIO_AF7_USART2
  70.  
  71. /* Exported macro ------------------------------------------------------------*/
  72. /* Exported functions ------------------------------------------------------- */
  73.  
  74. #endif /* __MAIN_H */
  75.  
  76. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
  77.  
  78.  
  79. ######################### main.c #########################
  80. /**
  81. ******************************************************************************
  82. * @file UART/UART_Printf/Src/main.c
  83. * @author MCD Application Team
  84. * @version V1.2.2
  85. * @date 09-October-2015
  86. * @brief This example shows how to retarget the C library printf function
  87. * to the UART.
  88. ******************************************************************************
  89. * @attention
  90. *
  91. * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
  92. *
  93. * Redistribution and use in source and binary forms, with or without modification,
  94. * are permitted provided that the following conditions are met:
  95. * 1. Redistributions of source code must retain the above copyright notice,
  96. * this list of conditions and the following disclaimer.
  97. * 2. Redistributions in binary form must reproduce the above copyright notice,
  98. * this list of conditions and the following disclaimer in the documentation
  99. * and/or other materials provided with the distribution.
  100. * 3. Neither the name of STMicroelectronics nor the names of its contributors
  101. * may be used to endorse or promote products derived from this software
  102. * without specific prior written permission.
  103. *
  104. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  105. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  106. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  107. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  108. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  109. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  110. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  111. * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  112. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  113. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  114. *
  115. ******************************************************************************
  116. */
  117.  
  118. /* Includes ------------------------------------------------------------------*/
  119. #include "main.h"
  120.  
  121. /** @addtogroup STM32F4xx_HAL_Examples
  122. * @{
  123. */
  124.  
  125. /** @addtogroup UART_Printf
  126. * @{
  127. */
  128.  
  129. /* Private typedef -----------------------------------------------------------*/
  130. /* Private define ------------------------------------------------------------*/
  131. /* Private macro -------------------------------------------------------------*/
  132. /* Private variables ---------------------------------------------------------*/
  133. /* UART handler declaration */
  134. UART_HandleTypeDef UartHandle;
  135.  
  136. /* Private function prototypes -----------------------------------------------*/
  137. #ifdef __GNUC__
  138. /* With GCC/RAISONANCE, small printf (option LD Linker->Libraries->Small printf
  139. set to 'Yes') calls __io_putchar() */
  140. #define PUTCHAR_PROTOTYPE int __io_putchar(int ch)
  141. #else
  142. #define PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f)
  143. #endif /* __GNUC__ */
  144. static void SystemClock_Config(void);
  145. static void Error_Handler(void);
  146.  
  147. /* Private functions ---------------------------------------------------------*/
  148.  
  149. /**
  150. * @brief Main program
  151. * @param None
  152. * @retval None
  153. */
  154.  
  155. int icnt;
  156. int main(void)
  157. {
  158. /* STM32F4xx HAL library initialization:
  159. - Configure the Flash prefetch, instruction and Data caches
  160. - Configure the Systick to generate an interrupt each 1 msec
  161. - Set NVIC Group Priority to 4
  162. - Global MSP (MCU Support Package) initialization
  163. */
  164. HAL_Init();
  165.  
  166. /* Configure the system clock to 84 MHz */
  167. SystemClock_Config();
  168.  
  169. /*##-1- Configure the UART peripheral ######################################*/
  170. /* Put the USART peripheral in the Asynchronous mode (UART Mode) */
  171. /* UART1 configured as follow:
  172. - Word Length = 8 Bits
  173. - Stop Bit = One Stop bit
  174. - Parity = ODD parity
  175. - BaudRate = 9600 baud
  176. - Hardware flow control disabled (RTS and CTS signals) */
  177. UartHandle.Instance = USARTx;
  178.  
  179. UartHandle.Init.BaudRate = 9600;
  180. UartHandle.Init.WordLength = UART_WORDLENGTH_8B;
  181. UartHandle.Init.StopBits = UART_STOPBITS_1;
  182. UartHandle.Init.Parity = UART_PARITY_ODD;
  183. UartHandle.Init.HwFlowCtl = UART_HWCONTROL_NONE;
  184. UartHandle.Init.Mode = UART_MODE_TX_RX;
  185. UartHandle.Init.OverSampling = UART_OVERSAMPLING_16;
  186.  
  187. if(HAL_UART_Init(&UartHandle) != HAL_OK)
  188. {
  189. /* Initialization Error */
  190. Error_Handler();
  191. }
  192.  
  193. /* Output a message on Hyperterminal using printf function */
  194. icnt =0;
  195. while (1) {
  196. printf("CGCG");
  197. HAL_Delay(500);
  198. icnt++;
  199. if (icnt > 1000) break;
  200. }
  201.  
  202. //printf("\n\r UART Printf Example: retarget the C library printf function to the UART\n\r");
  203.  
  204. /* Infinite loop */
  205. while (1)
  206. {
  207. }
  208. }
  209.  
  210. /**
  211. * @brief Retargets the C library printf function to the USART.
  212. * @param None
  213. * @retval None
  214. */
  215. PUTCHAR_PROTOTYPE
  216. {
  217. /* Place your implementation of fputc here */
  218. /* e.g. write a character to the EVAL_COM1 and Loop until the end of transmission */
  219.  
  220. // while( USART_GetFlagStatus(USART1, USART_FLAG_TXE) == RESET);
  221. // USART_SendData(USART1, (uint8_t) ch);
  222.  
  223. HAL_UART_Transmit(&UartHandle, (uint8_t *)&ch, 1, 0xFFFF);
  224.  
  225. return ch;
  226. }
  227.  
  228. /**
  229. * @brief System Clock Configuration
  230. * The system Clock is configured as follow :
  231. * System Clock source = PLL (HSI)
  232. * SYSCLK(Hz) = 84000000
  233. * HCLK(Hz) = 84000000
  234. * AHB Prescaler = 1
  235. * APB1 Prescaler = 2
  236. * APB2 Prescaler = 1
  237. * HSI Frequency(Hz) = 16000000
  238. * PLL_M = 16
  239. * PLL_N = 336
  240. * PLL_P = 4
  241. * PLL_Q = 7
  242. * VDD(V) = 3.3
  243. * Main regulator output voltage = Scale2 mode
  244. * Flash Latency(WS) = 2
  245. * @param None
  246. * @retval None
  247. */
  248. static void SystemClock_Config(void)
  249. {
  250. RCC_ClkInitTypeDef RCC_ClkInitStruct;
  251. RCC_OscInitTypeDef RCC_OscInitStruct;
  252.  
  253. /* Enable Power Control clock */
  254. __HAL_RCC_PWR_CLK_ENABLE();
  255.  
  256. /* The voltage scaling allows optimizing the power consumption when the device is
  257. clocked below the maximum system frequency, to update the voltage scaling value
  258. regarding system frequency refer to product datasheet. */
  259. __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE2);
  260.  
  261. /* Enable HSI Oscillator and activate PLL with HSI as source */
  262. RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
  263. RCC_OscInitStruct.HSIState = RCC_HSI_ON;
  264. RCC_OscInitStruct.HSICalibrationValue = 0x10;
  265. RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
  266. RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI;
  267. RCC_OscInitStruct.PLL.PLLM = 16;
  268. RCC_OscInitStruct.PLL.PLLN = 336;
  269. RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV4;
  270. RCC_OscInitStruct.PLL.PLLQ = 7;
  271. if(HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
  272. {
  273. Error_Handler();
  274. }
  275.  
  276. /* Select PLL as system clock source and configure the HCLK, PCLK1 and PCLK2
  277. clocks dividers */
  278. RCC_ClkInitStruct.ClockType = (RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2);
  279. RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
  280. RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
  281. RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2;
  282. RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
  283. if(HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2) != HAL_OK)
  284. {
  285. Error_Handler();
  286. }
  287. // added by ckim
  288. HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/1000);
  289. HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);
  290. /* SysTick_IRQn interrupt configuration */
  291. HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
  292. // end of addition
  293. }
  294.  
  295. /**
  296. * @brief This function is executed in case of error occurrence.
  297. * @param None
  298. * @retval None
  299. */
  300. static void Error_Handler(void)
  301. {
  302. /* Turn LED2 on */
  303. BSP_LED_On(LED2);
  304. while(1)
  305. {
  306. }
  307. }
  308.  
  309. #ifdef USE_FULL_ASSERT
  310. /**
  311. * @brief Reports the name of the source file and the source line number
  312. * where the assert_param error has occurred.
  313. * @param file: pointer to the source file name
  314. * @param line: assert_param error line source number
  315. * @retval None
  316. */
  317. void assert_failed(uint8_t* file, uint32_t line)
  318. {
  319. /* User can add his own implementation to report the file name and line number,
  320. ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
  321.  
  322. /* Infinite loop */
  323. while (1)
  324. {
  325. }
  326. }
  327. #endif
  328.  
  329. /**
  330. * @}
  331. */
  332.  
  333. /**
  334. * @}
  335. */
  336.  
  337. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
  338.  
  339.  
  340.  
  341. ################################### stm32f4xx_hal_msp.c ################################
  342. **
  343. ******************************************************************************
  344. * @file UART/UART_Printf/Src/stm32f4xx_hal_msp.c
  345. * @author MCD Application Team
  346. * @version V1.2.2
  347. * @date 09-October-2015
  348. * @brief HAL MSP module.
  349. ******************************************************************************
  350. * @attention
  351. *
  352. * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
  353. *
  354. * Redistribution and use in source and binary forms, with or without modification,
  355. * are permitted provided that the following conditions are met:
  356. * 1. Redistributions of source code must retain the above copyright notice,
  357. * this list of conditions and the following disclaimer.
  358. * 2. Redistributions in binary form must reproduce the above copyright notice,
  359. * this list of conditions and the following disclaimer in the documentation
  360. * and/or other materials provided with the distribution.
  361. * 3. Neither the name of STMicroelectronics nor the names of its contributors
  362. * may be used to endorse or promote products derived from this software
  363. * without specific prior written permission.
  364. *
  365. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  366. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  367. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  368. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  369. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  370. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  371. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  372. * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  373. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  374. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  375. *
  376. ******************************************************************************
  377. */
  378.  
  379. /* Includes ------------------------------------------------------------------*/
  380. #include "main.h"
  381.  
  382. /** @addtogroup STM32F4xx_HAL_Examples
  383. * @{
  384. */
  385.  
  386. /** @defgroup HAL_MSP
  387. * @brief HAL MSP module.
  388. * @{
  389. */
  390.  
  391. /* Private typedef -----------------------------------------------------------*/
  392. /* Private define ------------------------------------------------------------*/
  393. /* Private macro -------------------------------------------------------------*/
  394. /* Private variables ---------------------------------------------------------*/
  395. /* Private function prototypes -----------------------------------------------*/
  396. /* Private functions ---------------------------------------------------------*/
  397.  
  398. /** @defgroup HAL_MSP_Private_Functions
  399. * @{
  400. */
  401.  
  402. /**
  403. * @brief UART MSP Initialization
  404. * This function configures the hardware resources used in this example:
  405. * - Peripheral's clock enable
  406. * - Peripheral's GPIO Configuration
  407. * @param huart: UART handle pointer
  408. * @retval None
  409. */
  410. void HAL_UART_MspInit(UART_HandleTypeDef *huart)
  411. {
  412. GPIO_InitTypeDef GPIO_InitStruct;
  413.  
  414. /*##-1- Enable peripherals and GPIO Clocks #################################*/
  415. /* Enable GPIO TX/RX clock */
  416. USARTx_TX_GPIO_CLK_ENABLE();
  417. USARTx_RX_GPIO_CLK_ENABLE();
  418.  
  419. /* Enable USARTx clock */
  420. USARTx_CLK_ENABLE();
  421.  
  422. /*##-2- Configure peripheral GPIO ##########################################*/
  423. /* UART TX GPIO pin configuration */
  424. GPIO_InitStruct.Pin = USARTx_TX_PIN;
  425. GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
  426. GPIO_InitStruct.Pull = GPIO_PULLUP;
  427. GPIO_InitStruct.Speed = GPIO_SPEED_FAST;
  428. GPIO_InitStruct.Alternate = USARTx_TX_AF;
  429.  
  430. HAL_GPIO_Init(USARTx_TX_GPIO_PORT, &GPIO_InitStruct);
  431.  
  432. /* UART RX GPIO pin configuration */
  433. GPIO_InitStruct.Pin = USARTx_RX_PIN;
  434. GPIO_InitStruct.Alternate = USARTx_RX_AF;
  435.  
  436. HAL_GPIO_Init(USARTx_RX_GPIO_PORT, &GPIO_InitStruct);
  437. }
  438.  
  439. /**
  440. * @brief UART MSP De-Initialization
  441. * This function frees the hardware resources used in this example:
  442. * - Disable the Peripheral's clock
  443. * - Revert GPIO and NVIC configuration to their default state
  444. * @param huart: UART handle pointer
  445. * @retval None
  446. */
  447. void HAL_UART_MspDeInit(UART_HandleTypeDef *huart)
  448. {
  449. /*##-1- Reset peripherals ##################################################*/
  450. USARTx_FORCE_RESET();
  451. USARTx_RELEASE_RESET();
  452.  
  453. /*##-2- Disable peripherals and GPIO Clocks #################################*/
  454. /* Configure UART Tx as alternate function */
  455. HAL_GPIO_DeInit(USARTx_TX_GPIO_PORT, USARTx_TX_PIN);
  456. /* Configure UART Rx as alternate function */
  457. HAL_GPIO_DeInit(USARTx_RX_GPIO_PORT, USARTx_RX_PIN);
  458.  
  459. }
  460.  
  461. /**
  462. * @}
  463. */
  464.  
  465. /**
  466. * @}
  467. */
  468.  
  469. /**
  470. * @}
  471. */
  472.  
  473. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
  474.  
  475.  
  476.  
  477. ########################## stm32f4xx_it.c ####################################
  478. /**
  479. ******************************************************************************
  480. * @file UART/UART_Printf/Src/stm32f4xx_it.c
  481. * @author MCD Application Team
  482. * @version V1.2.2
  483. * @date 09-October-2015
  484. * @brief Main Interrupt Service Routines.
  485. * This file provides template for all exceptions handler and
  486. * peripherals interrupt service routine.
  487. ******************************************************************************
  488. * @attention
  489. *
  490. * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
  491. *
  492. * Redistribution and use in source and binary forms, with or without modification,
  493. * are permitted provided that the following conditions are met:
  494. * 1. Redistributions of source code must retain the above copyright notice,
  495. * this list of conditions and the following disclaimer.
  496. * 2. Redistributions in binary form must reproduce the above copyright notice,
  497. * this list of conditions and the following disclaimer in the documentation
  498. * and/or other materials provided with the distribution.
  499. * 3. Neither the name of STMicroelectronics nor the names of its contributors
  500. * may be used to endorse or promote products derived from this software
  501. * without specific prior written permission.
  502. *
  503. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  504. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  505. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  506. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  507. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  508. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  509. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  510. * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  511. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  512. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  513. *
  514. ******************************************************************************
  515. */
  516.  
  517. /* Includes ------------------------------------------------------------------*/
  518. #include "main.h"
  519. #include "stm32f4xx_it.h"
  520.  
  521. /** @addtogroup STM32F4xx_HAL_Examples
  522. * @{
  523. */
  524.  
  525. /** @addtogroup UART_Printf
  526. * @{
  527. */
  528.  
  529. /* Private typedef -----------------------------------------------------------*/
  530. /* Private define ------------------------------------------------------------*/
  531. /* Private macro -------------------------------------------------------------*/
  532. /* Private variables ---------------------------------------------------------*/
  533. /* Private function prototypes -----------------------------------------------*/
  534. /* Private functions ---------------------------------------------------------*/
  535.  
  536. /******************************************************************************/
  537. /* Cortex-M4 Processor Exceptions Handlers */
  538. /******************************************************************************/
  539.  
  540. /**
  541. * @brief This function handles NMI exception.
  542. * @param None
  543. * @retval None
  544. */
  545. void NMI_Handler(void)
  546. {
  547. }
  548.  
  549. /**
  550. * @brief This function handles Hard Fault exception.
  551. * @param None
  552. * @retval None
  553. */
  554. void HardFault_Handler(void)
  555. {
  556. /* Go to infinite loop when Hard Fault exception occurs */
  557. while (1)
  558. {
  559. }
  560. }
  561.  
  562. /**
  563. * @brief This function handles Memory Manage exception.
  564. * @param None
  565. * @retval None
  566. */
  567. void MemManage_Handler(void)
  568. {
  569. /* Go to infinite loop when Memory Manage exception occurs */
  570. while (1)
  571. {
  572. }
  573. }
  574.  
  575. /**
  576. * @brief This function handles Bus Fault exception.
  577. * @param None
  578. * @retval None
  579. */
  580. void BusFault_Handler(void)
  581. {
  582. /* Go to infinite loop when Bus Fault exception occurs */
  583. while (1)
  584. {
  585. }
  586. }
  587.  
  588. /**
  589. * @brief This function handles Usage Fault exception.
  590. * @param None
  591. * @retval None
  592. */
  593. void UsageFault_Handler(void)
  594. {
  595. /* Go to infinite loop when Usage Fault exception occurs */
  596. while (1)
  597. {
  598. }
  599. }
  600.  
  601. /**
  602. * @brief This function handles SVCall exception.
  603. * @param None
  604. * @retval None
  605. */
  606. void SVC_Handler(void)
  607. {
  608. }
  609.  
  610. /**
  611. * @brief This function handles Debug Monitor exception.
  612. * @param None
  613. * @retval None
  614. */
  615. void DebugMon_Handler(void)
  616. {
  617. }
  618.  
  619. /**
  620. * @brief This function handles PendSVC exception.
  621. * @param None
  622. * @retval None
  623. */
  624. void PendSV_Handler(void)
  625. {
  626. }
  627.  
  628. /**
  629. * @brief This function handles SysTick Handler.
  630. * @param None
  631. * @retval None
  632. */
  633. void SysTick_Handler(void)
  634. {
  635. /* USER CODE BEGIN SysTick_IRQn 0 */
  636.  
  637. /* USER CODE END SysTick_IRQn 0 */
  638. HAL_IncTick();
  639. HAL_SYSTICK_IRQHandler();
  640. /* USER CODE BEGIN SysTick_IRQn 1 */
  641.  
  642. /* USER CODE END SysTick_IRQn 1 */
  643. }
  644.  
  645. /******************************************************************************/
  646. /* STM32F4xx Peripherals Interrupt Handlers */
  647. /* Add here the Interrupt Handler for the used peripheral(s) (PPP), for the */
  648. /* available peripheral interrupt handler's name please refer to the startup */
  649. /* file (startup_stm32f4xx.s). */
  650. /******************************************************************************/
  651. /**
  652. * @brief This function handles PPP interrupt request.
  653. * @param None
  654. * @retval None
  655. */
  656. /*void PPP_IRQHandler(void)
  657. {
  658. }*/
  659.  
  660.  
  661. /**
  662. * @}
  663. */
  664.  
  665. /**
  666. * @}
  667. */
  668.  
  669. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement