int main( void ) { /* Configure any generic parameters needed to run the demo. */ prvSetupHardware(); /* Start the timers that demonstrate FreeRTOS software timers and basic GPIO functionality. */ vGPIOSoftwareTimersStart(); /* Start the task that demonstrates the SPI port being used to implement a disk IO interface to an SD card. */ // vStartSPIInterfaceToSDCardTask(); /* This call creates the TCP/IP thread. */ tcpip_init( lwIPAppsInit, NULL ); /* Register two command line commands to show task stats and run time stats respectively. */ FreeRTOS_CLIRegisterCommand( &xTaskStats ); FreeRTOS_CLIRegisterCommand( &xRunTimeStats ); /* Start the FreeRTOS scheduler. */ vTaskStartScheduler(); /* The following line should never execute. If it does, it means there was insufficient FreeRTOS heap memory available to create the Idle and/or timer tasks. See the memory management section on the http://www.FreeRTOS.org web site for more information. */ for( ;; ); }
void vRegisterCLICommands( void ) { /* Register all the command line commands defined immediately above. */ FreeRTOS_CLIRegisterCommand( &xTaskStats ); FreeRTOS_CLIRegisterCommand( &xRunTimeStats ); FreeRTOS_CLIRegisterCommand( &xThreeParameterEcho ); FreeRTOS_CLIRegisterCommand( &xParameterEcho ); FreeRTOS_CLIRegisterCommand( &xStartTrace ); }
void vRegisterFileSystemCLICommands( void ) { /* Register all the command line commands defined immediately above. */ FreeRTOS_CLIRegisterCommand( &xDIR ); FreeRTOS_CLIRegisterCommand( &xCD ); FreeRTOS_CLIRegisterCommand( &xTYPE ); FreeRTOS_CLIRegisterCommand( &xDEL ); FreeRTOS_CLIRegisterCommand( &xCOPY ); }
void vRegisterSampleCLICommands( void ) { /* Register all the command line commands defined immediately above. */ FreeRTOS_CLIRegisterCommand( &xTaskStats ); FreeRTOS_CLIRegisterCommand( &xRunTimeStats ); FreeRTOS_CLIRegisterCommand( &xThreeParameterEcho ); FreeRTOS_CLIRegisterCommand( &xParameterEcho ); #if( configINCLUDE_TRACE_RELATED_CLI_COMMANDS == 1 ) { FreeRTOS_CLIRegisterCommand( & xStartStopTrace ); } #endif }
void vRegisterUDPCLICommands( void ) { /* Register all the command line commands defined immediately above. */ FreeRTOS_CLIRegisterCommand( &xIPConfig ); #if configINCLUDE_DEMO_DEBUG_STATS == 1 { FreeRTOS_CLIRegisterCommand( &xIPDebugStats ); } #endif /* configINCLUDE_DEMO_DEBUG_STATS */ #if ipconfigSUPPORT_OUTGOING_PINGS == 1 { FreeRTOS_CLIRegisterCommand( &xPing ); } #endif /* ipconfigSUPPORT_OUTGOING_PINGS */ }
void vStartSPIInterfaceToSDCardTask( void ) { /* Create the prvSPIToSDCardTask task. This just creates spiFILES_TO_CREATE unique files on SD drive number 0, checks the files were created correctly, then deletes itself. */ xTaskCreate( prvSPIToSDCardTask, /* The task that uses the SSP in SPI mode to implement a file system disk IO driver. */ ( const int8_t * const ) "FSys", /* Text name assigned to the task. This is just to assist debugging. The kernel does not use this name itself. */ configFILE_SYSTEM_DEMO_STACK_SIZE, /* The size of the stack allocated to the task. */ NULL, /* The parameter is not used, so NULL is passed. */ configFILE_SYSTEM_DEMO_TASK_PRIORITY, /* The priority allocated to the task. */ NULL ); /* A handle to the task being created is not required, so just pass in NULL. */ /* Register the file commands with the command interpreter. */ FreeRTOS_CLIRegisterCommand( &xDirCommand ); FreeRTOS_CLIRegisterCommand( &xDelCommand ); FreeRTOS_CLIRegisterCommand( &xCopyCommand ); /* Create the mutex that protects the shared RAM buffer. */ xRamBufferMutex = xSemaphoreCreateMutex(); configASSERT( xRamBufferMutex ); }
/** * @brief Register CLI command */ void LCD_Test(void) { FreeRTOS_CLIRegisterCommand(&xLcdSleep); FreeRTOS_CLIRegisterCommand(&xLcdClear); FreeRTOS_CLIRegisterCommand(&xLcdHome); FreeRTOS_CLIRegisterCommand(&xLcdCursor); FreeRTOS_CLIRegisterCommand(&xLcdMove); FreeRTOS_CLIRegisterCommand(&xLcdLoc); FreeRTOS_CLIRegisterCommand(&xLcdPrint); }
/*************************************************************************************************************************** **************************************************************************************************************************** MAIN PROGRAM **************************************************************************************************************************** ***************************************************************************************************************************/ int main(void) { NP2_boardinit(); Hardware_init(); Hardware_PWM_init(); /* Initilaize the LwIP stack */ LwIP_Init(); /* Create all tasks */ xTaskCreate( (void *) &PanTiltTask, (const signed char *) "PanTilt", PANTILTTASK_STACK_SIZE, NULL, PANTILTTASK_PRIORITY, &xPanTiltTask); xTaskCreate( (void *) &DistanceTask, (const signed char *) "Dist", DISTANCETASK_STACK_SIZE, NULL, DISTANCETASK_PRIORITY, &xDistanceTask); xTaskCreate( (void *) &CLITask, (const signed char *) "CLI", CLI_TASK_STACK_SIZE, NULL, CLI_PRIORITY, &xCLITask); /* Register all CMDs */ FreeRTOS_CLIRegisterCommand(&xTaskUsage); FreeRTOS_CLIRegisterCommand(&xEncode); FreeRTOS_CLIRegisterCommand(&xDecode); FreeRTOS_CLIRegisterCommand(&xLaser); FreeRTOS_CLIRegisterCommand(&xDistance); FreeRTOS_CLIRegisterCommand(&xTracking); /* Start scheduler */ vTaskStartScheduler(); return 0; }
/* Exported function, to start ExtCtrl */ void vTaskExtCtrlStart(void) { GPIO_InitTypeDef xGpioInitStruct; /* Enable GPIO E */ __GPIOD_CLK_ENABLE(); /* Configure TIMX as a time source for external controls measurements * Set prescaler to achieve clock equal to 100kHz (to measure time within * 0.01ms range) */ __TIMX_CLK_ENABLE(); vHardwareTimerSetup(&xTimeBaseHandle, TIMX, 1000000, 100000); /* Start timer */ if(HAL_TIM_Base_Init(&xTimeBaseHandle) != HAL_OK) { vErrorFatal(__LINE__, __FILE__, "prvTaskExtCtrl: Unable to init TIM1"); } if(HAL_TIM_Base_Start_IT(&xTimeBaseHandle) != HAL_OK) { vErrorFatal(__LINE__, __FILE__, "prvTaskExtCtrl: Unable to start TIM1"); } /* Configure GPIO E 0-2 as inputs with pulldown */ xGpioInitStruct.Pin = (GPIO_PIN_0 |GPIO_PIN_1 |GPIO_PIN_3); xGpioInitStruct.Mode = GPIO_MODE_IT_RISING_FALLING; xGpioInitStruct.Pull = GPIO_PULLDOWN; xGpioInitStruct.Speed = GPIO_SPEED_HIGH; HAL_GPIO_Init(GPIOD, &xGpioInitStruct); /* Configure line interrupts */ HAL_NVIC_SetPriority(EXTI0_IRQn, 10, 10); HAL_NVIC_EnableIRQ(EXTI0_IRQn); HAL_NVIC_SetPriority(EXTI1_IRQn, 10, 10); HAL_NVIC_EnableIRQ(EXTI1_IRQn); HAL_NVIC_SetPriority(EXTI3_IRQn, 10, 10); HAL_NVIC_EnableIRQ(EXTI3_IRQn); /* Create data container and semaphore */ xExtCtrlSem = xSemaphoreCreateBinary(); xSemaphoreTake(xExtCtrlSem, 0); xExtCtrl.pitch = 0; xExtCtrl.roll = 0; xExtCtrl.yaw = 0; xSemaphoreGive(xExtCtrlSem); /* Create task and register CLI command */ if(xTaskCreate(prvTaskExtCtrl, "EXTCTRL", configMINIMAL_STACK_SIZE, NULL, 1, NULL) != pdPASS) vErrorFatal(__LINE__, __FILE__, "prvTaskExtCtrl: Unable to start"); FreeRTOS_CLIRegisterCommand(&xTaskExtCtrlDebugCommand); }
void SetupCLI() { // Register all CLI functions FreeRTOS_CLIRegisterCommand( &xSpeedCommand ); FreeRTOS_CLIRegisterCommand( &xAccelCommand ); FreeRTOS_CLIRegisterCommand( &xSendFloorCommand ); FreeRTOS_CLIRegisterCommand( &xEmergencyStopCommand ); FreeRTOS_CLIRegisterCommand( &xEmergencyClearCommand ); FreeRTOS_CLIRegisterCommand( &xTaskStatsCommand ); FreeRTOS_CLIRegisterCommand( &xRunTimeStatsCommand ); }
void vRegisterCLICommands( void ) { /* Register all the command line commands defined immediately above. */ FreeRTOS_CLIRegisterCommand( &prvTaskStatsCommandDefinition ); FreeRTOS_CLIRegisterCommand( &prvRunTimeStatsCommandDefinition ); FreeRTOS_CLIRegisterCommand( &prvThreeParameterEchoCommandDefinition ); FreeRTOS_CLIRegisterCommand( &prvMultiParameterEchoCommandDefinition ); FreeRTOS_CLIRegisterCommand( &prvCreateTaskCommandDefinition ); FreeRTOS_CLIRegisterCommand( &prvDeleteTaskCommandDefinition ); }
void vRegisterCLICommands(void) { /* Register all the command line commands defined immediately above. */ FreeRTOS_CLIRegisterCommand(&task_stats_command_definition); FreeRTOS_CLIRegisterCommand(&run_time_stats_command_definition); FreeRTOS_CLIRegisterCommand(&three_parameter_echo_command_definition); FreeRTOS_CLIRegisterCommand(&multi_parameter_echo_command_definition); FreeRTOS_CLIRegisterCommand(&create_task_command_definition); FreeRTOS_CLIRegisterCommand(&delete_task_command_definition); }
void vRegisterCLICommands( void ) { /* Register all the command line commands defined immediately above. */ FreeRTOS_CLIRegisterCommand( &xTaskStats ); FreeRTOS_CLIRegisterCommand( &xRunTimeStats ); FreeRTOS_CLIRegisterCommand( &xThreeParameterEcho ); FreeRTOS_CLIRegisterCommand( &xParameterEcho ); FreeRTOS_CLIRegisterCommand( &xIPDebugStats ); FreeRTOS_CLIRegisterCommand( &xIPConfig ); #if ipconfigSUPPORT_OUTGOING_PINGS == 1 { FreeRTOS_CLIRegisterCommand( &xPing ); } #endif /* ipconfigSUPPORT_OUTGOING_PINGS */ #if configINCLUDE_TRACE_RELATED_CLI_COMMANDS == 1 FreeRTOS_CLIRegisterCommand( & xStartStopTrace ); #endif }
/** * @brief Configure gpio */ void WATER_Init(void) { // Enable GPIO clock RCC_AHB1PeriphClockCmd(WATER_GPIO_CLOCK_PORT, ENABLE); // Configure key pin to analog input GPIO_InitTypeDef GPIO_InitStructure; GPIO_StructInit(&GPIO_InitStructure); GPIO_InitStructure.GPIO_Pin = WATER_PIN_NUM; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; GPIO_Init(WATER_PIN_PORT, &GPIO_InitStructure); GPIO_SetBits(WATER_PIN_PORT, WATER_PIN_NUM); // set default water time m_waterTime.RTC_AlarmTime.RTC_H12 = RTC_H12_AM; m_waterTime.RTC_AlarmTime.RTC_Hours = WATER_DEFAULT_HOUR; m_waterTime.RTC_AlarmTime.RTC_Minutes = WATER_DEFAULT_MINUTE; m_waterTime.RTC_AlarmTime.RTC_Seconds = WATER_DEFAULT_SECOND; m_waterTime.RTC_AlarmMask = RTC_AlarmMask_DateWeekDay; RTC_SetAlarm(RTC_Format_BIN, RTC_Alarm_A, &m_waterTime); RTC_AlarmCmd(RTC_Alarm_A, ENABLE); m_period = WATER_DEFAULT_PERIOD; m_moistureThreshold = WATER_DEFAULT_MOISTURE_THRESHOLD; m_waterLock = xSemaphoreCreateMutex(); // Create that task that handles the console itself. xTaskCreate( WATER_Task, /* The task that implements the command console. */ "WATER", /* Text name assigned to the task. This is just to assist debugging. The kernel does not use this name itself. */ WATER_TASK_STACK, /* The size of the stack allocated to the task. */ NULL, /* The parameter is not used, so NULL is passed. */ WATER_TASK_PRIORITY, /* The priority allocated to the task. */ &m_waterTask ); /* A handle is not required, so just pass NULL. */ #if SUPPORT_WATER_TEST_COMMAND FreeRTOS_CLIRegisterCommand(&xWaterOpen); #endif }
void vRegisterCLICommands( void ) { static BaseType_t xCommandRegistered = pdFALSE; /* Prevent commands being registered more than once. */ if( xCommandRegistered == pdFALSE ) { /* Register all the command line commands defined immediately above. */ FreeRTOS_CLIRegisterCommand( &xTaskStats ); FreeRTOS_CLIRegisterCommand( &xRunTimeStats ); FreeRTOS_CLIRegisterCommand( &xThreeParameterEcho ); FreeRTOS_CLIRegisterCommand( &xParameterEcho ); //FreeRTOS_CLIRegisterCommand( &xIPDebugStats ); FreeRTOS_CLIRegisterCommand( &xIPConfig ); #if ipconfigSUPPORT_OUTGOING_PINGS == 1 { FreeRTOS_CLIRegisterCommand( &xPing ); } #endif /* ipconfigSUPPORT_OUTGOING_PINGS */ #ifdef ipconfigUSE_TCP { #if ipconfigUSE_TCP == 1 { FreeRTOS_CLIRegisterCommand( &xNetStats ); } #endif /* ipconfigUSE_TCP == 1 */ } #endif /* ifdef ipconfigUSE_TCP */ #if configINCLUDE_TRACE_RELATED_CLI_COMMANDS == 1 { FreeRTOS_CLIRegisterCommand( & xStartStopTrace ); } #endif xCommandRegistered = pdTRUE; } }
void vRegisterCLICommands( void ) { /* Register all the command line commands defined immediately above. */ FreeRTOS_CLIRegisterCommand( &xTaskStats ); }
void KEY_Test(void) { FreeRTOS_CLIRegisterCommand(&xKeyGet); FreeRTOS_CLIRegisterCommand(&xKeySleep); }