本文整理汇总了C++中osThread函数的典型用法代码示例。如果您正苦于以下问题:C++ osThread函数的具体用法?C++ osThread怎么用?C++ osThread使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了osThread函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Init_ThreadADC2
int Init_ThreadADC2 (void) {
tid_ADC2 = osThreadCreate (osThread(Thread_ADC2), NULL);
if (!tid_ADC2) return(-1);
return(0);
}
示例2: main
/**
* @brief Main program
* @param None
* @retval None
*/
int main(void)
{
/* STM32F4xx HAL library initialization:
- Configure the Flash prefetch, instruction and Data caches
- Configure the Systick to generate an interrupt each 1 msec
- Set NVIC Group Priority to 4
- Global MSP (MCU Support Package) initialization
*/
HAL_Init();
/* Configure the system clock to 168 MHz */
SystemClock_Config();
/* Configure LED1 and LED3 */
BSP_LED_Init(LED1);
BSP_LED_Init(LED3);
/*##-1- Start task #########################################################*/
osThreadDef(USER_Thread, StartThread, osPriorityNormal, 0, 8 * configMINIMAL_STACK_SIZE);
osThreadCreate(osThread(USER_Thread), NULL);
/*##-2- Create Application Queue ###########################################*/
osMessageQDef(osqueue, 1, uint16_t);
AppliEvent = osMessageCreate(osMessageQ(osqueue), NULL);
/*##-3- Start scheduler ####################################################*/
osKernelStart();
/* We should never get here as control is now taken by the scheduler */
for( ;; );
}
示例3: start_Thread_Temperature
/**
* @brief Start temperature monitoring thread
* @param none
* @retval none
*/
int start_Thread_Temperature(void) {
ADC1_Config(); /* configure temperature ADC */
tid_Thread_Temperature = osThreadCreate(osThread(Thread_Temperature), NULL);
if (!tid_Thread_Temperature) return -1;
return 0;
}
示例4: MX_FREERTOS_Init
void MX_FREERTOS_Init(void) {
/* USER CODE BEGIN Init */
/* USER CODE END Init */
/* USER CODE BEGIN RTOS_MUTEX */
/* add mutexes, ... */
/* USER CODE END RTOS_MUTEX */
/* USER CODE BEGIN RTOS_SEMAPHORES */
/* add semaphores, ... */
/* USER CODE END RTOS_SEMAPHORES */
/* USER CODE BEGIN RTOS_TIMERS */
/* start timers, add new ones, ... */
/* USER CODE END RTOS_TIMERS */
/* Create the thread(s) */
/* definition and creation of defaultTask */
osThreadDef(defaultTask, StartDefaultTask, osPriorityNormal, 0, 128);
defaultTaskHandle = osThreadCreate(osThread(defaultTask), NULL);
/* USER CODE BEGIN RTOS_THREADS */
/* add threads, ... */
/* USER CODE END RTOS_THREADS */
/* USER CODE BEGIN RTOS_QUEUES */
/* add queues, ... */
/* USER CODE END RTOS_QUEUES */
}
示例5: main
/**
* @brief Main program
* @param None
* @retval None
*/
int main(void)
{
/* Enable the CPU Cache */
CPU_CACHE_Enable();
/* STM32F7xx HAL library initialization:
- Configure the Flash ART accelerator on ITCM interface
- Configure the Systick to generate an interrupt each 1 msec
- Set NVIC Group Priority to 4
- Low Level Initialization
*/
HAL_Init();
/* Configure the System clock to have a frequency of 200 Mhz */
SystemClock_Config();
/* Start task */
osThreadDef(USER_Thread, StartThread, osPriorityNormal, 0, 8 * configMINIMAL_STACK_SIZE);
osThreadCreate(osThread(USER_Thread), NULL);
/* Create Application Queue */
osMessageQDef(osqueue, 1, uint16_t);
AppliEvent = osMessageCreate(osMessageQ(osqueue), NULL);
/* Start scheduler */
osKernelStart();
/* We should never get here as control is now taken by the scheduler */
for( ;; );
}
示例6: k_StorageInit
/**
* @brief Storage drives initialization
* @param None
* @retval None
*/
void k_StorageInit(void)
{
/* Link the USB Host disk I/O driver */
FATFS_LinkDriver(&USBH_Driver, USBDISK_Drive);
/* Link the micro SD disk I/O driver */
FATFS_LinkDriver(&SD_Driver, mSDDISK_Drive);
/* Create USB background task */
osThreadDef(STORAGE_Thread, StorageThread, osPriorityBelowNormal, 0, 2 * configMINIMAL_STACK_SIZE);
osThreadCreate (osThread(STORAGE_Thread), NULL);
/* Create Storage Message Queue */
osMessageQDef(osqueue, 10, uint16_t);
StorageEvent = osMessageCreate (osMessageQ(osqueue), NULL);
/* Init Host Library */
USBH_Init(&hUSB_Host, USBH_UserProcess, 0);
/* Add Supported Class */
USBH_RegisterClass(&hUSB_Host, USBH_MSC_CLASS);
/* Start Host Process */
USBH_Start(&hUSB_Host);
/* Enable SD Interrupt mode */
BSP_SD_Init();
BSP_SD_ITConfig();
if(BSP_SD_IsDetected())
{
osMessagePut ( StorageEvent, MSDDISK_CONNECTION_EVENT, 0);
}
}
示例7: main
/**
* @brief Main program
* @param None
* @retval None
*/
int main(void)
{
/* STM32F446xx HAL library initialization */
HAL_Init();
/* Configure the system clock to 180 Mhz */
SystemClock_Config();
/* Initialize IO expander */
BSP_IO_Init();
/* Start task */
osThreadDef(USER_Thread, StartThread, osPriorityNormal, 0, 8 * configMINIMAL_STACK_SIZE);
osThreadCreate(osThread(USER_Thread), NULL);
/* Create Application Queue */
osMessageQDef(osqueue, 1, uint16_t);
AppliEvent = osMessageCreate(osMessageQ(osqueue), NULL);
/* Start scheduler */
osKernelStart();
/* We should never get here as control is now taken by the scheduler */
for( ;; );
}
示例8: main
/**@brief Function for application main entry.
*/
int main(void)
{
uint32_t err_code;
bool erase_bonds;
// Initialize.
timers_init();
buttons_leds_init(&erase_bonds);
ble_stack_init();
device_manager_init(erase_bonds);
gap_params_init();
advertising_init();
services_init();
sensor_simulator_init();
conn_params_init();
ble_evt_pool = osPoolCreate(osPool(ble_evt_pool));
ble_stack_msg_box = osMessageCreate(osMessageQ(ble_stack_msg_box), NULL);
// Start execution.
ble_stack_thread_id = osThreadCreate(osThread(ble_stack_thread), NULL);
UNUSED_VARIABLE(ble_stack_thread_id);
application_timers_start();
err_code = ble_advertising_start(BLE_ADV_MODE_FAST);
APP_ERROR_CHECK(err_code);
// Enter main loop.
for (;; )
{
UNUSED_VARIABLE(osDelay(1000));
}
}
示例9: main
/**
* @brief Main program.
* @param None
* @retval None
*/
int main(void)
{
/* STM32F4xx HAL library initialization:
- Configure the Flash prefetch, instruction and Data caches
- Configure the Systick to generate an interrupt each 1 msec
- Set NVIC Group Priority to 4
- Global MSP (MCU Support Package) initialization
*/
HAL_Init();
/* Configure the system clock to 180 Mhz */
SystemClock_Config();
/* Initialize LED1 and buttons */
BSP_LED_Init(LED1);
BSP_PB_Init(BUTTON_TAMPER, BUTTON_MODE_EXTI);
/* Define used semaphore */
osSemaphoreDef(SEM);
/* Create the semaphore used by the two threads. */
osSemaphore = osSemaphoreCreate(osSemaphore(SEM) , 1);
/* Create the Thread that toggle LED1 */
osThreadDef(SEM_Thread, SemaphoreTest, osPriorityNormal, 0, semtstSTACK_SIZE);
osThreadCreate(osThread(SEM_Thread), (void *) osSemaphore);
/* Start scheduler */
osKernelStart (NULL, NULL);
/* We should never get here as control is now taken by the scheduler */
for(;;);
}
示例10: HCBoxInit
void HCBoxInit( void )
{
// switch ( Configure.HeaterType )
// {
// default:
// case enumHeaterNone: MsgBox( "未安装恒温箱", vbOKOnly ); break;
// case enumHCBoxOnly: Configure_HCBox(); break;
// case enumHeaterOnly: Configure_Heater(); break;
// case enumHCBoxHeater: MsgBox( "硬件不能支持", vbOKOnly ); break;
// }
// set_HCBoxTemp( Configure.HCBox_SetTemp * 0.1f, Configure.HCBox_SetMode );
switch ( Configure.HeaterType )
{
default:
case enumHeaterNone:
break; // MsgBox( "未安装恒温箱", vbOKOnly ); break;
case enumHCBoxOnly:
set_HCBoxTemp( Configure.HCBox_SetTemp * 0.1f, Configure.HCBox_SetMode );
Set_HCBox_Temp( Configure.HCBox_SetTemp * 0.1f, Configure.HCBox_SetMode );
osThreadCreate( osThread( _task_HCBox ), NULL );
break;
case enumHeaterOnly:
set_HeaterTemp( Configure.Heater_SetTemp * 0.1f);
break;
case enumHCBoxHeater:
set_HCBoxTemp( Configure.HCBox_SetTemp * 0.1f, Configure.HCBox_SetMode );
set_HeaterTemp( Configure.Heater_SetTemp*0.1f);
break;
}
}
示例11: main
/**
* @brief Main program
* @param None
* @retval None
*/
int main(void)
{
/* STM32F4xx HAL library initialization:
- Configure the Flash prefetch, instruction and Data caches
- Configure the Systick to generate an interrupt each 1 msec
- Set NVIC Group Priority to 4
- Global MSP (MCU Support Package) initialization
*/
HAL_Init();
/* Configure the system clock to 180 MHz */
SystemClock_Config();
/* Configure LED1 and LED2 */
BSP_LED_Init(LED1);
BSP_LED_Init(LED2);
/* Create Timer */
osTimerDef(LEDTimer, osTimerCallback);
osTimerId osTimer = osTimerCreate (osTimer(LEDTimer), osTimerPeriodic, NULL);
/* Start Timer */
osTimerStart(osTimer, 200);
/* Create LED Thread */
osThreadDef(LEDThread, ToggleLEDsThread, osPriorityNormal, 0, configMINIMAL_STACK_SIZE);
osThreadCreate (osThread(LEDThread), NULL);
/* Start scheduler */
osKernelStart();
/* We should never get here as control is now taken by the scheduler */
for(;;);
}
示例12: init_myThread
int init_myThread(void) {
tid_myThread = osThreadCreate(osThread(myThread), NULL);
if(!tid_myThread) return(-1);
return(0);
}
示例13: main
int main()
{
static char *argv[] =
{ "client", "-h", CYASSL_CALLEE_IP, "-p", CYASSL_CALLEE_PORT,
"-v", CYASSL_SSL_VER, CYASSL_HTTP_GET } ;
static func_args args =
{ 7 + CYASSL_HTTP_GET_COUNT, argv } ;
init_filesystem ();
net_initialize() ;
osThreadCreate (osThread (tcp_poll), NULL);
osDelay(50000) ; /* wait for DHCP */
#if defined(DEBUG_CYASSL)
printf("Turning ON Debug message\n") ;
CyaSSL_Debugging_ON() ;
#endif
if(args.argc == 7)
printf("Simple SSL/TLS, ") ;
else
printf("HTTP GET, ") ;
printf("Callee IP: %s, Port: %s, Version:%s\n", argv[2], argv[4], argv[6]) ;
while(1) {
client_test(&args) ;
printf("Enter any key to iterate.\n") ;
getchar() ;
}
}
示例14: main
/**
* @brief Main program
* @param None
* @retval None
*/
int main(void)
{
/* Enable the CPU Cache */
CPU_CACHE_Enable();
/* STM32F7xx HAL library initialization:
- Configure the Flash ART accelerator on ITCM interface
- Configure the Systick to generate an interrupt each 1 msec
- Set NVIC Group Priority to 4
- Global MSP (MCU Support Package) initialization
*/
HAL_Init();
/* Configure the system clock to 216 MHz */
SystemClock_Config();
/* Configure LED1 */
BSP_LED_Init(LED1);
/*##-1- Start task #########################################################*/
osThreadDef(uSDThread, StartThread, osPriorityNormal, 0, 8 * configMINIMAL_STACK_SIZE);
osThreadCreate(osThread(uSDThread), NULL);
/*##-2- Start scheduler ####################################################*/
osKernelStart();
/* We should never get here as control is now taken by the scheduler */
for( ;; );
}
示例15: cpufreq_init
void cpufreq_init(void)
{
dfs_ddrc_calc();
//dfs_to_max();
memset(&g_cpufreq, 0x0, sizeof(T_CPUFREQ_ST));
/* 初始化记录的上一次需要调的频率值 */
g_cpufreq.maxprof = CPUFREQ_MAX_PROFILE;
g_cpufreq.minprof = CPUFREQ_MIN_PROFILE;
g_cpufreq.curprof = cpufreq_get_cur_profile();
M3_CUR_CPUFREQ_PROFILE = g_cpufreq.curprof;
M3_MAX_CPUFREQ_PROFILE = g_cpufreq.maxprof;
M3_MIN_CPUFREQ_PROFILE = g_cpufreq.minprof;
M3_CPUFREQ_DOWN_FLAG(0) = 0;
M3_CPUFREQ_DOWN_FLAG(1) = 0;
cpufreq_mail = osMailCreate(osMailQ(cpufreq_mail), NULL);
thread_cpufreq_id = osThreadCreate (osThread (thread_cpufreq), NULL);
if (thread_cpufreq_id == NULL)
{
M3CPUFREQ_PRINT(" thread create error\n");
}
/* icc channel */
cpufreq_icc_init();
}