コード例 #1
0
/******************************************************************************
 * @name        main
 *
 * @brief       This routine is the starting point of the application
 *
 * @param       None
 *
 * @return      None
 *
 *****************************************************************************
 * This function initializes the system, enables the interrupts and calls the
 * application
 *****************************************************************************/
void main(void)
{
    Init_Sys();        /* initial the system */
#if MAX_TIMER_OBJECTS
    (void)TimerQInitialize(0);
#endif
    (void)TestApp_Init(); /* Initialize the USB Test Application */
#if MAX_TIMER_OBJECTS
    StartKeyPressSimulationTimer();
#endif
    while(TRUE)
    {
       Watchdog_Reset();

       /* Call the application task */
       TestApp_Task();
    }
}
コード例 #2
0
ファイル: D169_VR.c プロジェクト: estel1/sandiaproject
//-----------------------------------------------------------------------------
void main(void)
{
  Init_Sys();                               // Initialize system

  while (1)                                 // Repeat forever
  {
    // wait for key-press event, hold CPU in low-power mode
    P1IFG = 0;                              // Clear all P1.x interrupt flags
    P1IE |= 0xc0;                           // Enable int for buttons
    _BIS_SR(LPM3_bits + GIE);               // Enter LPM3 w/ interrupts
    _DINT();                                // Disable interrupts
    P1IE &= ~0xc0;                          // Disable interrupts for buttons

    // process key-press event
    if (!(P1IN & 0x40))                     // Record button pressed?
      Record();                             
    else                                    // No, -> must be playback button
      Playback();                           
  }
}
コード例 #3
0
/******************************************************************************
 * @name        main
 *
 * @brief       This routine is the starting point of the application
 *
 * @param       None
 *
 * @return      None
 *
 *****************************************************************************
 * This function initializes the system, enables the interrupts and calls the
 * application
 *****************************************************************************/
void 
main(void)
{
    /* Bootloader application */
	GPIO_Bootloader_Init();
	Switch_mode();              /* switch between the application and the bootloader mode */

	Init_Sys();        /* initial the system */
	
#if MAX_TIMER_OBJECTS
    (void)TimerQInitialize(0);
#endif
    (void)TestApp_Init(); /* Initialize the USB Test Application */

    while(TRUE)
    {
       Watchdog_Reset();

       /* Call the application task */
       TestApp_Task();
    }
}
コード例 #4
0
ファイル: main.c プロジェクト: cjameshuff/launchpad_base
int main(void)
{
    Init_Sys();
    ROM_IntMasterEnable();
    DBG_Init();
    
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
    
    // LEDs
    ROM_GPIOPinTypeGPIOOutput(RED_GPIO_BASE, RED_GPIO_PIN);
    GPIOPinWrite(RED_GPIO_BASE, RED_GPIO_PIN, 0);
    ROM_GPIOPinTypeGPIOOutput(GREEN_GPIO_BASE, GREEN_GPIO_PIN);
    GPIOPinWrite(GREEN_GPIO_BASE, GREEN_GPIO_PIN, 0);
    ROM_GPIOPinTypeGPIOOutput(BLUE_GPIO_BASE, BLUE_GPIO_PIN);
    GPIOPinWrite(BLUE_GPIO_BASE, BLUE_GPIO_PIN, 0);
    
    
//     dbg_putstr("\033[2JInitializing...\r\n");
    dbg_putstr("\033[2JInitializing C app...\r\n");
    dbg_putstr("Ready:\r\n");
    
    static uint16_t heartbeat_ctr = 0;
    while(1)
    {
        char cmdbfr[64];
        if(dbg_getline_nb(cmdbfr, 64) > 0)
        {
            GPIOPinWrite(RED_GPIO_BASE, RED_GPIO_PIN, RED_GPIO_PIN);
            dbg_printf("\r\nEntered: %s\r\n", cmdbfr);
        }
        
        if(rx_led_ctr > 0)
        {
            --rx_led_ctr;
            GPIOPinWrite(BLUE_GPIO_BASE, BLUE_GPIO_PIN, BLUE_GPIO_PIN);
        }
        else
        {
            GPIOPinWrite(BLUE_GPIO_BASE, BLUE_GPIO_PIN, 0);
        }
        
        // Blink heartbeat LED
        if(heartbeat_ctr > 0)
        {
            --heartbeat_ctr;
        }
        else
        {
            if(GPIOPinRead(GREEN_GPIO_BASE, GREEN_GPIO_PIN))
            {
                GPIOPinWrite(GREEN_GPIO_BASE, GREEN_GPIO_PIN, 0);
                heartbeat_ctr = 200;
            }
            else
            {
                GPIOPinWrite(GREEN_GPIO_BASE, GREEN_GPIO_PIN, GREEN_GPIO_PIN);
                heartbeat_ctr = 1;
            }
        }
        
        ROM_SysCtlDelay(ROM_SysCtlClockGet()/(1000*3));
    }
}