Esempio n. 1
0
int main()
{
    int i[4],d,e;
    /* Config LED,BUTTON,LCD,PIT */
    LED_Init();
    Button_init();
    Pit_init();

    MCG_FEI();
    Uart0_init(115200); // selection baud with FEQ =48MHZ
    /*	-	Baud rate: 115200, Data bit: 8; Parity: None; Stop bits: 1; Flow Control: None. */

    LED_On(1); //LED DO;
    LED_On(0); //LED Xanh
    while(1)
    {

        i[0] =string_compare(buffer,command[0]);
        i[1] =string_compare(buffer,command[1]);
        i[2] =string_compare(buffer,command[2]);
        i[3] =string_compare(buffer,command[3]);
        if(i[0] == 1)
            LED_On(1);

        if(i[1] == 1)
            LED_Off(1);

        if(i[2] == 1)
            LED_On(0);

        if(i[3] == 1)
            LED_Off(0);

    }
}
Esempio n. 2
0
int main(int argc, char **argv) {

	Motor_init();
	Sensor_init();
	Button_init();
	Compass_init();
	
	turnCount = 0;
	
	while(1) {
		int front = (Sensor_getDistance(Sensor_FRONT_LEFT) +
					Sensor_getDistance(Sensor_FRONT_RIGHT)) / 2;
		
		while(front > 20) {
			if(Compass_inRange(startDir, 15, 180))
				Motor_steerLeft(0.9);
			else if(Compass_inRange(startDir, 180, 45))
				Motor_steerRight(0.9);
			else
				Motor_forward();
		}
		
		hugObstacle();
	}
	
	Motor_cleanUp();
	Sensor_cleanUp();
	Button_cleanUp();
}
Esempio n. 3
0
File: appgui.c Progetto: dmdware/vec
void FillGUI()
{
	Widget *gui;
	ViewLayer *logo, *loading, *menu;
	Button *but;

	gui = (Widget*)&g_gui;
	GUI_init((GUI*)gui);

	logo = (ViewLayer*)malloc(sizeof(ViewLayer));
	loading = (ViewLayer*)malloc(sizeof(ViewLayer));
	menu = (ViewLayer*)malloc(sizeof(ViewLayer));
	but = (Button*)malloc(sizeof(Button));

	ViewLayer_init(logo, "logo", gui);
	ViewLayer_init(loading, "loading", gui);
	ViewLayer_init(menu, "menu", gui);
	Button_init(but, menu, "",
		"", "label", "tooltip",
		MAINFONT8, BUST_LINEBASED,
		Resize_But, NULL, NULL,
		NULL, NULL,
		NULL, -1, NULL);

	Widget_add(gui, (Widget*)logo);
	Widget_add(gui, (Widget*)loading);
	Widget_add(gui, (Widget*)menu);
	Widget_add(menu, (Widget*)but);

	Widget_hideall(gui);
	Widget_show((Widget*)logo);
}
Esempio n. 4
0
void Main(void) {
	/* Inicializa controladores */
	sys_init();        // Inicializacion de la placa, interrupciones y puertos
	D8Led_init(); // inicializamos el 8led
	Button_init(0, 9); // inicializamos los pulsadores. Cada vez que se pulse se verá reflejado en el 8led

	init_game();
}
Esempio n. 5
0
int main(void){
  PLL_Init();                           // set system clock to 50 MHz
  Nokia5110_Init();											// Initialize LCD 
	Clock_100ms();												// Configure SYSTICK for 100ms interrupt. 
  Nokia5110_Clear();										// Clear the LCD.
	Clock_dial();													// Draw clock dil on LCD. 
	Clock_minutes(M_angle);								// Draw minute hand on the dial.
	Clock_hours(H_angle);									// Draw hour hand on the dial. 
	Button_init();
	
  while(1);
}
Esempio n. 6
0
int main()
{
	
	LED_Init(); 																		// LED init
	Button_init();																	// Init Button
	SysTick_Config(SystemCoreClock/1000);         /* Generate interrupt each 1 ms */
	while(1)
	{
		/* Blinky led with clock by changer */
			Delay(t);								// Delay with t =250 
				LED_On(c_LED); 				// Turn On LED green
				Delay(t);
				LED_Off(c_LED);				// Turn Off LED green

	}
}
void main(void)
{
	system_SetState(SYSTEM_POWER_UP);
	Config_System();

	Button_init();
	Config_Pins();
	LED_Display_init();



	ROM_GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_4, GPIO_PIN_4);
	ROM_GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_7, GPIO_PIN_7);
	ROM_IntMasterEnable();
	Timer_Init();

	while (1)
	{
		system_Process_System_State();
	}
}