imu::imu(void) { twi_init(); // Initialize all peripherals. accl_init(); mag_init(); gyro_init(); gyro_roll_angle = 0; // Initialize internal variables to zero. gyro_pitch_angle = 0; roll_angle = 0; pitch_angle = 0; yaw_angle = 0; //gyro_x_position(void) }
static void app_timer_accl_start(void* data) { if(acclStop != NULL){ if(app_timer_reschedule(acclStop, 5000)) { app_timer_cancel(acclStop); } acclStop = NULL; } if(acclStart != NULL){ acclStart = NULL; } accl_init(); // set timer that will stop reporting accl data after about one minute acclStop = app_timer_register(80 * 1000, app_timer_accl_stop,NULL); }