Esempio n. 1
0
/*----------------------------------------------------------------------------
 * main: blink LED and check button state
 *----------------------------------------------------------------------------*/
int main (void) {
  int32_t max_num = LED_GetCount();
  int32_t num = 0;

  SystemCoreClockConfigure();                              // configure HSI as System Clock
  SystemCoreClockUpdate();

  LED_Initialize();
  Buttons_Initialize();
  SER_Initialize();

  SysTick_Config(SystemCoreClock / 1000);                  // SysTick 1 msec interrupts

  for (;;) {
    LED_On(num);                                           // Turn specified LED on
//    Delay(100);                                            // Wait 500ms
//    while (Buttons_GetState() & (1 << 0));                 // Wait while holding USER button
    LED_Off(num);                                          // Turn specified LED off
//    Delay(100);                                            // Wait 500ms
//    while (Buttons_GetState() & (1 << 0));                 // Wait while holding USER button

//    num++;                                                 // Change LED number
//    if (num >= max_num) {
//      num = 0;                                             // Restart with first LED
//    }

//    printf ("Hello World\n\r");
  }

}
Esempio n. 2
0
void IO_Init(void){
	
	/* configure HSI as System Clock */
	SystemCoreClockInit();
  SystemCoreClockUpdate();
	SysTick_Config(SystemCoreClock / 1000);  // SysTick 1 msec interrupts
	
  /* Port initializations */
	GPIO_Output_Init(GPIOA,Green_LED);										//LD2 Initialization
	Button_Initialize();																	//User button init
	
	/* Serial Communications Initializations */
  SER_Initialize();
	USART1_Init();		/* For the GPS */
	LPUART_Init();		/* For XBee */
	
	/* ADC Initializations */
	ADC_Init();
	
	/* I2C Initialization */
	I2C_Init();
	
	/* Mems board Initialization */
	ISK01A1_Init();
	
	/* GPS Initialization with 1 second refresh rate */
	FGPMMOPA6H_Init(4);
	
	/* XBee Initialization */
	/* Note that setup takes 2 seconds due to 1 second delays required
	 * By the XBee AT command Sequence
	 */
	XBee_900HP_Init();			//Used with long distance 900 MHz XBee
//	XBee_ProS1_Init();			//Used with 2.4 GHz Xbee
	
	/*Position the servo*/
	Servo_Position(0);
}