int main(void) { // Run from the PLL at 120 MHz. g_ui32SysClock = MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_480), configCPU_CLOCK_HZ); // Initialize the device pinout appropriately for this board. pin_init(); // // Initialize the UART and write status. // ConfigureUART(); // 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. SysCtlMOSCConfigSet(SYSCTL_MOSC_HIGHFREQ); // Create the LED task. if (LEDTaskInit() != 0) { while (1) { } } // Create the lwIP tasks. if (lwIPTaskInit() != 0) { while (1) { } } // Create the hello world task. /*if (hello_world_init() != 0) { while (1) { } }*/ UARTprintf("FreeRTOS + Lwip\n"); // Start the scheduler. This should not return. vTaskStartScheduler(); // In case the scheduler returns for some reason, loop forever. while (1) { } }
int main() { // // 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. // SysCtlMOSCConfigSet(SYSCTL_MOSC_HIGHFREQ); // // Run from the PLL at 120 MHz. // g_ui32SysClock = MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_480), 120000000); // Configure the device pins. // PinoutSet(true, false); // // Configure UART. // //UARTStdioConfig(0, 115200, g_ui32SysClock); // // Clear the terminal and print banner. // //UARTprintf("\033[2J\033[H"); //UARTprintf("Ethernet lwIP example\n\n"); // // Configure Port N1 for as an output for the animation LED. // MAP_GPIOPinTypeGPIOOutput(GPIO_PORTN_BASE, GPIO_PIN_1); MAP_GPIOPinTypeGPIOOutput(GPIO_PORTN_BASE, GPIO_PIN_0); MAP_GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_1); // // Initialize LED to OFF (0) // MAP_GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_1, ~GPIO_PIN_1); MAP_GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_0, ~GPIO_PIN_0); MAP_GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_1, ~GPIO_PIN_1); // // Configure SysTick for a periodic interrupt. // MAP_SysTickPeriodSet(g_ui32SysClock / SYSTICKHZ); MAP_SysTickEnable(); MAP_SysTickIntEnable(); // Init Onion Client client = new OnionClient("o8Ik6DuC","NfyGRECh3WSZw9xn"); client->registerFunction("/on",ledOn,0,0); client->registerFunction("/off",ledOff,0,0); char *params[1] = {"data"}; client->registerFunction("/pubTest",pubTest,params,1); client->init(g_ui32SysClock); // // Setup Onion Client // //httpd_init(); //client->begin(); // // Set the interrupt priorities. We set the SysTick interrupt to a higher // priority than the Ethernet interrupt to ensure that the file system // tick is processed if SysTick occurs while the Ethernet handler is being // processed. This is very likely since all the TCP/IP and HTTP work is // done in the context of the Ethernet interrupt. // MAP_IntPrioritySet(INT_EMAC0, ETHERNET_INT_PRIORITY); MAP_IntPrioritySet(FAULT_SYSTICK, SYSTICK_INT_PRIORITY); // // Loop forever. All the work is done in interrupt handlers. // uint32_t last_time = g_millis; bool led = false; while(1) { if ((g_millis - last_time) > 500) { if (led) { MAP_GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_0, ~GPIO_PIN_0); led = false; } else { MAP_GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_0, GPIO_PIN_0); led = true; } last_time = g_millis; } client->loop(); } return 0; }
//***************************************************************************** // // Initialize FreeRTOS and start the initial set of tasks. // //***************************************************************************** int main(void) { tContext sContext; // // Run from the PLL at 120 MHz. // g_ui32SysClock = MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_480), configCPU_CLOCK_HZ); // // Initialize the device pinout appropriately for this board. // PinoutSet(); // // Initialize the display driver. // Kentec320x240x16_SSD2119Init(g_ui32SysClock); // // Initialize the graphics context. // GrContextInit(&sContext, &g_sKentec320x240x16_SSD2119); // // Draw the application frame. // FrameDraw(&sContext, "freertos-demo"); // // 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. // SysCtlMOSCConfigSet(SYSCTL_MOSC_HIGHFREQ); // // Create the display task. // if(DisplayTaskInit() != 0) { GrContextForegroundSet(&sContext, ClrRed); GrStringDrawCentered(&sContext, "Failed to create display task!", -1, GrContextDpyWidthGet(&sContext) / 2, (((GrContextDpyHeightGet(&sContext) - 24) / 2) + 24), 0); while(1) { } } // // Create the spider task. // if(SpiderTaskInit() != 0) { GrContextForegroundSet(&sContext, ClrRed); GrStringDrawCentered(&sContext, "Failed to create spider task!", -1, GrContextDpyWidthGet(&sContext) / 2, (((GrContextDpyHeightGet(&sContext) - 24) / 2) + 24), 0); while(1) { } } // // Create the LED task. // if(LEDTaskInit() != 0) { GrContextForegroundSet(&sContext, ClrRed); GrStringDrawCentered(&sContext, "Failed to create LED task!", -1, GrContextDpyWidthGet(&sContext) / 2, (((GrContextDpyHeightGet(&sContext) - 24) / 2) + 24), 0); while(1) { } } // // Create the lwIP tasks. // if(lwIPTaskInit() != 0) { GrContextForegroundSet(&sContext, ClrRed); GrStringDrawCentered(&sContext, "Failed to create lwIP tasks!", -1, GrContextDpyWidthGet(&sContext) / 2, (((GrContextDpyHeightGet(&sContext) - 24) / 2) + 24), 0); while(1) { } } // // Start the scheduler. This should not return. // vTaskStartScheduler(); // // In case the scheduler returns for some reason, print an error and loop // forever. // GrContextForegroundSet(&sContext, ClrRed); GrStringDrawCentered(&sContext, "Failed to start scheduler!", -1, GrContextDpyWidthGet(&sContext) / 2, (((GrContextDpyHeightGet(&sContext) - 24) / 2) + 24), 0); while(1) { } }