Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* USER CODE BEGIN Header */
- /**
- ******************************************************************************
- * @file app_threadx.c
- * @author MCD Application Team
- * @brief ThreadX applicative file
- ******************************************************************************
- * @attention
- *
- * Copyright (c) 2021 STMicroelectronics.
- * All rights reserved.
- *
- * This software is licensed under terms that can be found in the LICENSE file
- * in the root directory of this software component.
- * If no LICENSE file comes with this software, it is provided AS-IS.
- *
- ******************************************************************************
- */
- /* USER CODE END Header */
- /* Includes ------------------------------------------------------------------*/
- #include "app_threadx.h"
- /* Private includes ----------------------------------------------------------*/
- /* USER CODE BEGIN Includes */
- /* USER CODE END Includes */
- /* Private typedef -----------------------------------------------------------*/
- /* USER CODE BEGIN PTD */
- /* USER CODE END PTD */
- /* Private define ------------------------------------------------------------*/
- /* USER CODE BEGIN PD */
- #define THREAD_STACK_SIZE 1024
- /* USER CODE END PD */
- /* Private macro -------------------------------------------------------------*/
- /* USER CODE BEGIN PM */
- /* USER CODE END PM */
- /* Private variables ---------------------------------------------------------*/
- /* USER CODE BEGIN PV */
- uint8_t led_stack[THREAD_STACK_SIZE];
- TX_THREAD led_ptr;
- uint32_t ret_val;
- /* USER CODE END PV */
- /* Private function prototypes -----------------------------------------------*/
- /* USER CODE BEGIN PFP */
- VOID blink_led(ULONG interval);
- /* USER CODE END PFP */
- /**
- * @brief Application ThreadX Initialization.
- * @param memory_ptr: memory pointer
- * @retval int
- */
- UINT App_ThreadX_Init(VOID *memory_ptr)
- {
- UINT ret = TX_SUCCESS;
- TX_BYTE_POOL *byte_pool = (TX_BYTE_POOL*)memory_ptr;
- /* USER CODE BEGIN App_ThreadX_Init */
- (void)byte_pool;
- ret_val = tx_thread_create(&led_ptr, "led_thread", blink_led, 0X1234,
- led_stack, THREAD_STACK_SIZE, 15, 15, TX_NO_TIME_SLICE, TX_AUTO_START);
- /* USER CODE END App_ThreadX_Init */
- return ret;
- }
- /**
- * @brief MX_ThreadX_Init
- * @param None
- * @retval None
- */
- void MX_ThreadX_Init(void)
- {
- /* USER CODE BEGIN Before_Kernel_Start */
- /* USER CODE END Before_Kernel_Start */
- tx_kernel_enter();
- /* USER CODE BEGIN Kernel_Start_Error */
- /* USER CODE END Kernel_Start_Error */
- }
- /* USER CODE BEGIN 1 */
- VOID blink_led(ULONG interval){
- while(1){
- HAL_GPIO_TogglePin(LD2_GPIO_Port, LD2_Pin);
- tx_thread_sleep(1);
- }
- }
- /* USER CODE END 1 */
Advertisement
Add Comment
Please, Sign In to add comment