Hi DroneKid,
You could implement interrupt routine like this: struct bmi160_dev bmi160dev; struct bmi160_sensor_data accel; struct bmi160_sensor_data gyro;
void BMI160Interrupt(void) { int8_t rslt = BMI160_OK; struct bmi160_dev *dev; volatile union bmi160_int_status int_status;
dev = &bmi160dev;
memset(int_status.data, 0x00, sizeof(int_status.data)); bmi160_get_int_status(BMI160_INT_STATUS_ALL, &int_status, dev); PDEBUG("data: 0x%02X, 0x%02X, 0x%02X, 0x%02X\r\n", int_status.data[0], int_status.data[1], int_status.data[2], int_status.data[3]);
if(int_status.bit.drdy) { /* To read both Accel and Gyro data */ bmi160_get_sensor_data((BMI160_ACCEL_SEL | BMI160_GYRO_SEL), &accel, &gyro, dev); } }
... View more