Beispiel #1
0
/**************************************************************************//**
 * @brief  Main function
 *****************************************************************************/
int main( void )
{
  /* Chip errata */
  CHIP_Init();

  /* Setup GPIO for pushbuttons. */
  GpioSetup();

  /* Initialize the display module. */
  displayEnabled = true;
  DISPLAY_Init();

  /* Retrieve the properties of the display. */
  if ( DISPLAY_DeviceGet( 0, &displayDevice ) != DISPLAY_EMSTATUS_OK )
  {
    /* Unable to get display handle. */
    while( 1 );
  }

  /* Retarget stdio to the display. */
  if ( TEXTDISPLAY_EMSTATUS_OK != RETARGET_TextDisplayInit() )
  {
    /* Text display initialization failed. */
    while( 1 );
  }

  /* Set PCNT to generate an interrupt every second. */
  PcntInit();

  printf( "\n\n Cycling through"
          "\n energy modes"
          "\n EM0-EM3"
          "\n\n Push PB0 to"
          "\n enter EM4\n\n\n\n" );

  /* Turn on LFXO to be able to see the difference between EM2 and EM3. */
  CMU_OscillatorEnable(cmuOsc_LFXO, true, false );

  for (;;)
  {
    printf( "\r      EM0" );
    EnterEMode( 0, SLEEP_TIME );
    CheckEM4Entry();

    printf( "\r      EM1" );
    EnterEMode( 1, SLEEP_TIME );
    CheckEM4Entry();

    printf( "\r      EM2" );
    EnterEMode( 2, SLEEP_TIME );
    CheckEM4Entry();

    printf( "\r      EM3" );
    EnterEMode( 3, SLEEP_TIME );
    CheckEM4Entry();
  }
}
Beispiel #2
0
//------------------------------------------------------------------------------
//
//  Function:  PlatformSetup
//
//  Initializes platform settings.  Stack based initialization only - no 
//  global variables allowed.
//
VOID PlatformSetup()
{
    pCPU_OPP_Settings opp_setting;
	
    //---------------------------------
    // setup dpll timings for mpu dpll
    //
    //if(gCPU_family == CPU_FAMILY_DM37XX)
    //{
	opp_setting = &OMAP37x_OPP_Table[BSP_OPM_SELECT_37XX-1];
    //}
    //else 
    //{
    //    opp_setting = &OMAP35x_OPP_Table[BSP_OPM_SELECT_35XX-1];
    //}
	
    // Initialize the platform
    WatchdogSetup();
    PinMuxSetup();    
	
    ClockSetup(opp_setting); 

	GpioSetup();

    // configure i2c devices
    OALI2CInit(OMAP_DEVICE_I2C1);
    //OALI2CInit(OMAP_DEVICE_I2C2);
    //OALI2CInit(OMAP_DEVICE_I2C3);

    OALI2CPostInit();	
	
    InitTwlPower();

    UpdateVoltageLevels(opp_setting);

    MemorySetup();
}
Beispiel #3
0
void main(void)
{
  G_u32SystemFlags |= _SYSTEM_INITIALIZING;

  /* Low level initialization */
  WatchDogSetup(); /* During development, set to not reset processor if timeout */
  ClockSetup();
  GpioSetup();
  InterruptSetup();
  SysTickSetup();

  /* Driver initialization */
  MessagingInitialize();
  UartInitialize();
  DebugInitialize();

  /* Debug messages through DebugPrintf() are available from here */

  SspInitialize();
  TWIInitialize();
  
  LcdInitialize();
  LedInitialize();
  ButtonInitialize();
   
  CapTouchInitialize();
  AntInitialize();
  
  /* Application initialization */
  UserAppInitialize();
  
  /* Exit initialization */
  SystemStatusReport();
  G_u32SystemFlags &= ~_SYSTEM_INITIALIZING;
   
  /* Super loop */  
  while(1)
  {
    WATCHDOG_BONE();
    
    /* Drivers */
    LedUpdate();
    ButtonRunActiveState();
    UartRunActiveState();
    SspRunActiveState();
    TWIRunActiveState();
    CapTouchRunActiveState(); /* This function violates 1ms loop timing every 25ms */ 
    MessagingRunActiveState();
    DebugRunActiveState();
    LcdRunActiveState();
    AntRunActiveState();

    /* Applications */
    UserAppRunActiveState();
        
    /* System sleep*/
    HEARTBEAT_OFF();
    SystemSleep();
    HEARTBEAT_ON();
    
  } /* end while(1) main super loop */
  
} /* end main() */