Skip to content
Snippets Groups Projects
Commit cfab8a89 authored by bbartels's avatar bbartels Committed by dawehr
Browse files

wip: add hardware test specific for IMU

parent 247371ca
No related branches found
No related tags found
1 merge request!9Abstract the hardware layer
......@@ -67,7 +67,7 @@ int init_structs(modular_structs_t *structs) {
return -1;
}
// Initialize I2C controller and start the sensor board
// Initialize I2C controller
struct I2CDriver *i2c = &structs->hardware_struct.i2c;
if (i2c->reset(i2c)) {
return -1;
......@@ -85,11 +85,9 @@ int init_structs(modular_structs_t *structs) {
//manual flight mode
structs->user_defined_struct.flight_mode = MANUAL_FLIGHT_MODE;
#ifndef BENCH_TEST
// Get the first loop data from accelerometer for the gyroscope to use
if(sensor_init(&structs->raw_sensor_struct, &structs->sensor_struct) == -1)
return -1;
#endif
return 0;
}
......@@ -70,6 +70,22 @@ int test_zybo_i2c() {
return 0;
}
int test_zybo_i2c_imu() {
struct I2CDriver i2c = create_zybo_i2c();
struct SystemDriver sys = create_zybo_system();
i2c.reset(&i2c);
sys.reset(&sys);
gam_t gam = { };
iic_set_globals(&i2c, &sys);
if (iic0_mpu9150_start()) return 0;
short x;
while (1) {
iic0_mpu9150_read_gam(&gam);
}
return 0;
}
/**
* Test for the PWMInputDriver.
*
......
......@@ -26,6 +26,7 @@ int main()
#ifdef RUN_TESTS
//test_zybo_mio7_led_and_system();
//test_zybo_i2c();
//test_zybo_i2c_imu();
//test_zybo_pwm_inputs();
//test_zybo_pwm_outputs();
//test_zybo_uart();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment