Beispiel #1
0
void HardFault_Handler(void)
{
	config_led(LED2);
	config_led(LED3);
	config_led(LED4);
	
	for( ; ; );
}
Beispiel #2
0
int main(void)
{
	fpb_setup();
	
	config_led(LED1);
	turn_led_off(LED1); // We want to redirect this function call with the FPB unit, and instead call turn_led_on(LED1), located at 0x7F000, defined in 'new_function.c.'
	
	config_led(LED2);
	turn_led_off(LED2);
	
	config_led(LED3);
	turn_led_off(LED3);

	for( ; ; );
}
Beispiel #3
0
int main(void)
{
	system_init();

	/*Configure system tick to generate periodic interrupts */
	SysTick_Config(system_gclk_gen_get_hz(GCLK_GENERATOR_0));

	config_led();

	while (true) {
	}
}
Beispiel #4
0
int main(void)
{
	uint8_t vetor[TAMANHO+1];
	uint8_t uc_key;
	uint8_t rtn;

	/* Initialize the system */
	sysclk_init();
	board_init();


	/* Initialize debug console */
	config_uart();

	/* Initialize_tc */
	configure_tc();

	/* Initialize Led */
	config_led();
	
	/* frase de boas vindas */
	puts(" ---------------------------- \n\r"
	 	 " Bem vindo terraquio !		\n\r"
		 " ---------------------------- \n\r");
		 
	/* display main menu */
	display_menu();
	
	/* init var */
	vetor[TAMANHO] = STRING_NULL;
	
	while (1) {

		while(!g_UartStrgOk){ 
			pmc_sleep(SAM_PM_SMODE_SLEEP_WFI);
		};

		//rtn = readvec(&vetor[0]);
	
			if (strcmp(g_UartStrg, "LGON") == 0)
			{
				pio_clear(PORT_LED_GREEN, MASK_LED_GREEN);
				puts("Led ON \n\r");
			}
			else if (strcmp(g_UartStrg, "LBPISCA") == 0)
			{
			flagB = 1;	
			puts("Pisca LED azul \n\r");	
			}
			else if (strcmp(g_UartStrg, "LGPISCA") == 0)
			{
				flagG = 2;
			}
			else if (strcmp(g_UartStrg, "LBON") == 0)
			{
				pio_clear(PORT_LED_BLUE, MASK_LED_BLUE);
				puts("Led ON \n\r");
			}
			else if (strcmp(g_UartStrg, "LRON") == 0)
			{
				pio_set(PORT_LED_RED, MASK_LED_RED);
				puts("Led ON \n\r");
			}
			else if (strcmp(g_UartStrg, "LGOFF") == 0)
			{
			pio_set(PORT_LED_GREEN, MASK_LED_GREEN);
			puts("Led OFF \n\r");	
			flagG = 0 ;
			}
			else if (strcmp(g_UartStrg, "LBOFF") == 0)
			{
				pio_set(PORT_LED_BLUE, MASK_LED_BLUE);
				puts("Led OFF \n\r");
				flagB = 0;
			}
			else if (strcmp(g_UartStrg, "LROFF") == 0)
			{
				pio_clear(PORT_LED_RED, MASK_LED_RED);
				puts("Led OFF \n\r");
			}
			else if (strcmp(g_UartStrg, "FREQ1") == 0)
			{
				tc_write_rc(TC0,0,8000);
				puts("Frequencia 8000 \n\r");
			}
			else if (strcmp(g_UartStrg, "FREQ2") == 0)
			{
				tc_write_rc(TC0,0,4000);
				puts("Frequencia 4000 \n\r");
			}
			else if (strcmp(g_UartStrg, "FREQ3") == 0)
			{
				tc_write_rc(TC0,0,2000);
				puts("Frequencia 2000 \n\r");
			}
			
			/* more else if clauses */
			else 
			{
				printf("[INFO] Opcao nao definida: %s \n\r", g_UartStrg);
			}

			//g_UartStrgAck = 1;
			limparvetor();

	}
}