Advertisement
nontawat1996

Lab6-extra

Mar 2nd, 2016
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 16.90 KB | None | 0 0
  1. /*
  2. -------------------------------------------------------------------------
  3. /**
  4.   ******************************************************************************
  5.   * @file    stm32f1xx_it.c
  6.   * @brief   Interrupt Service Routines.
  7.   ******************************************************************************
  8.   *
  9.   * COPYRIGHT(c) 2016 STMicroelectronics
  10.   *
  11.   * Redistribution and use in source and binary forms, with or without modification,
  12.   * are permitted provided that the following conditions are met:
  13.   *   1. Redistributions of source code must retain the above copyright notice,
  14.   *      this list of conditions and the following disclaimer.
  15.   *   2. Redistributions in binary form must reproduce the above copyright notice,
  16.   *      this list of conditions and the following disclaimer in the documentation
  17.   *      and/or other materials provided with the distribution.
  18.   *   3. Neither the name of STMicroelectronics nor the names of its contributors
  19.   *      may be used to endorse or promote products derived from this software
  20.   *      without specific prior written permission.
  21.   *
  22.   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  23.   * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  24.   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  25.   * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  26.   * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  27.   * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  28.   * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  29.   * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  30.   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  31.   * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  32.   *
  33.   ******************************************************************************
  34.   */
  35. /* Includes ------------------------------------------------------------------*/
  36. #include "stm32f1xx_hal.h"
  37. #include "stm32f1xx.h"
  38. #include "stm32f1xx_it.h"
  39.  
  40. /* USER CODE BEGIN 0 */
  41. #include "string.h"
  42. extern uint32_t count;
  43. extern UART_HandleTypeDef huart2;
  44. extern int Emp[3];
  45. extern int Customer[12];
  46. extern int NEmp, tempEmp[3];
  47. extern int P1, P2, P3;
  48. extern char Newline[];
  49. /* USER CODE END 0 */
  50.  
  51. /* External variables --------------------------------------------------------*/
  52. extern TIM_HandleTypeDef htim1;
  53. extern TIM_HandleTypeDef htim2;
  54. extern TIM_HandleTypeDef htim3;
  55. void displayNumber(void);
  56. /******************************************************************************/
  57. /*            Cortex-M3 Processor Interruption and Exception Handlers         */
  58. /******************************************************************************/
  59.  
  60. /**
  61. * @brief This function handles System tick timer.
  62. */
  63. void SysTick_Handler(void)
  64. {
  65.   /* USER CODE BEGIN SysTick_IRQn 0 */
  66.  
  67.   /* USER CODE END SysTick_IRQn 0 */
  68.   HAL_IncTick();
  69.   HAL_SYSTICK_IRQHandler();
  70.   /* USER CODE BEGIN SysTick_IRQn 1 */
  71.  
  72.   /* USER CODE END SysTick_IRQn 1 */
  73. }
  74.  
  75. /******************************************************************************/
  76. /* STM32F1xx Peripheral Interrupt Handlers                                    */
  77. /* Add here the Interrupt Handlers for the used peripherals.                  */
  78. /* For the available peripheral interrupt handler names,                      */
  79. /* please refer to the startup file (startup_stm32f1xx.s).                    */
  80. /******************************************************************************/
  81.  
  82. /**
  83. * @brief This function handles TIM1 update interrupt.
  84. */
  85. void TIM1_UP_IRQHandler(void)
  86. {
  87.   /* USER CODE BEGIN TIM1_UP_IRQn 0 */
  88.   if (P1 == 0)
  89.   {
  90.     char Time1Queue[] = "timer1 doing que : ";
  91.     displayNumber();
  92.     HAL_UART_Transmit(&huart2, (uint8_t*) Time1Queue, strlen(Time1Queue),1000);
  93.     int i;
  94.     for (i = 0; i < 12; ++i)
  95.     {
  96.       if (Customer[i] != 0)
  97.       {
  98.         break;
  99.       }
  100.     }
  101.  
  102.     char Outstr[20];
  103.     sprintf(Outstr, "%d", Customer[i]);
  104.     HAL_UART_Transmit(&huart2, (uint8_t*) Outstr, strlen(Outstr),1000);
  105.     HAL_UART_Transmit(&huart2, (uint8_t*) Newline, strlen(Newline),1000);
  106.     P1 = Customer[i] * Emp[0];
  107.  
  108.     Customer[i] = 0;
  109.   }
  110.   /* USER CODE END TIM1_UP_IRQn 0 */
  111.   HAL_TIM_IRQHandler(&htim1);
  112.   /* USER CODE BEGIN TIM1_UP_IRQn 1 */
  113.   count++;
  114.   if (count%1000==0)
  115.   {
  116.     P1--;
  117.     P2--;
  118.     P3--;
  119.  
  120.     if (P1 == 0)
  121.     {
  122.       char Time1Queue[] = "timer1 done";
  123.       displayNumber();
  124.       HAL_UART_Transmit(&huart2, (uint8_t*) Time1Queue, strlen(Time1Queue),1000);
  125.       HAL_UART_Transmit(&huart2, (uint8_t*) Newline, strlen(Newline),1000);
  126.     }
  127.  
  128.     if (P2 == 0)
  129.     {
  130.       char Time2Queue[] = "timer2 done";
  131.       displayNumber();
  132.       HAL_UART_Transmit(&huart2, (uint8_t*) Time2Queue, strlen(Time2Queue),1000);
  133.       HAL_UART_Transmit(&huart2, (uint8_t*) Newline, strlen(Newline),1000);
  134.     }
  135.  
  136.     if (P3 == 0)
  137.     {
  138.       char Time3Queue[] = "timer3 done";
  139.       displayNumber();
  140.       HAL_UART_Transmit(&huart2, (uint8_t*) Time3Queue, strlen(Time3Queue),1000);
  141.       HAL_UART_Transmit(&huart2, (uint8_t*) Newline, strlen(Newline),1000);
  142.     }
  143.   }
  144.   /* USER CODE END TIM1_UP_IRQn 1 */
  145. }
  146.  
  147. /**
  148. * @brief This function handles TIM2 global interrupt.
  149. */
  150. void TIM2_IRQHandler(void)
  151. {
  152.   /* USER CODE BEGIN TIM2_IRQn 0 */
  153.   HAL_UART_Transmit(&huart2, (uint8_t*) "\r", 1,1000);
  154.   /* USER CODE END TIM2_IRQn 0 */
  155.   HAL_TIM_IRQHandler(&htim2);
  156.   /* USER CODE BEGIN TIM2_IRQn 1 */
  157.   if (P2 == 0)
  158.   {
  159.     char Time2Queue[] = "timer2 doing que : ";
  160.     displayNumber();
  161.     HAL_UART_Transmit(&huart2, (uint8_t*) Time2Queue, strlen(Time2Queue),1000);
  162.     int i;
  163.     for (i = 0; i < 12; ++i)
  164.     {
  165.       if (Customer[i] != 0)
  166.       {
  167.         break;
  168.       }
  169.     }
  170.  
  171.     char Outstr[20];
  172.     sprintf(Outstr, "%d", Customer[i]);
  173.     HAL_UART_Transmit(&huart2, (uint8_t*) Outstr, strlen(Outstr),1000);
  174.     HAL_UART_Transmit(&huart2, (uint8_t*) Newline, strlen(Newline),1000);
  175.     P2 = Customer[i] * Emp[1];
  176.  
  177.     Customer[i] = 0;
  178.   }
  179.   /* USER CODE END TIM2_IRQn 1 */
  180. }
  181.  
  182. /**
  183. * @brief This function handles TIM3 global interrupt.
  184. */
  185. void TIM3_IRQHandler(void)
  186. {
  187.   /* USER CODE BEGIN TIM3_IRQn 0 */
  188.  
  189.   /* USER CODE END TIM3_IRQn 0 */
  190.   HAL_TIM_IRQHandler(&htim3);
  191.   /* USER CODE BEGIN TIM3_IRQn 1 */
  192.   if (P3 == 0)
  193.   {
  194.     char Time3Queue[] = "timer3 doing que : ";
  195.     displayNumber();
  196.     HAL_UART_Transmit(&huart2, (uint8_t*) Time3Queue, strlen(Time3Queue),1000);
  197.     int i;
  198.     for (i = 0; i < 12; ++i)
  199.     {
  200.       if (Customer[i] != 0)
  201.       {
  202.         break;
  203.       }
  204.     }
  205.  
  206.     char Outstr[20];
  207.     sprintf(Outstr, "%d", Customer[i]);
  208.     HAL_UART_Transmit(&huart2, (uint8_t*) Outstr, strlen(Outstr),1000);
  209.     HAL_UART_Transmit(&huart2, (uint8_t*) Newline, strlen(Newline),1000);
  210.     P3 = Customer[i] * Emp[2];
  211.  
  212.     Customer[i] = 0;
  213.   }
  214.   /* USER CODE END TIM3_IRQn 1 */
  215. }
  216.  
  217. /* USER CODE BEGIN 1 */
  218. void displayNumber() {
  219.  
  220.   char strMM[20], strmm[20], Output[50]="\0";
  221.   int MM, mm;
  222.   MM = count/1000;
  223.   mm = count/10;
  224.  
  225.   sprintf(strMM, "%d", MM);
  226.   sprintf(strmm, "%d", mm);
  227.  
  228.   if (MM<10)
  229.   {
  230.     strcat(Output, "0");
  231.   }
  232.   strcat(Output, strMM);
  233.   strcat(Output, ":");
  234.   if (mm<10)
  235.   {
  236.     strcat(Output, "0");
  237.   }
  238.   strcat(Output, strmm);
  239.  
  240.   HAL_UART_Transmit(&huart2, (uint8_t*) Output, strlen(Output),1000);
  241. }
  242. /* USER CODE END 1 */
  243. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
  244. --------------------------------------------------------------------------
  245. */
  246.  
  247. /**
  248.   ******************************************************************************
  249.   * File Name          : main.c
  250.   * Description        : Main program body
  251.   ******************************************************************************
  252.   *
  253.   * COPYRIGHT(c) 2016 STMicroelectronics
  254.   *
  255.   * Redistribution and use in source and binary forms, with or without modification,
  256.   * are permitted provided that the following conditions are met:
  257.   *   1. Redistributions of source code must retain the above copyright notice,
  258.   *      this list of conditions and the following disclaimer.
  259.   *   2. Redistributions in binary form must reproduce the above copyright notice,
  260.   *      this list of conditions and the following disclaimer in the documentation
  261.   *      and/or other materials provided with the distribution.
  262.   *   3. Neither the name of STMicroelectronics nor the names of its contributors
  263.   *      may be used to endorse or promote products derived from this software
  264.   *      without specific prior written permission.
  265.   *
  266.   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  267.   * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  268.   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  269.   * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  270.   * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  271.   * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  272.   * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  273.   * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  274.   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  275.   * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  276.   *
  277.   ******************************************************************************
  278.   */
  279. /* Includes ------------------------------------------------------------------*/
  280. #include "stm32f1xx_hal.h"
  281.  
  282. /* USER CODE BEGIN Includes */
  283. #include "string.h"
  284. /* USER CODE END Includes */
  285.  
  286. /* Private variables ---------------------------------------------------------*/
  287. TIM_HandleTypeDef htim1;
  288. TIM_HandleTypeDef htim2;
  289. TIM_HandleTypeDef htim3;
  290.  
  291. UART_HandleTypeDef huart2;
  292.  
  293. /* USER CODE BEGIN PV */
  294. /* Private variables ---------------------------------------------------------*/
  295. uint32_t count;
  296. int Emp[3]={5,6,7};
  297. int tempEmp[3],NEmp = 3;
  298. int Customer[12]={4,3,2,5,1,6,7,6,1,5,2,3};
  299. char Newline[] = "\r\n";
  300. int P1=0, P2=0, P3=0;
  301. /* USER CODE END PV */
  302.  
  303. /* Private function prototypes -----------------------------------------------*/
  304. void SystemClock_Config(void);
  305. static void MX_GPIO_Init(void);
  306. static void MX_TIM1_Init(void);
  307. static void MX_TIM2_Init(void);
  308. static void MX_TIM3_Init(void);
  309. static void MX_USART2_UART_Init(void);
  310.  
  311. /* USER CODE BEGIN PFP */
  312. /* Private function prototypes -----------------------------------------------*/
  313. void displayNumber(void);
  314. /* USER CODE END PFP */
  315.  
  316. /* USER CODE BEGIN 0 */
  317.  
  318. /* USER CODE END 0 */
  319.  
  320. int main(void)
  321. {
  322.  
  323.   /* USER CODE BEGIN 1 */
  324.   char StrQueue[]="queue is ";
  325.   /* USER CODE END 1 */
  326.  
  327.   /* MCU Configuration----------------------------------------------------------*/
  328.  
  329.   /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  330.   HAL_Init();
  331.  
  332.   /* Configure the system clock */
  333.   SystemClock_Config();
  334.  
  335.   /* Initialize all configured peripherals */
  336.   MX_GPIO_Init();
  337.   MX_TIM1_Init();
  338.   MX_TIM2_Init();
  339.   MX_TIM3_Init();
  340.   MX_USART2_UART_Init();
  341.  
  342.   /* USER CODE BEGIN 2 */
  343.  
  344.   HAL_UART_Transmit(&huart2, (uint8_t*) StrQueue, strlen(StrQueue),1000);
  345.  
  346.   for (int i = 0; i < 12; ++i)
  347.   {
  348.     char Outstr[10];
  349.     sprintf(Outstr, "%d", Customer[i]);
  350.     strcat(Outstr, " ");
  351.     HAL_UART_Transmit(&huart2, (uint8_t*) Outstr, strlen(Outstr),1000);
  352.   }
  353.   HAL_UART_Transmit(&huart2, (uint8_t*) Newline, strlen(Newline),1000);
  354.  
  355.   HAL_TIM_Base_Start_IT(&htim1);
  356.   HAL_TIM_Base_Start_IT(&htim2);
  357.   HAL_TIM_Base_Start_IT(&htim3);
  358.   /* USER CODE END 2 */
  359.  
  360.   /* Infinite loop */
  361.   /* USER CODE BEGIN WHILE */
  362.   while (1)
  363.   {
  364.     int ck=1;
  365.     for (int i = 0; i < 12; ++i)
  366.     {
  367.       if (Customer[i]>0)
  368.       {
  369.         ck=0;
  370.       }
  371.     }
  372.     if (ck)
  373.     {
  374.       char Quit[]="complete";
  375.       HAL_UART_Transmit(&huart2, (uint8_t*) Newline, strlen(Newline),1000);
  376.       HAL_UART_Transmit(&huart2, (uint8_t*) Quit, strlen(Quit),1000);
  377.       break;
  378.     }
  379.   /* USER CODE END WHILE */
  380.   /* USER CODE BEGIN 3 */
  381.  
  382.   }
  383.   /* USER CODE END 3 */
  384.  
  385. }
  386.  
  387. /** System Clock Configuration
  388. */
  389. void SystemClock_Config(void)
  390. {
  391.  
  392.   RCC_OscInitTypeDef RCC_OscInitStruct;
  393.   RCC_ClkInitTypeDef RCC_ClkInitStruct;
  394.  
  395.   RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
  396.   RCC_OscInitStruct.HSEState = RCC_HSE_ON;
  397.   RCC_OscInitStruct.HSEPredivValue = RCC_HSE_PREDIV_DIV5;
  398.   RCC_OscInitStruct.Prediv1Source = RCC_PREDIV1_SOURCE_PLL2;
  399.   RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
  400.   RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
  401.   RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL9;
  402.   RCC_OscInitStruct.PLL2.PLL2State = RCC_PLL2_ON;
  403.   RCC_OscInitStruct.PLL2.PLL2MUL = RCC_PLL2_MUL8;
  404.   RCC_OscInitStruct.PLL2.HSEPrediv2Value = RCC_HSE_PREDIV2_DIV5;
  405.   HAL_RCC_OscConfig(&RCC_OscInitStruct);
  406.  
  407.   RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_SYSCLK|RCC_CLOCKTYPE_PCLK1;
  408.   RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
  409.   RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
  410.   RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2;
  411.   RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
  412.   HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2);
  413.  
  414.   HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/1000);
  415.  
  416.   HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);
  417.  
  418.   __HAL_RCC_PLLI2S_ENABLE();
  419.  
  420.   /* SysTick_IRQn interrupt configuration */
  421.   HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
  422. }
  423.  
  424. /* TIM1 init function */
  425. void MX_TIM1_Init(void)
  426. {
  427.  
  428.   TIM_ClockConfigTypeDef sClockSourceConfig;
  429.   TIM_MasterConfigTypeDef sMasterConfig;
  430.  
  431.   htim1.Instance = TIM1;
  432.   htim1.Init.Prescaler = 72-1;
  433.   htim1.Init.CounterMode = TIM_COUNTERMODE_UP;
  434.   htim1.Init.Period = 1000-1;
  435.   htim1.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
  436.   htim1.Init.RepetitionCounter = 0;
  437.   HAL_TIM_Base_Init(&htim1);
  438.  
  439.   sClockSourceConfig.ClockSource = TIM_CLOCKSOURCE_INTERNAL;
  440.   HAL_TIM_ConfigClockSource(&htim1, &sClockSourceConfig);
  441.  
  442.   sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET;
  443.   sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
  444.   HAL_TIMEx_MasterConfigSynchronization(&htim1, &sMasterConfig);
  445.  
  446. }
  447.  
  448. /* TIM2 init function */
  449. void MX_TIM2_Init(void)
  450. {
  451.  
  452.   TIM_ClockConfigTypeDef sClockSourceConfig;
  453.   TIM_MasterConfigTypeDef sMasterConfig;
  454.  
  455.   htim2.Instance = TIM2;
  456.   htim2.Init.Prescaler = 72-1;
  457.   htim2.Init.CounterMode = TIM_COUNTERMODE_UP;
  458.   htim2.Init.Period = 1000-1;
  459.   htim2.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
  460.   HAL_TIM_Base_Init(&htim2);
  461.  
  462.   sClockSourceConfig.ClockSource = TIM_CLOCKSOURCE_INTERNAL;
  463.   HAL_TIM_ConfigClockSource(&htim2, &sClockSourceConfig);
  464.  
  465.   sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET;
  466.   sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
  467.   HAL_TIMEx_MasterConfigSynchronization(&htim2, &sMasterConfig);
  468.  
  469. }
  470.  
  471. /* TIM3 init function */
  472. void MX_TIM3_Init(void)
  473. {
  474.  
  475.   TIM_ClockConfigTypeDef sClockSourceConfig;
  476.   TIM_MasterConfigTypeDef sMasterConfig;
  477.  
  478.   htim3.Instance = TIM3;
  479.   htim3.Init.Prescaler = 72-1;
  480.   htim3.Init.CounterMode = TIM_COUNTERMODE_UP;
  481.   htim3.Init.Period = 1000-1;
  482.   htim3.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
  483.   HAL_TIM_Base_Init(&htim3);
  484.  
  485.   sClockSourceConfig.ClockSource = TIM_CLOCKSOURCE_INTERNAL;
  486.   HAL_TIM_ConfigClockSource(&htim3, &sClockSourceConfig);
  487.  
  488.   sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET;
  489.   sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
  490.   HAL_TIMEx_MasterConfigSynchronization(&htim3, &sMasterConfig);
  491.  
  492. }
  493.  
  494. /* USART2 init function */
  495. void MX_USART2_UART_Init(void)
  496. {
  497.  
  498.   huart2.Instance = USART2;
  499.   huart2.Init.BaudRate = 115200;
  500.   huart2.Init.WordLength = UART_WORDLENGTH_8B;
  501.   huart2.Init.StopBits = UART_STOPBITS_1;
  502.   huart2.Init.Parity = UART_PARITY_NONE;
  503.   huart2.Init.Mode = UART_MODE_TX_RX;
  504.   huart2.Init.HwFlowCtl = UART_HWCONTROL_NONE;
  505.   huart2.Init.OverSampling = UART_OVERSAMPLING_16;
  506.   HAL_UART_Init(&huart2);
  507.  
  508. }
  509.  
  510. /** Configure pins as
  511.         * Analog
  512.         * Input
  513.         * Output
  514.         * EVENT_OUT
  515.         * EXTI
  516. */
  517. void MX_GPIO_Init(void)
  518. {
  519.  
  520.   /* GPIO Ports Clock Enable */
  521.   __HAL_RCC_GPIOD_CLK_ENABLE();
  522.  
  523. }
  524.  
  525. /* USER CODE BEGIN 4 */
  526. /* USER CODE END 4 */
  527.  
  528. #ifdef USE_FULL_ASSERT
  529.  
  530. /**
  531.    * @brief Reports the name of the source file and the source line number
  532.    * where the assert_param error has occurred.
  533.    * @param file: pointer to the source file name
  534.    * @param line: assert_param error line source number
  535.    * @retval None
  536.    */
  537. void assert_failed(uint8_t* file, uint32_t line)
  538. {
  539.   /* USER CODE BEGIN 6 */
  540.   /* User can add his own implementation to report the file name and line number,
  541.     ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
  542.   /* USER CODE END 6 */
  543.  
  544. }
  545.  
  546. #endif
  547.  
  548. /**
  549.   * @}
  550.   */
  551.  
  552. /**
  553.   * @}
  554. */
  555.  
  556. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement