preliminary accelerometer support in Movement

This commit is contained in:
joeycastillo
2024-10-09 07:46:28 -04:00
parent dd8599a5e1
commit e1b5395e10
7 changed files with 83 additions and 81 deletions

View File

@@ -233,6 +233,11 @@ void lis2dw_configure_wakeup_threshold(uint8_t threshold) {
watch_i2c_write8(LIS2DW_ADDRESS, LIS2DW_REG_WAKE_UP_THS, configuration | threshold);
}
void lis2dw_configure_6d_threshold(uint8_t threshold) {
uint8_t configuration = watch_i2c_read8(LIS2DW_ADDRESS, LIS2DW_REG_TAP_THS_X) & 0b01100000;
watch_i2c_write8(LIS2DW_ADDRESS, LIS2DW_REG_TAP_THS_X, configuration | ((threshold & 0b11) << 5));
}
void lis2dw_configure_int1(uint8_t sources) {
watch_i2c_write8(LIS2DW_ADDRESS, LIS2DW_REG_CTRL4_INT1, sources);
}

View File

@@ -345,6 +345,8 @@ void lis2dw_disable_tap_detection(void);
void lis2dw_configure_wakeup_threshold(uint8_t threshold);
void lis2dw_configure_6d_threshold(uint8_t threshold);
void lis2dw_configure_int1(uint8_t sources);
void lis2dw_configure_int2(uint8_t sources);