Added double-tap capabilities to LIS2DW

This commit is contained in:
David Volovskiy
2025-11-15 12:47:53 -05:00
parent fe1c024e47
commit eaae42cca9
3 changed files with 22 additions and 2 deletions

View File

@@ -302,6 +302,20 @@ void lis2dw_clear_fifo(void) {
#endif
}
void lis2dw_enable_double_tap(void) {
#ifdef I2C_SERCOM
uint8_t configuration = watch_i2c_read8(LIS2DW_ADDRESS, LIS2DW_REG_WAKE_UP_THS);
watch_i2c_write8(LIS2DW_ADDRESS, LIS2DW_REG_WAKE_UP_THS, configuration | LIS2DW_WAKE_UP_THS_ENABLE_DOUBLE_TAP);
#endif
}
void lis2dw_disable_double_tap(void) {
#ifdef I2C_SERCOM
uint8_t configuration = watch_i2c_read8(LIS2DW_ADDRESS, LIS2DW_REG_WAKE_UP_THS);
watch_i2c_write8(LIS2DW_ADDRESS, LIS2DW_REG_WAKE_UP_THS, configuration & ~LIS2DW_WAKE_UP_THS_ENABLE_DOUBLE_TAP);
#endif
}
void lis2dw_enable_sleep(void) {
#ifdef I2C_SERCOM
uint8_t configuration = watch_i2c_read8(LIS2DW_ADDRESS, LIS2DW_REG_WAKE_UP_THS);

View File

@@ -343,6 +343,10 @@ bool lis2dw_read_fifo(lis2dw_fifo_t *fifo_data);
void lis2dw_clear_fifo(void);
void lis2dw_enable_double_tap(void);
void lis2dw_disable_double_tap(void);
void lis2dw_enable_sleep(void);
void lis2dw_disable_sleep(void);