freertos.c 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. /* USER CODE BEGIN Header */
  2. /**
  3. ******************************************************************************
  4. * File Name : freertos.c
  5. * Description : Code for freertos applications
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * Copyright (c) 2024 STMicroelectronics.
  10. * All rights reserved.
  11. *
  12. * This software is licensed under terms that can be found in the LICENSE file
  13. * in the root directory of this software component.
  14. * If no LICENSE file comes with this software, it is provided AS-IS.
  15. *
  16. ******************************************************************************
  17. */
  18. /* USER CODE END Header */
  19. /* Includes ------------------------------------------------------------------*/
  20. #include "FreeRTOS.h"
  21. #include "task.h"
  22. #include "main.h"
  23. #include "cmsis_os.h"
  24. /* Private includes ----------------------------------------------------------*/
  25. /* USER CODE BEGIN Includes */
  26. /* USER CODE END Includes */
  27. /* Private typedef -----------------------------------------------------------*/
  28. /* USER CODE BEGIN PTD */
  29. /* USER CODE END PTD */
  30. /* Private define ------------------------------------------------------------*/
  31. /* USER CODE BEGIN PD */
  32. /* USER CODE END PD */
  33. /* Private macro -------------------------------------------------------------*/
  34. /* USER CODE BEGIN PM */
  35. /* USER CODE END PM */
  36. /* Private variables ---------------------------------------------------------*/
  37. /* USER CODE BEGIN Variables */
  38. /* USER CODE END Variables */
  39. /* Definitions for defaultTask */
  40. osThreadId_t defaultTaskHandle;
  41. const osThreadAttr_t defaultTask_attributes = {
  42. .name = "defaultTask",
  43. .stack_size = 128 * 4,
  44. .priority = (osPriority_t) osPriorityNormal,
  45. };
  46. /* Private function prototypes -----------------------------------------------*/
  47. /* USER CODE BEGIN FunctionPrototypes */
  48. /* USER CODE END FunctionPrototypes */
  49. void StartDefaultTask(void *argument);
  50. void MX_FREERTOS_Init(void); /* (MISRA C 2004 rule 8.1) */
  51. /**
  52. * @brief FreeRTOS initialization
  53. * @param None
  54. * @retval None
  55. */
  56. void MX_FREERTOS_Init(void) {
  57. /* USER CODE BEGIN Init */
  58. /* USER CODE END Init */
  59. /* USER CODE BEGIN RTOS_MUTEX */
  60. /* add mutexes, ... */
  61. /* USER CODE END RTOS_MUTEX */
  62. /* USER CODE BEGIN RTOS_SEMAPHORES */
  63. /* add semaphores, ... */
  64. /* USER CODE END RTOS_SEMAPHORES */
  65. /* USER CODE BEGIN RTOS_TIMERS */
  66. /* start timers, add new ones, ... */
  67. /* USER CODE END RTOS_TIMERS */
  68. /* USER CODE BEGIN RTOS_QUEUES */
  69. /* add queues, ... */
  70. /* USER CODE END RTOS_QUEUES */
  71. /* Create the thread(s) */
  72. /* creation of defaultTask */
  73. defaultTaskHandle = osThreadNew(StartDefaultTask, NULL, &defaultTask_attributes);
  74. /* USER CODE BEGIN RTOS_THREADS */
  75. /* add threads, ... */
  76. /* USER CODE END RTOS_THREADS */
  77. /* USER CODE BEGIN RTOS_EVENTS */
  78. /* add events, ... */
  79. /* USER CODE END RTOS_EVENTS */
  80. }
  81. /* USER CODE BEGIN Header_StartDefaultTask */
  82. /**
  83. * @brief Function implementing the defaultTask thread.
  84. * @param argument: Not used
  85. * @retval None
  86. */
  87. /* USER CODE END Header_StartDefaultTask */
  88. void StartDefaultTask(void *argument)
  89. {
  90. /* USER CODE BEGIN StartDefaultTask */
  91. /* Infinite loop */
  92. for(;;)
  93. {
  94. osDelay(1);
  95. }
  96. /* USER CODE END StartDefaultTask */
  97. }
  98. /* Private application code --------------------------------------------------*/
  99. /* USER CODE BEGIN Application */
  100. /* USER CODE END Application */