freertos.c 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. /* USER CODE BEGIN Header */
  2. /**
  3. ******************************************************************************
  4. * File Name : freertos.c
  5. * Description : Code for freertos applications
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
  10. * All rights reserved.</center></h2>
  11. *
  12. * This software component is licensed by ST under Ultimate Liberty license
  13. * SLA0044, the "License"; You may not use this file except in compliance with
  14. * the License. You may obtain a copy of the License at:
  15. * www.st.com/SLA0044
  16. *
  17. ******************************************************************************
  18. */
  19. /* USER CODE END Header */
  20. /* Includes ------------------------------------------------------------------*/
  21. #include "FreeRTOS.h"
  22. #include "task.h"
  23. #include "main.h"
  24. #include "cmsis_os.h"
  25. /* Private includes ----------------------------------------------------------*/
  26. /* USER CODE BEGIN Includes */
  27. /* USER CODE END Includes */
  28. /* Private typedef -----------------------------------------------------------*/
  29. /* USER CODE BEGIN PTD */
  30. /* USER CODE END PTD */
  31. /* Private define ------------------------------------------------------------*/
  32. /* USER CODE BEGIN PD */
  33. /* USER CODE END PD */
  34. /* Private macro -------------------------------------------------------------*/
  35. /* USER CODE BEGIN PM */
  36. /* USER CODE END PM */
  37. /* Private variables ---------------------------------------------------------*/
  38. /* USER CODE BEGIN Variables */
  39. /* USER CODE END Variables */
  40. osThreadId defaultTaskHandle;
  41. osThreadId TempHandle;
  42. /* Private function prototypes -----------------------------------------------*/
  43. /* USER CODE BEGIN FunctionPrototypes */
  44. /* USER CODE END FunctionPrototypes */
  45. void StartDefaultTask(void const * argument);
  46. void StartTask02(void const * argument);
  47. void MX_FREERTOS_Init(void); /* (MISRA C 2004 rule 8.1) */
  48. /**
  49. * @brief FreeRTOS initialization
  50. * @param None
  51. * @retval None
  52. */
  53. void MX_FREERTOS_Init(void) {
  54. /* USER CODE BEGIN Init */
  55. /* USER CODE END Init */
  56. /* USER CODE BEGIN RTOS_MUTEX */
  57. /* add mutexes, ... */
  58. /* USER CODE END RTOS_MUTEX */
  59. /* USER CODE BEGIN RTOS_SEMAPHORES */
  60. /* add semaphores, ... */
  61. /* USER CODE END RTOS_SEMAPHORES */
  62. /* USER CODE BEGIN RTOS_TIMERS */
  63. /* start timers, add new ones, ... */
  64. /* USER CODE END RTOS_TIMERS */
  65. /* USER CODE BEGIN RTOS_QUEUES */
  66. /* add queues, ... */
  67. /* USER CODE END RTOS_QUEUES */
  68. /* Create the thread(s) */
  69. /* definition and creation of defaultTask */
  70. osThreadDef(defaultTask, StartDefaultTask, osPriorityNormal, 0, 128);
  71. defaultTaskHandle = osThreadCreate(osThread(defaultTask), NULL);
  72. /* definition and creation of Temp */
  73. osThreadDef(Temp, StartTask02, osPriorityIdle, 0, 128);
  74. TempHandle = osThreadCreate(osThread(Temp), NULL);
  75. /* USER CODE BEGIN RTOS_THREADS */
  76. /* add threads, ... */
  77. /* USER CODE END RTOS_THREADS */
  78. }
  79. /* USER CODE BEGIN Header_StartDefaultTask */
  80. /**
  81. * @brief Function implementing the defaultTask thread.
  82. * @param argument: Not used
  83. * @retval None
  84. */
  85. /* USER CODE END Header_StartDefaultTask */
  86. void StartDefaultTask(void const * argument)
  87. {
  88. /* USER CODE BEGIN StartDefaultTask */
  89. /* Infinite loop */
  90. for(;;)
  91. {
  92. osDelay(1);
  93. }
  94. /* USER CODE END StartDefaultTask */
  95. }
  96. /* USER CODE BEGIN Header_StartTask02 */
  97. /**
  98. * @brief Function implementing the Temp thread.
  99. * @param argument: Not used
  100. * @retval None
  101. */
  102. /* USER CODE END Header_StartTask02 */
  103. void StartTask02(void const * argument)
  104. {
  105. /* USER CODE BEGIN StartTask02 */
  106. /* Infinite loop */
  107. for(;;)
  108. {
  109. osDelay(1);
  110. }
  111. /* USER CODE END StartTask02 */
  112. }
  113. /* Private application code --------------------------------------------------*/
  114. /* USER CODE BEGIN Application */
  115. /* USER CODE END Application */
  116. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/