Willy-JL 1 год назад
Родитель
Сommit
797864056e

+ 0 - 9
airmouse/.gitmodules

@@ -1,9 +0,0 @@
-[submodule "lib/bmi160-api"]
-	path = lib/bmi160-api
-	url = https://github.com/boschsensortec/BMI160_SensorAPI.git
-[submodule "lib/lsm6dso-api"]
-	path = lib/lsm6dso-api
-	url = https://github.com/STMicroelectronics/stm32-lsm6dso.git
-[submodule "lib/lsm6ds3tr-api"]
-	path = lib/lsm6ds3tr-api
-	url = https://github.com/STMicroelectronics/lsm6ds3tr-c-pid.git

+ 2 - 1
airmouse/air_mouse.c

@@ -104,7 +104,8 @@ AirMouse* air_mouse_app_alloc() {
 
     app->error_dialog = dialog_ex_alloc();
     dialog_ex_set_header(app->error_dialog, "Failed to init IMU", 63, 0, AlignCenter, AlignTop);
-    dialog_ex_set_text(app->error_dialog, "Please connect sensor module", 63, 30, AlignCenter, AlignTop);
+    dialog_ex_set_text(
+        app->error_dialog, "Please connect sensor module", 63, 30, AlignCenter, AlignTop);
     view_set_previous_callback(dialog_ex_get_view(app->error_dialog), air_mouse_exit);
     view_dispatcher_add_view(
         app->view_dispatcher, AirMouseViewError, dialog_ex_get_view(app->error_dialog));

+ 1 - 7
airmouse/tracking/imu/bmi160.c

@@ -83,10 +83,4 @@ int bmi160_read(double* vec) {
 void bmi160_end() {
 }
 
-struct imu_t imu_bmi160 = {
-   BMI160_DEV_ADDR,
-   bmi160_begin,
-   bmi160_end,
-   bmi160_read,
-   BMI160_TAG
-};
+struct imu_t imu_bmi160 = {BMI160_DEV_ADDR, bmi160_begin, bmi160_end, bmi160_read, BMI160_TAG};

+ 6 - 14
airmouse/tracking/imu/imu.c

@@ -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);

+ 1 - 2
airmouse/tracking/imu/imu.h

@@ -8,8 +8,7 @@
 extern "C" {
 #endif
 
-struct imu_t
-{
+struct imu_t {
     unsigned int address;
     bool (*begin)(void);
     void (*end)(void);

+ 3 - 9
airmouse/tracking/imu/lsm6ds3trc.c

@@ -13,8 +13,7 @@ int32_t lsm6ds3trc_write_i2c(void* handle, uint8_t reg_addr, const uint8_t* data
 }
 
 int32_t lsm6ds3trc_read_i2c(void* handle, uint8_t reg_addr, uint8_t* read_data, uint16_t len) {
-    if(furi_hal_i2c_read_mem(handle, LSM6DS3_DEV_ADDRESS, reg_addr, read_data, len, 50))
-        return 0;
+    if(furi_hal_i2c_read_mem(handle, LSM6DS3_DEV_ADDRESS, reg_addr, read_data, len, 50)) return 0;
     return -1;
 }
 
@@ -88,10 +87,5 @@ int lsm6ds3trc_read(double* vec) {
     return ret;
 }
 
-struct imu_t imu_lsm6ds3trc = {
-    LSM6DS3_DEV_ADDRESS,
-    lsm6ds3trc_begin,
-    lsm6ds3trc_end,
-    lsm6ds3trc_read,
-    LSM6DS3_TAG
-};
+struct imu_t imu_lsm6ds3trc =
+    {LSM6DS3_DEV_ADDRESS, lsm6ds3trc_begin, lsm6ds3trc_end, lsm6ds3trc_read, LSM6DS3_TAG};

+ 4 - 11
airmouse/tracking/imu/lsm6dso.c

@@ -7,14 +7,12 @@
 stmdev_ctx_t lsm6dso_ctx;
 
 int32_t lsm6dso_write_i2c(void* handle, uint8_t reg_addr, uint8_t* data, uint16_t len) {
-    if(furi_hal_i2c_write_mem(handle, LSM6DSO_DEV_ADDRESS, reg_addr, data, len, 50))
-        return 0;
+    if(furi_hal_i2c_write_mem(handle, LSM6DSO_DEV_ADDRESS, reg_addr, data, len, 50)) return 0;
     return -2;
 }
 
 int32_t lsm6dso_read_i2c(void* handle, uint8_t reg_addr, uint8_t* read_data, uint16_t len) {
-    if(furi_hal_i2c_read_mem(handle, LSM6DSO_DEV_ADDRESS, reg_addr, read_data, len, 50))
-        return 0;
+    if(furi_hal_i2c_read_mem(handle, LSM6DSO_DEV_ADDRESS, reg_addr, read_data, len, 50)) return 0;
     return -2;
 }
 
@@ -88,10 +86,5 @@ int lsm6dso_read(double* vec) {
     return ret;
 }
 
-struct imu_t imu_lsm6dso = {
-    LSM6DSO_DEV_ADDRESS,
-    lsm6dso_begin,
-    lsm6dso_end,
-    lsm6dso_read,
-    LSM6DSO_TAG
-};
+struct imu_t imu_lsm6dso =
+    {LSM6DSO_DEV_ADDRESS, lsm6dso_begin, lsm6dso_end, lsm6dso_read, LSM6DSO_TAG};