freertos.c 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. /**
  2. ******************************************************************************
  3. * File Name : freertos.c
  4. * Description : Code for freertos applications
  5. ******************************************************************************
  6. *
  7. * COPYRIGHT(c) 2016 STMicroelectronics
  8. *
  9. * Redistribution and use in source and binary forms, with or without modification,
  10. * are permitted provided that the following conditions are met:
  11. * 1. Redistributions of source code must retain the above copyright notice,
  12. * this list of conditions and the following disclaimer.
  13. * 2. Redistributions in binary form must reproduce the above copyright notice,
  14. * this list of conditions and the following disclaimer in the documentation
  15. * and/or other materials provided with the distribution.
  16. * 3. Neither the name of STMicroelectronics nor the names of its contributors
  17. * may be used to endorse or promote products derived from this software
  18. * without specific prior written permission.
  19. *
  20. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  21. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  22. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  23. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  24. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  25. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  26. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  27. * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  28. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  29. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  30. *
  31. ******************************************************************************
  32. */
  33. /* Includes ------------------------------------------------------------------*/
  34. #include "FreeRTOS.h"
  35. #include "task.h"
  36. #include "cmsis_os.h"
  37. /* USER CODE BEGIN Includes */
  38. /* USER CODE END Includes */
  39. /* Variables -----------------------------------------------------------------*/
  40. osThreadId allumageHandle;
  41. osThreadId pilotageHandle;
  42. /* USER CODE BEGIN Variables */
  43. /* USER CODE END Variables */
  44. /* Function prototypes -------------------------------------------------------*/
  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. /* USER CODE BEGIN FunctionPrototypes */
  49. /* USER CODE END FunctionPrototypes */
  50. /* Hook prototypes */
  51. /* Init FreeRTOS */
  52. void MX_FREERTOS_Init(void) {
  53. /* USER CODE BEGIN Init */
  54. /* USER CODE END Init */
  55. /* USER CODE BEGIN RTOS_MUTEX */
  56. /* add mutexes, ... */
  57. /* USER CODE END RTOS_MUTEX */
  58. /* USER CODE BEGIN RTOS_SEMAPHORES */
  59. /* add semaphores, ... */
  60. /* USER CODE END RTOS_SEMAPHORES */
  61. /* USER CODE BEGIN RTOS_TIMERS */
  62. /* start timers, add new ones, ... */
  63. /* USER CODE END RTOS_TIMERS */
  64. /* Create the thread(s) */
  65. /* definition and creation of allumage */
  66. osThreadDef(allumage, StartDefaultTask, osPriorityNormal, 0, 128);
  67. allumageHandle = osThreadCreate(osThread(allumage), NULL);
  68. /* definition and creation of pilotage */
  69. osThreadDef(pilotage, StartTask02, osPriorityNormal, 0, 128);
  70. pilotageHandle = osThreadCreate(osThread(pilotage), NULL);
  71. /* USER CODE BEGIN RTOS_THREADS */
  72. /* add threads, ... */
  73. /* USER CODE END RTOS_THREADS */
  74. /* USER CODE BEGIN RTOS_QUEUES */
  75. /* add queues, ... */
  76. /* USER CODE END RTOS_QUEUES */
  77. }
  78. /* StartDefaultTask function */
  79. void StartDefaultTask(void const * argument)
  80. {
  81. /* USER CODE BEGIN StartDefaultTask */
  82. /* Infinite loop */
  83. for(;;)
  84. {
  85. osDelay(1);
  86. }
  87. /* USER CODE END StartDefaultTask */
  88. }
  89. /* StartTask02 function */
  90. void StartTask02(void const * argument)
  91. {
  92. /* USER CODE BEGIN StartTask02 */
  93. /* Infinite loop */
  94. for(;;)
  95. {
  96. osDelay(1);
  97. }
  98. /* USER CODE END StartTask02 */
  99. }
  100. /* USER CODE BEGIN Application */
  101. /* USER CODE END Application */
  102. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/