void config_read(void)
{
	uint8_t choice=0;
	
	if(read_from_EEPROM(10) != 48)
	{
		while(1)
		{
			choice = uart_getchar();
			putchar('\n');
			putchar('\r');
			
			if(choice=='1')
			{
				while(!(UCSR0A & (1 << RXC0)))adxl345();
				config_menu();
			}
			if(choice=='2')
			{
				while(!(UCSR0A & (1 << RXC0)))
				{
					hmc5843();
					delay_ms(550);//at least 100ms interval between measurements
				}
				config_menu();
			}
			if(choice=='3')
			{
				while(!(UCSR0A & (1 << RXC0)))stgyros();
				config_menu();
			}
			if(choice=='4')
			{
				while(!(UCSR0A & (1 << RXC0)))raw();
				config_menu();
			}
			if(choice=='5')
			{
				self_test();
			}
			if(choice==0x1A) //if ctrl-z
			{
				write_to_EEPROM(10,48);
				auto_raw();
			}
			if(choice==0x3F) //if ?
			{
				help();
				config_menu();
			}
		}
	}else auto_raw();
}
Exemple #2
0
/////===========MAIN=====================/////////////////////
int main(void)
{
	init();
	self_test();
	
	while(1)
	{	
		//check to see if autorun is set, if it is don't print the menu
		if(read_from_EEPROM(1) == 48) config_read();
		else config_menu();
	}
}
int main(void)
{
	init();
	
	while(1)
	{	
		
		sbi(PORTB, STATUS_LED);
		delay_ms(1000);
		cbi(PORTB, STATUS_LED);
		delay_ms(1000);
		sbi(PORTB, STATUS_LED);
		delay_ms(1000);
		cbi(PORTB, STATUS_LED);
		
		//check to see if autorun is set, if it is don't print the menu
		if(read_from_EEPROM(10) == 48) config_read();
		else config_menu();
	}
}
Exemple #4
0
void check_baud(void)
{
	if(read_from_EEPROM(2) == 99) //check to see if the baud rate has been changed by user
	{
		//read baud rate selection
		if(read_from_EEPROM(3) == 4)
		{
			baud = 4800; 
			UART_Init(207);
		}
		if(read_from_EEPROM(4) == 9)
		{
			baud = 9600; 
			UART_Init(103);
		}
		if(read_from_EEPROM(5) == 19)
		{
			baud = 19200; 
			UART_Init(51);
		}
		if(read_from_EEPROM(6) == 38)
		{
			baud = 38400; 
			UART_Init(25);
		}
		if(read_from_EEPROM(7) == 57)
		{
			baud = 57600; 
			UART_Init(16);
		}
	} 
	else
	{
		//57600bps Default UART
		UART_Init(16);
		baud = 57600;
	}
}
Exemple #5
0
void config_read(void)
{
	uint8_t choice=0;
	
	if(read_from_EEPROM(1) != 48)
	{
		while(1)
		{
			choice = uart_getchar();
			putchar('\n');
			putchar('\r');
			
			if(choice=='1')
			{
				while(!(UCSR0A & (1 << RXC0)))print_adxl345();
				config_menu();
			}
			else if(choice=='2')
			{
				while(!(UCSR0A & (1 << RXC0)))
				{
					print_hmc5883();
					delay_ms(100);//at least 100ms interval between measurements
				}
				config_menu();
			}
			else if(choice=='3')
			{
				while(!(UCSR0A & (1 << RXC0)))print_itg3200();
				config_menu();
			}
			else if(choice=='4')
			{
				while(!(UCSR0A & (1 << RXC0)))raw();
				config_menu();
			}
			else if(choice=='5')
			{
				baud_menu();
				config_menu();
			}
			else if(choice==0x10) //if ctrl-p
			{
				self_test();
			}
			else if(choice==0x1A) //if ctrl-z
			{
				write_to_EEPROM(1,48);
				auto_raw();
			}
			else if(choice==0x3F) //if ?
			{
				help();
				while(!(UCSR0A & (1 << RXC0)));
				config_menu();
			}
			else if(choice==0xFF) config_read();
		}
	}else auto_raw();

}