int main(void) { SetSysClockTo56(); // ROS nodehandle initialization and topic registration nh.initNode(); // Initialize debug LED GPIO_InitTypeDef GPIO_Config; RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE); GPIO_Config.GPIO_Pin = GPIO_Pin_5; GPIO_Config.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_Config.GPIO_Speed = GPIO_Speed_50MHz; GPIO_Init(GPIOB, &GPIO_Config); GPIO_WriteBit(GPIOB, GPIO_Pin_5, Bit_RESET); // Start ROS spin task, responsible for handling callbacks and communications if (spinInitTask(&nh)) { // Turn on LED on error GPIO_WriteBit(GPIOB, GPIO_Pin_5, Bit_SET); while (1); } // Register and init publish task if (publishInitTask(&nh)) { // Turn on LED on error GPIO_WriteBit(GPIOB, GPIO_Pin_5, Bit_SET); while (1); } // Register and init subscribe task if (subscribeInitTask(&nh)) { // Turn on LED on error GPIO_WriteBit(GPIOB, GPIO_Pin_5, Bit_SET); while (1); } // Enter scheduler and loop forever vTaskStartScheduler(); // In case the scheduler returns for some reason,. while (1) { // Turn on LED on error GPIO_WriteBit(GPIOB, GPIO_Pin_5, Bit_SET); } }
// Initialize FreeRTOS and start the initial set of tasks. int main(void) { // TivaC application specific code MAP_FPUEnable(); MAP_FPULazyStackingEnable(); // Run from the PLL at 120 MHz. MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_480), TM4C129FREQ); // Make sure the main oscillator is enabled because this is required by // the PHY. The system must have a 25MHz crystal attached to the OSC // pins. The SYSCTL_MOSC_HIGHFREQ parameter is used when the crystal // frequency is 10MHz or higher. MAP_SysCtlMOSCConfigSet(SYSCTL_MOSC_HIGHFREQ); MAP_IntEnable(FAULT_NMI); MAP_IntEnable(FAULT_MPU); MAP_IntEnable(FAULT_BUS); MAP_IntEnable(FAULT_USAGE); ConfigUART(115200); UARTprintf("\n\nWelcome to the EK-TM4C129XL FreeRTOS Demo!\n"); // ROS nodehandle initialization and topic registration nh.initNode("192.168.1.135"); // Start ROS spin task, responsible for handling callbacks and communications if (spinInitTask(&nh)) { UARTprintf("Couldn't create ROS spin task.\n"); while (1); } else { UARTprintf("Created ROS spin task.\n"); } // Register and init subscribe task if (subscribeInitTask(&nh)) { UARTprintf("Couldn't create subscribe task.\n"); while (1); } else { UARTprintf("Created subscribe task.\n"); } // Register and init publish task if (publishInitTask(&nh)) { UARTprintf("Couldn't create publish task.\n"); while (1); } else { UARTprintf("Created publish task.\n"); } // Start the scheduler. This should not return. UARTprintf("Starting scheduller.\n"); vTaskStartScheduler(); // In case the scheduler returns for some reason, print an error and loop forever. while (1) { UARTprintf("Scheduler returned!\n"); } }