/* * ======== main ======== */ int main(void) { /* Call board init functions */ Board_initGeneral(); Board_initGPIO(); /* Turn on user LED */ GPIO_write(Board_LED0, Board_LED_ON); System_printf("Starting the SMS Door Bell example\nSystem provider is set" " to SysMin. Halt the target to view any SysMin contents in" " ROV.\n\n"); /* SysMin will only print to the console when you call flush or exit */ System_flush(); /* Turn off All LEDs. It will be used as a connection indicator */ GPIO_write(Board_LED0, Board_LED_ON); //Red //GPIO_write(Board_LED1, Board_LED_ON); //Orange //GPIO_write(Board_LED2, Board_LED_ON); //Green /* install Button callback */ GPIO_setCallback(Board_BUTTON0, gpioButtonFxn0); /* Enable interrupts */ GPIO_enableInt(Board_BUTTON0); /* * If more than one input pin is available for your device, interrupts * will be enabled on Board_BUTTON1. */ // if (Board_BUTTON0 != Board_BUTTON1) { // /* install Button callback */ // GPIO_setCallback(Board_BUTTON1, gpioButtonFxn1); // GPIO_enableInt(Board_BUTTON1); // } /* * The SimpleLink Host Driver requires a mechanism to allow functions to * execute in temporary context. The SpawnTask is created to handle such * situations. This task will remain blocked until the host driver * posts a function. If the SpawnTask priority is higher than other tasks, * it will immediately execute the function and return to a blocked state. * Otherwise, it will remain ready until it is scheduled. */ VStartSimpleLinkSpawnTask(SPAWN_TASK_PRI); /* Start BIOS */ BIOS_start(); return (0); }
void buttonInit(void){ GPIO_setCallback(Board_BUTTON0, gpioButton0); GPIO_enableInt(Board_BUTTON0); /* Configure RGB LED pins */ GPIO_setAsOutputPin(GPIO_PORT_P2, GPIO_PIN4 | GPIO_PIN6); GPIO_setAsOutputPin(GPIO_PORT_P5, GPIO_PIN6); /* Set RGB LED to red */ P2OUT |= BIT6; P2OUT &= ~BIT4; P5OUT &= ~BIT6; /* Setup Button */ GPIO_setAsInputPinWithPullUpResistor(GPIO_PORT_P5,GPIO_PIN1); GPIO_clearInterruptFlag(GPIO_PORT_P5, GPIO_PIN1); GPIO_enableInterrupt(GPIO_PORT_P5, GPIO_PIN1); GPIO_interruptEdgeSelect(GPIO_PORT_P5, GPIO_PIN1, GPIO_HIGH_TO_LOW_TRANSITION); Interrupt_enableInterrupt(INT_PORT5); }
void HWI::begin(uint8_t pinNumber, void (*functionHWI)(void), int mode) { // Error_Block eb; // Error_init(&eb); // // Hwi_Params hwiParams; // Hwi_Params_init(&hwiParams); // // HWIHandle = Hwi_create(interruptNumber, (Hwi_FuncPtr)functionHWI, &hwiParams, &eb); // from msp432/cores/msp432/WInterrupts.c HWIpin = pinNumber; GPIO_PinConfig intType; switch (mode) { case LOW: intType = GPIO_CFG_IN_INT_LOW; break; case CHANGE: intType = GPIO_CFG_IN_INT_BOTH_EDGES; break; case RISING: intType = GPIO_CFG_IN_INT_RISING; break; case FALLING: intType = GPIO_CFG_IN_INT_FALLING; break; case HIGH: intType = GPIO_CFG_IN_INT_HIGH; break; } GPIO_setConfig(pinNumber, GPIO_CFG_IN_INT_ONLY | intType); GPIO_setCallback(pinNumber, (GPIO_CallbackFxn)functionHWI); GPIO_enableInt(pinNumber); }
//***************************************************************************** // //! Main application function. //! //! This function is meant to initialize all devices and tasks used in this //! application. After the initialization is complete, the tasks start running. //! //! \return None. // //***************************************************************************** int main(void) { // Initialize General configurations Board_initGeneral(); // Initialize GPIO Board_initGPIO(); // Turn off all LEDS GPIO_write(Board_LED0, Board_LED_OFF); GPIO_write(Board_LED1, Board_LED_OFF); GPIO_write(Board_LED2, Board_LED_OFF); // Initializes interrupts GPIO_setCallback(Board_BUTTON0, _callback_Button_Select); GPIO_setCallback(Board_BUTTON1, _callback_Button_Up); GPIO_setCallback(Board_BUTTON2, _callback_Button_Down); GPIO_setCallback(Board_SENSE_RISER_DOWN, _callback_Festo_Riser_Down); GPIO_setCallback(Board_SENSE_RISER_UP, _callback_Festo_Riser_Up); GPIO_setCallback(Board_SENSE_SAMPLE_IN_PLACE, _callback_Festo_Piece_In); // Enable Interrupts GPIO_enableInt(Board_BUTTON0); GPIO_enableInt(Board_BUTTON1); GPIO_enableInt(Board_BUTTON2); GPIO_enableInt(Board_SENSE_RISER_DOWN); GPIO_enableInt(Board_SENSE_RISER_UP); GPIO_enableInt(Board_SENSE_SAMPLE_IN_PLACE); Seconds_set(1432639800); // Start BIOS BIOS_start(); 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); }