diff --git a/epicardium/modules/bhi.c b/epicardium/modules/bhi.c index 3131cfb982b0cb66125e7398935ca01824137939..b894c52078cc263d43d146a984916ae9fef0fcb2 100644 --- a/epicardium/modules/bhi.c +++ b/epicardium/modules/bhi.c @@ -24,9 +24,18 @@ static const gpio_cfg_t bhi160_interrupt_pin = { PORT_0, PIN_13, GPIO_FUNC_IN, GPIO_PAD_PULL_UP }; +/* clang-format off */ /* Axis remapping matrices */ -static int8_t bhi160_mapping_matrix[3 * 3] = { 0, -1, 0, 1, 0, 0, 0, 0, 1 }; -static int8_t bmm150_mapping_matrix[3 * 3] = { -1, 0, 0, 0, 1, 0, 0, 0, -1 }; +static const int8_t bhi160_mapping_matrix[3 * 3] = { + 0, -1, 0, + 1, 0, 0, + 0, 0, 1, +}; +static const int8_t bmm150_mapping_matrix[3 * 3] = { + -1, 0, 0, + 0, 1, 0, + 0, 0, -1, +}; /* * From the official docs: @@ -38,10 +47,11 @@ static int8_t bmm150_mapping_matrix[3 * 3] = { -1, 0, 0, 0, 1, 0, 0, 0, -1 }; * * TODO: Get data for card10 */ -/* clang-format off */ -static float bhi160_sic_array[3 * 3] = { 1.0, 0.0, 0.0, - 0.0, 1.0, 0.0, - 0.0, 0.0, 1.0 }; +static const float bhi160_sic_array[3 * 3] = { + 1.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, + 0.0f, 0.0f, 1.0f, +}; /* clang-format on */ /* BHI160 Task ID */ @@ -519,20 +529,20 @@ void vBhi160Task(void *pvParameters) * should fix this properly at some point. */ bhy_mapping_matrix_set( - PHYSICAL_SENSOR_INDEX_ACC, bhi160_mapping_matrix + PHYSICAL_SENSOR_INDEX_ACC, (int8_t *)bhi160_mapping_matrix ); bhy_mapping_matrix_set( - PHYSICAL_SENSOR_INDEX_ACC, bhi160_mapping_matrix + PHYSICAL_SENSOR_INDEX_ACC, (int8_t *)bhi160_mapping_matrix ); bhy_mapping_matrix_set( - PHYSICAL_SENSOR_INDEX_MAG, bmm150_mapping_matrix + PHYSICAL_SENSOR_INDEX_MAG, (int8_t *)bmm150_mapping_matrix ); bhy_mapping_matrix_set( - PHYSICAL_SENSOR_INDEX_GYRO, bhi160_mapping_matrix + PHYSICAL_SENSOR_INDEX_GYRO, (int8_t *)bhi160_mapping_matrix ); /* Set "SIC" matrix. TODO: Find out what this is about */ - bhy_set_sic_matrix(bhi160_sic_array); + bhy_set_sic_matrix((float *)bhi160_sic_array); hwlock_release(HWLOCK_I2C); mutex_unlock(&bhi160_mutex);