Int main() { Task_Params taskParams; /* Call board init functions */ Board_initGeneral(); Board_initGPIO(); Board_initPWM(); Board_initUART(); Board_initI2C(); GPIO_write(Board_LED0, Board_LED_ON); GPIO_write(Board_LED1, Board_LED_OFF); Task_Params_init(&taskParams); taskParams.priority = 2; objTask[0] = Task_create (Task_IDLE, &taskParams, NULL); Task_Params_init(&taskParams); taskParams.priority = 1; objTask[1] = Task_create (Task_GPIO, &taskParams, NULL); Task_Params_init(&taskParams); taskParams.priority = 1; objTask[2] = Task_create (Task_PWM, &taskParams, NULL); #if 0 //for use Lowlevel SIO API Task_Params_init(&taskParams); taskParams.priority = 1; objTask[3] = Task_create (Task_UART, &taskParams, NULL); #else //for use Highlevel SIO API(printf, scanf) add_device("UART", _MSA, UARTUtils_deviceopen, UARTUtils_deviceclose, UARTUtils_deviceread, UARTUtils_devicewrite, UARTUtils_devicelseek, UARTUtils_deviceunlink, UARTUtils_devicerename); /* Open UART0 for writing to stdout and set buffer */ freopen("UART:0", "w", stdout); setvbuf(stdout, NULL, _IOLBF, 128); /* Open UART0 for reading from stdin and set buffer */ freopen("UART:0", "r", stdin); setvbuf(stdin, NULL, _IOLBF, 128); /* * Initialize UART port 0 used by SysCallback. This and other SysCallback * UART functions are implemented in UARTUtils.c. Calls to System_printf * will go to UART0, the same as printf. */ UARTUtils_systemInit(0); #endif Task_Params_init(&taskParams); taskParams.priority = 1; objTask[4] = Task_create (Task_I2C, &taskParams, NULL); BIOS_start(); /* does not return */ return(0); }
/* * ======== main ======== */ Int main(Void) { Mailbox_Params mboxParams; /* Task_Params grlibTaskParams; Task_Params consoleTaskParams; Task_Handle grlibTaskHandle; Task_Handle consoleTaskHandle;*/ Error_Block eb; /* Init board-specific functions. */ Board_initGeneral(); Board_initGPIO(); Board_initUART(); Board_initUSB(Board_USBDEVICE); /* Turn on user LED */ // GPIO_write(DK_TM4C123G_LED, DK_TM4C123G_LED_ON); add_device("UART", _MSA, UARTUtils_deviceopen, UARTUtils_deviceclose, UARTUtils_deviceread, UARTUtils_devicewrite, UARTUtils_devicelseek, UARTUtils_deviceunlink, UARTUtils_devicerename); /* Open UART0 for writing to stdout and set buffer */ freopen("UART:0", "w", stdout); setvbuf(stdout, NULL, _IOLBF, 128); /* Open UART0 for reading from stdin and set buffer */ freopen("UART:0", "r", stdin); setvbuf(stdin, NULL, _IOLBF, 128); /* * Initialize UART port 0 used by SysCallback. This and other SysCallback * UART functions are implemented in UARTUtils.c. Calls to System_printf * will go to UART0, the same as printf. */ UARTUtils_systemInit(0); /* Init LCD and USBCDC */ LCD_init(); // USBCDCD_init(); TouchScreenInit(); TouchScreenCallbackSet(grlibTouchTaskFxn); Bounder_set(); LED_OFF(); /* Init and enable interrupts */ GPIO_setupCallbacks(&EK_TM4C123GXL_gpioPortFCallbacks); GPIO_enableInt(EK_TM4C123GXL_SW1, GPIO_INT_RISING); GPIO_enableInt(EK_TM4C123GXL_SW2, GPIO_INT_RISING); /* SYS/BIOS Mailbox create */ Error_init(&eb); Mailbox_Params_init(&mboxParams); mailboxHandle = Mailbox_create(sizeof(DrawMessage), 2, &mboxParams, &eb); if (mailboxHandle == NULL) { System_abort("Mailbox create failed\nAborting..."); } /* Console task create */ /* Error_init(&eb); Task_Params_init(&consoleTaskParams); consoleTaskParams.instance->name = "consoleTask"; consoleTaskParams.stackSize = 1024; consoleTaskParams.priority = 2; consoleTaskHandle = Task_create(consoleTaskFxn, &consoleTaskParams, &eb); if (consoleTaskHandle == NULL) { System_abort("Console task was not created\nAborting..."); } Grlib task create Error_init(&eb); Task_Params_init(&grlibTaskParams); grlibTaskParams.instance->name = "grlibTask"; grlibTaskParams.stackSize = 2048; grlibTaskParams.priority = 1; grlibTaskHandle = Task_create(grlibTaskFxn, &grlibTaskParams, &eb); if (grlibTaskHandle == NULL) { System_abort("Grlib task was not created\nAborting..."); }*/ System_printf("Starting the example\n%s, %s", "System provider is set to SysMin", "halt the target and use ROV to view output.\n"); /* SysMin will only print to the console when you call flush or exit */ System_flush(); USBCDCD_init();//?????? why not working fillBox(4); fillBox(4); output(4,Array2048); /* Start BIOS. Will not return from this call. */ BIOS_start(); return (0); }