Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@
[submodule "third_party/hal_lsm6dso/lsm6dso-pid"]
path = third_party/hal_lsm6dso/lsm6dso-pid
url = https://github.com/STMicroelectronics/lsm6dso-pid.git
[submodule "third_party/hal_lis2dw12/lis2dw12-pid"]
path = third_party/hal_lis2dw12/lis2dw12-pid
url = https://github.com/STMicroelectronics/lis2dw12-pid.git
[submodule "third_party/resources/iconography"]
path = third_party/resources/iconography
url = https://github.com/pebble-dev/iconography
36 changes: 31 additions & 5 deletions src/fw/board/boards/board_getafix.c
Original file line number Diff line number Diff line change
Expand Up @@ -272,16 +272,42 @@ I2CBus *const I2C1_BUS = &s_i2c_bus_1;

IRQ_MAP(I2C1, i2c_irq_handler, I2C1_BUS);

static const I2CSlavePort s_i2c_lsm2dw12 = {
.bus = &s_i2c_bus_1,
static LIS2DW12State s_lis2dw12_state;

static const LIS2DW12Config s_lis2dw12_config = {
.state = &s_lis2dw12_state,
.i2c = {
.bus = &s_i2c_bus_1,
#if BOARD_GETAFIX_EVT
.address = 0x18,
.address = 0x18,
#else
.address = 0x19,
.address = 0x19,
#endif
},
.int1 = {
.peripheral = hwp_gpio1,
.gpio_pin = 26,
},
#if BOARD_GETAFIX_EVT
.disable_addr_pullup = true,
#endif
.wk_dur_default = 1U,
.wk_ths_default = 16U,
.scale_mg = 4000U,
.fifo_threshold = 16U,
.axis_map = {
[AXIS_X] = 0,
[AXIS_Y] = 1,
[AXIS_Z] = 2,
},
.axis_dir = {
[AXIS_X] = -1,
[AXIS_Y] = 1,
[AXIS_Z] = 1,
},
};

I2CSlavePort *const I2C_LSM2DW12 = &s_i2c_lsm2dw12;
const LIS2DW12Config *const LIS2DW12 = &s_lis2dw12_config;

static const I2CSlavePort s_i2c_mmc5603nj = {
.bus = &s_i2c_bus_1,
Expand Down
19 changes: 3 additions & 16 deletions src/fw/board/boards/board_getafix.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#pragma once

#include "drivers/imu/lis2dw12/lis2dw12.h"
#include "drivers/led_controller/aw9364e.h"
#include "drivers/pmic/npm1300.h"
#include "drivers/touch/cst816/touch_sensor_definitions.h"
Expand All @@ -20,7 +21,7 @@ extern QSPIFlash * const QSPI_FLASH;
extern I2CBus *const I2C1_BUS;
extern I2CBus *const I2C2_BUS;
extern I2CBus *const I2C3_BUS;
extern I2CSlavePort *const I2C_LSM2DW12;
extern const LIS2DW12Config *const LIS2DW12;
extern I2CSlavePort * const I2C_MMC5603NJ;
extern I2CSlavePort * const I2C_NPM1300;
extern I2CSlavePort *const I2C_W1160;
Expand All @@ -42,21 +43,7 @@ static const BoardConfigBacklight BOARD_CONFIG_BACKLIGHT = {

static const BoardConfigAccel BOARD_CONFIG_ACCEL = {
.accel_config = {
.axes_offsets[AXIS_X] = 0,
.axes_offsets[AXIS_Y] = 1,
.axes_offsets[AXIS_Z] = 2,
.axes_inverts[AXIS_X] = true,
.axes_inverts[AXIS_Y] = false,
.axes_inverts[AXIS_Z] = false,
.shake_thresholds[AccelThresholdHigh] = 64U,
.shake_thresholds[AccelThresholdLow] = 15U,
.double_tap_threshold = 12500U,
.tap_shock = 0x03U,
.tap_quiet = 0x02U,
.tap_dur = 0x08U,
},
.accel_ints = {
[0] = { .peripheral = hwp_gpio1, .gpio_pin = 26 },
.default_motion_sensitivity = 40U, // Medium-Low
},
};

Expand Down
49 changes: 44 additions & 5 deletions src/fw/board/boards/board_obelix.c
Original file line number Diff line number Diff line change
Expand Up @@ -373,16 +373,55 @@ I2CBus *const I2C2_BUS = &s_i2c_bus_2;

IRQ_MAP(I2C2, i2c_irq_handler, I2C2_BUS);

static const I2CSlavePort s_i2c_lsm2dw12 = {
.bus = &s_i2c_bus_2,
static LIS2DW12State s_lis2dw12_state;

static const LIS2DW12Config s_lis2dw12_config = {
.state = &s_lis2dw12_state,
.i2c = {
.bus = &s_i2c_bus_2,
#if BOARD_OBELIX_DVT || BOARD_OBELIX_BB2
.address = 0x18,
#else
.address = 0x19,
#endif
},
.int1 = {
.peripheral = hwp_gpio1,
.gpio_pin = 38,
},
#if BOARD_OBELIX_DVT || BOARD_OBELIX_BB2
.address = 0x18,
.disable_addr_pullup = true,
#endif
.wk_dur_default = 1U,
.wk_ths_default = 16U,
.scale_mg = 4000U,
.fifo_threshold = 16U,
#ifdef IS_BIGBOARD
.axis_map = {
[AXIS_X] = 0,
[AXIS_Y] = 1,
[AXIS_Z] = 2,
},
.axis_dir = {
[AXIS_X] = -1,
[AXIS_Y] = -1,
[AXIS_Z] = 1,
},
#else
.address = 0x19,
.axis_map = {
[AXIS_X] = 1,
[AXIS_Y] = 0,
[AXIS_Z] = 2,
},
.axis_dir = {
[AXIS_X] = -1,
[AXIS_Y] = 1,
[AXIS_Z] = -1,
},
#endif
};

I2CSlavePort *const I2C_LSM2DW12 = &s_i2c_lsm2dw12;
const LIS2DW12Config *const LIS2DW12 = &s_lis2dw12_config;

static const I2CSlavePort s_i2c_lsm6dso = {
.bus = &s_i2c_bus_2,
Expand Down
40 changes: 3 additions & 37 deletions src/fw/board/boards/board_obelix.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#pragma once

#include "drivers/imu/lis2dw12/lis2dw12.h"
#include "drivers/led_controller/pwm.h"
#include "drivers/pmic/npm1300.h"
#include "drivers/touch/cst816/touch_sensor_definitions.h"
Expand All @@ -19,7 +20,7 @@ extern QSPIPort * const QSPI;
extern QSPIFlash * const QSPI_FLASH;
extern I2CBus *const I2C1_BUS;
extern I2CBus *const I2C2_BUS;
extern I2CSlavePort *const I2C_LSM2DW12;
extern const LIS2DW12Config *const LIS2DW12;
extern I2CSlavePort *const I2C_LSM6DSO;
extern I2CSlavePort * const I2C_MMC5603NJ;
extern I2CSlavePort * const I2C_NPM1300;
Expand All @@ -44,42 +45,7 @@ static const BoardConfigBacklight BOARD_CONFIG_BACKLIGHT = {

static const BoardConfigAccel BOARD_CONFIG_ACCEL = {
.accel_config = {
#ifdef IS_BIGBOARD
.axes_offsets[AXIS_X] = 0,
.axes_offsets[AXIS_Y] = 1,
.axes_offsets[AXIS_Z] = 2,
.axes_inverts[AXIS_X] = true,
.axes_inverts[AXIS_Y] = true,
.axes_inverts[AXIS_Z] = false,
#else
.axes_offsets[AXIS_X] = 1,
.axes_offsets[AXIS_Y] = 0,
.axes_offsets[AXIS_Z] = 2,
.axes_inverts[AXIS_X] = true,
.axes_inverts[AXIS_Y] = false,
.axes_inverts[AXIS_Z] = true,
#endif
// TODO(OBELIX): Needs calibration
.shake_thresholds[AccelThresholdHigh] = 64U,
.shake_thresholds[AccelThresholdLow] = 15U,
.double_tap_threshold = 12500U,
// LSM6DSO tap timing register values tuned for reliable double-tap:
// tap_shock (0-3): maximum duration (in ODR steps) where an over-threshold event is still
// considered a tap. Higher tolerates longer impacts. 3 = ~max;
// tap_quiet (0-3): quiet time after first tap during which accel must stay below threshold
// before second tap; balances rejection of long impacts vs responsiveness. 2 is moderate.
// tap_dur (0-15): maximum interval (in ODR steps) between first and second tap. 8 chosen to
// allow natural user double taps without allowing widely spaced taps.
.tap_shock = 0x03U,
.tap_quiet = 0x02U,
.tap_dur = 0x08U,
.default_motion_sensitivity = 70U, // Medium-High
},
.accel_int_gpios = {
[0] = { .gpio = hwp_gpio1, .gpio_pin = 38 },
},
.accel_ints = {
[0] = { .peripheral = hwp_gpio1, .gpio_pin = 38 },
.default_motion_sensitivity = 40U, // Medium-Low
},
};

Expand Down
Loading
Loading