//***************************************************************************** // //! main function demonstrates the use of the timers to generate //! periodic interrupts. //! //! \param None //! //! \return none // //***************************************************************************** int main(void) { // // Initialize board configurations BoardInit(); // // Pinmuxing for LEDs // PinMuxConfig(); // // configure the LED RED and GREEN // GPIO_IF_LedConfigure(LED1|LED3); GPIO_IF_LedOff(MCU_RED_LED_GPIO); GPIO_IF_LedOff(MCU_GREEN_LED_GPIO); // // Base address for first timer // g_ulBase = TIMERA0_BASE; // // Base address for second timer // g_ulRefBase = TIMERA1_BASE; // // Configuring the timers // Timer_IF_Init(PRCM_TIMERA0, g_ulBase, TIMER_CFG_PERIODIC, TIMER_A, 0); Timer_IF_Init(PRCM_TIMERA1, g_ulRefBase, TIMER_CFG_PERIODIC, TIMER_A, 0); // // Setup the interrupts for the timer timeouts. // Timer_IF_IntSetup(g_ulBase, TIMER_A, TimerBaseIntHandler); Timer_IF_IntSetup(g_ulRefBase, TIMER_A, TimerRefIntHandler); // // Turn on the timers feeding values in mSec // Timer_IF_Start(g_ulBase, TIMER_A, 500); Timer_IF_Start(g_ulRefBase, TIMER_A, 1000); // // Loop forever while the timers run. // while(FOREVER) { } }
/* EFFECTS: Initializes Timer A and enables it */ void TimerConfigNStart() { // Configure Timer for blinking the LED for IP acquisition Timer_IF_Init(PRCM_TIMERA0, TIMERA0_BASE, TIMER_CFG_PERIODIC, TIMER_A, 0); Timer_IF_IntSetup(TIMERA0_BASE, TIMER_A, TimerPeriodicIntHandler); Timer_IF_Start(TIMERA0_BASE, TIMER_A, TIME_IN_MSECS); }
//**************************************************************************** // //! Function to configure and start timer to blink the LED while device is //! trying to connect to an AP //! //! \param none //! //! return none // //**************************************************************************** void LedTimerConfigNStart() { // // Configure Timer for blinking the LED for IP acquisition // Timer_IF_Init(PRCM_TIMERA0,TIMERA0_BASE,TIMER_CFG_PERIODIC,TIMER_A,0); Timer_IF_IntSetup(TIMERA0_BASE,TIMER_A,TimerPeriodicIntHandler); Timer_IF_Start(TIMERA0_BASE,TIMER_A,100); // time value is in mSec }
//**************************************************************************** // //! Function to configure and start timer to blink the LED while device is //! trying to connect to an AP //! //! \param none //! //! return none // //**************************************************************************** void LedTimerConfigNStart() { // // Configure Timer for blinking the LED for IP acquisition // Timer_IF_Init(PRCM_TIMERA0,TIMERA0_BASE,TIMER_CFG_PERIODIC,TIMER_A,0); Timer_IF_IntSetup(TIMERA0_BASE,TIMER_A,TimerPeriodicIntHandler); Timer_IF_Start(TIMERA0_BASE,TIMER_A,PERIODIC_TEST_CYCLES / 10); }
//**************************************************************************** // //! Implements Sleep followed by wakeup using GPT timeout //! //! \param none //! //! This function //! 1. Implements Sleep followed by wakeup using GPT //! //! \return None. // //**************************************************************************** void PerformPRCMSleepGPTWakeup() { // // Power On the GPT along with sleep clock // MAP_PRCMPeripheralClkEnable(PRCM_TIMERA0, PRCM_RUN_MODE_CLK); // // Initialize the GPT as One Shot timer // Timer_IF_Init(PRCM_TIMERA0, TIMERA0_BASE, TIMER_CFG_ONE_SHOT, TIMER_BOTH, 0); Timer_IF_IntSetup(TIMERA0_BASE, TIMER_BOTH, AppGPTCallBackHandler); // // Start timer with value in mSec // Timer_IF_Start(TIMERA0_BASE, TIMER_BOTH, 4000); // // Enable the Sleep Clock // MAP_PRCMPeripheralClkEnable(PRCM_TIMERA0, PRCM_SLP_MODE_CLK); // // Enter SLEEP...WaitForInterrupt ARM intrinsic // DBG_PRINT("GPT_SLEEP: Entering Sleep\n\r"); MAP_UtilsDelay(80000); MAP_PRCMSleepEnter(); DBG_PRINT("GPT_SLEEP: Exiting Sleep\n\r"); // // Disable the Sleep Clock // MAP_PRCMPeripheralClkDisable(PRCM_TIMERA0, PRCM_SLP_MODE_CLK); // // Deinitialize the GPT // Timer_IF_Stop(TIMERA0_BASE, TIMER_BOTH); Timer_IF_DeInit(TIMERA0_BASE, TIMER_BOTH); // // PowerOff GPT // MAP_PRCMPeripheralClkDisable(PRCM_TIMERA0, PRCM_RUN_MODE_CLK); }
//***************************************************************************** // MAIN FUNCTION //***************************************************************************** void main() { long lRetVal = -1; // // Board Initialization // BoardInit(); // // configure the GPIO pins for LEDs,UART // PinMuxConfig(); // // Configure the UART // #ifndef NOTERM InitTerm(); #endif //NOTERM // // Display Application Banner // DisplayBanner(APPLICATION_NAME); // // Configure all 3 LEDs // GPIO_IF_LedConfigure(LED1|LED2|LED3); // switch off all LEDs GPIO_IF_LedOff(MCU_ALL_LED_IND); // // SysTick Enabling // //SysTickIntRegister(SysTickHandler); ///SysTickPeriodSet(SYSTICK_RELOAD_VALUE); //SysTickEnable(); // // Base address for first timer // g_ulBase = TIMERA0_BASE; // // Configuring the timers // Timer_IF_Init(PRCM_TIMERA0, g_ulBase, TIMER_CFG_PERIODIC, TIMER_A, 0); // // Setup the interrupts for the timer timeouts. // Timer_IF_IntSetup(g_ulBase, TIMER_A, TimerBaseIntHandler); // // Turn on the timers feeding values in mSec // Timer_IF_Start(g_ulBase, TIMER_A, 1000); // // Start the SimpleLink Host // lRetVal = VStartSimpleLinkSpawnTask(SPAWN_TASK_PRIORITY); if(lRetVal < 0) { ERR_PRINT(lRetVal); LOOP_FOREVER(); } // // Start the WlanStationMode task // lRetVal = osi_TaskCreate( WlanStationMode, \ (const signed char*)"Wlan Station Task", \ OSI_STACK_SIZE, NULL, 1, NULL ); if(lRetVal < 0) { ERR_PRINT(lRetVal); LOOP_FOREVER(); } // // Start the task scheduler // osi_start(); }