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(); }
void auto_raw(void) { //while there is not a button pressed while(!(UCSR0A & (1 << RXC0))) { //prints the raw vaues with a '$,' start and ',#' end printf("$,"); printf("%d,", x_accel()); printf("%d,", y_accel()); printf("%d,", z_accel()); printf("%d,", x_gyro()); printf("%d,", y_gyro()); printf("%d,", z_gyro()); magnetometer(); printf("%d,", x_mag); printf("%d,", y_mag); printf("%d,", z_mag); printf("#\n\r"); } //if a button is pressed and that button is ctrl-z, reset autorun, display menu if(uart_getchar() == 0x1A) { write_to_EEPROM(10,0); config_menu(); } auto_raw(); }
void auto_raw(void) { //while there is not a button pressed while(!(UCSR0A & (1 << RXC0))) { raw(); } //if a button is pressed and that button is ctrl-z, reset autorun, display menu if(uart_getchar() == 0x1A) { write_to_EEPROM(1,0); config_menu(); } auto_raw(); }
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(); }