|
|
@@ -6,11 +6,7 @@ extern struct imu_t imu_bmi160;
|
|
|
extern struct imu_t imu_lsm6ds3trc;
|
|
|
extern struct imu_t imu_lsm6dso;
|
|
|
|
|
|
-struct imu_t* imu_types[] = {
|
|
|
- &imu_bmi160,
|
|
|
- &imu_lsm6ds3trc,
|
|
|
- &imu_lsm6dso
|
|
|
-};
|
|
|
+struct imu_t* imu_types[] = {&imu_bmi160, &imu_lsm6ds3trc, &imu_lsm6dso};
|
|
|
|
|
|
static const int imu_count = sizeof(imu_types) / sizeof(struct imu_t*);
|
|
|
|
|
|
@@ -31,30 +27,26 @@ bool imu_begin() {
|
|
|
bool ret = false;
|
|
|
furi_hal_i2c_acquire(&furi_hal_i2c_handle_external);
|
|
|
|
|
|
- if (imu_found == NULL) {
|
|
|
+ if(imu_found == NULL) {
|
|
|
imu_found = find_imu();
|
|
|
- if (imu_found != NULL)
|
|
|
- FURI_LOG_E(IMU_TAG, "Found Device %s", imu_found->name);
|
|
|
+ if(imu_found != NULL) FURI_LOG_E(IMU_TAG, "Found Device %s", imu_found->name);
|
|
|
}
|
|
|
|
|
|
- if (imu_found != NULL)
|
|
|
- ret = imu_found->begin();
|
|
|
+ if(imu_found != NULL) ret = imu_found->begin();
|
|
|
|
|
|
furi_hal_i2c_release(&furi_hal_i2c_handle_external);
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
void imu_end() {
|
|
|
- if (imu_found == NULL)
|
|
|
- return;
|
|
|
+ if(imu_found == NULL) return;
|
|
|
furi_hal_i2c_acquire(&furi_hal_i2c_handle_external);
|
|
|
imu_found->end();
|
|
|
furi_hal_i2c_release(&furi_hal_i2c_handle_external);
|
|
|
}
|
|
|
|
|
|
int imu_read(double* vec) {
|
|
|
- if (imu_found == NULL)
|
|
|
- return 0;
|
|
|
+ if(imu_found == NULL) return 0;
|
|
|
furi_hal_i2c_acquire(&furi_hal_i2c_handle_external);
|
|
|
int ret = imu_found->read(vec);
|
|
|
furi_hal_i2c_release(&furi_hal_i2c_handle_external);
|