1 В избранное 0 Ответвления 0

OSCHINA-MIRROR/kmsmg-FreeRTOSTimer

Присоединиться к Gitlife
Откройте для себя и примите участие в публичных проектах с открытым исходным кодом с участием более 10 миллионов разработчиков. Приватные репозитории также полностью бесплатны :)
Присоединиться бесплатно
Клонировать/Скачать
freertos.c 6.1 КБ
Копировать Редактировать Web IDE Исходные данные Просмотреть построчно История
kmsmg Отправлено 5 лет назад dd4d71a
/* USER CODE BEGIN Header */
/**
******************************************************************************
* File Name : freertos.c
* Description : Code for freertos applications
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2020 STMicroelectronics.
* All rights reserved.</center></h2>
*
* This software component is licensed by ST under Ultimate Liberty license
* SLA0044, the "License"; You may not use this file except in compliance with
* the License. You may obtain a copy of the License at:
* www.st.com/SLA0044
*
******************************************************************************
*/
/* USER CODE END Header */
/* Includes ------------------------------------------------------------------*/
#include "FreeRTOS.h"
#include "task.h"
#include "main.h"
#include "cmsis_os.h"
#include "tim.h"
/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
/* USER CODE END Includes */
/* Private typedef -----------------------------------------------------------*/
typedef StaticTask_t osStaticThreadDef_t;
/* USER CODE BEGIN PTD */
/* USER CODE END PTD */
/* Private define ------------------------------------------------------------*/
/* USER CODE BEGIN PD */
/* USER CODE END PD */
/* Private macro -------------------------------------------------------------*/
/* USER CODE BEGIN PM */
/* USER CODE END PM */
/* Private variables ---------------------------------------------------------*/
/* USER CODE BEGIN Variables */
/* USER CODE END Variables */
/* Definitions for defaultTask */
osThreadId_t defaultTaskHandle;
const osThreadAttr_t defaultTask_attributes = {
.name = "defaultTask",
.priority = (osPriority_t) osPriorityNormal,
.stack_size = 512
};
/* Definitions for modBus */
osThreadId_t modBusHandle;
uint32_t modBusBuffer[ 512 ];
osStaticThreadDef_t modBusControlBlock;
const osThreadAttr_t modBus_attributes = {
.name = "modBus",
.stack_mem = &modBusBuffer[0],
.stack_size = sizeof(modBusBuffer),
.cb_mem = &modBusControlBlock,
.cb_size = sizeof(modBusControlBlock),
.priority = (osPriority_t) osPriorityBelowNormal,
};
/* Definitions for IOPr5ocess */
osThreadId_t IOPr5ocessHandle;
const osThreadAttr_t IOPr5ocess_attributes = {
.name = "IOPr5ocess",
.priority = (osPriority_t) osPriorityLow2,
.stack_size = 512
};
/* Definitions for myQueue01 */
osMessageQueueId_t myQueue01Handle;
const osMessageQueueAttr_t myQueue01_attributes = {
.name = "myQueue01"
};
/* Definitions for myTimer01 */
osTimerId_t myTimer01Handle;
const osTimerAttr_t myTimer01_attributes = {
.name = "myTimer01"
};
/* Definitions for TempMutex */
osMutexId_t TempMutexHandle;
const osMutexAttr_t TempMutex_attributes = {
.name = "TempMutex"
};
/* Private function prototypes -----------------------------------------------*/
/* USER CODE BEGIN FunctionPrototypes */
/* USER CODE END FunctionPrototypes */
void StartDefaultTask(void *argument);
void StartModbusTask(void *argument);
void StartIOTask(void *argument);
void Callback01(void *argument);
void MX_FREERTOS_Init(void); /* (MISRA C 2004 rule 8.1) */
/**
* @brief FreeRTOS initialization
* @param None
* @retval None
*/
void MX_FREERTOS_Init(void) {
/* USER CODE BEGIN Init */
/* USER CODE END Init */
/* Create the mutex(es) */
/* creation of TempMutex */
TempMutexHandle = osMutexNew(&TempMutex_attributes);
/* USER CODE BEGIN RTOS_MUTEX */
/* add mutexes, ... */
/* USER CODE END RTOS_MUTEX */
/* USER CODE BEGIN RTOS_SEMAPHORES */
/* add semaphores, ... */
/* USER CODE END RTOS_SEMAPHORES */
/* Create the timer(s) */
/* creation of myTimer01 */
myTimer01Handle = osTimerNew(Callback01, osTimerPeriodic, NULL, &myTimer01_attributes);
/* USER CODE BEGIN RTOS_TIMERS */
/* start timers, add new ones, ... */
/* USER CODE END RTOS_TIMERS */
/* Create the queue(s) */
/* creation of myQueue01 */
myQueue01Handle = osMessageQueueNew (16, sizeof(uint16_t), &myQueue01_attributes);
/* USER CODE BEGIN RTOS_QUEUES */
/* add queues, ... */
/* USER CODE END RTOS_QUEUES */
/* Create the thread(s) */
/* creation of defaultTask */
defaultTaskHandle = osThreadNew(StartDefaultTask, NULL, &defaultTask_attributes);
/* creation of modBus */
modBusHandle = osThreadNew(StartModbusTask, NULL, &modBus_attributes);
/* creation of IOPr5ocess */
IOPr5ocessHandle = osThreadNew(StartIOTask, NULL, &IOPr5ocess_attributes);
/* USER CODE BEGIN RTOS_THREADS */
/* add threads, ... */
/* USER CODE END RTOS_THREADS */
}
/* USER CODE BEGIN Header_StartDefaultTask */
/**
* @brief Function implementing the defaultTask thread.
* @param argument: Not used
* @retval None
*/
/* USER CODE END Header_StartDefaultTask */
void StartDefaultTask(void *argument)
{
/* USER CODE BEGIN StartDefaultTask */
/* Infinite loop */
for(;;)
{
osDelay(1);
}
/* USER CODE END StartDefaultTask */
}
/* USER CODE BEGIN Header_StartModbusTask */
/**
* @brief Function implementing the modBus thread.
* @param argument: Not used
* @retval None
*/
/* USER CODE END Header_StartModbusTask */
void StartModbusTask(void *argument)
{
/* USER CODE BEGIN StartModbusTask */
/* Infinite loop */
HAL_TIM_Base_Start_IT( &htim4) ;
for(;;)
{
osDelay(1);
}
/* USER CODE END StartModbusTask */
}
/* USER CODE BEGIN Header_StartIOTask */
/**
* @brief Function implementing the IOPr5ocess thread.
* @param argument: Not used
* @retval None
*/
/* USER CODE END Header_StartIOTask */
void StartIOTask(void *argument)
{
/* USER CODE BEGIN StartIOTask */
/* Infinite loop */
for(;;)
{
osDelay(1);
}
/* USER CODE END StartIOTask */
}
/* Callback01 function */
void Callback01(void *argument)
{
/* USER CODE BEGIN Callback01 */
/* USER CODE END Callback01 */
}
/* Private application code --------------------------------------------------*/
/* USER CODE BEGIN Application */
/* USER CODE END Application */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

Комментарий ( 0 )

Вы можете оставить комментарий после Вход в систему

1
https://gitlife.ru/oschina-mirror/kmsmg-FreeRTOSTimer.git
git@gitlife.ru:oschina-mirror/kmsmg-FreeRTOSTimer.git
oschina-mirror
kmsmg-FreeRTOSTimer
kmsmg-FreeRTOSTimer
master