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();
}
Esempio n. 2
0
int main (void)
{
	int fd_adxl345 ;
	struct  acc_dat  gdata ;
	fd_adxl345 = wiringPiI2CSetup(0x53);
	printf("%d\n",fd_adxl345);

	ADXL345 adxl345(fd_adxl345);


	while(true){
		gdata = adxl345.getAxes(true);
		printf("x : %f g\n",gdata.x);
		printf("y : %f g\n",gdata.y);
		printf("z : %f g\n",gdata.z);
		sleep(1);
	}
}