/* * ======== Board_init ======== * Initialialize the ti.platforms.tink2 hardware */ void Board_init(void) { /* driver-independent initialization */ Board_initGeneral(); /* driver-specific initialization */ Board_initGPIO(); Board_initPWM(); Board_initPower(); }
/* * ======== main ======== */ int main(void) { /* Call board init functions. */ Board_initGeneral(); Board_initGPIO(); Board_initPWM(); /* Turn on user LED */ GPIO_write(Board_LED0, Board_LED_ON); System_printf("Starting the example\nSystem provider is set to SysMin. " "Halt the target to view any SysMin contents in ROV.\n"); /* SysMin will only print to the console when you call flush or exit */ System_flush(); /* Start BIOS */ BIOS_start(); return (0); }
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); }