lis2dw driver: add stationary/motion detection
This commit is contained in:
@@ -218,6 +218,16 @@ void lis2dw_disable_sleep(void) {
|
||||
watch_i2c_write8(LIS2DW_ADDRESS, LIS2DW_REG_WAKE_UP_THS, configuration & ~LIS2DW_WAKE_UP_THS_VAL_SLEEP_ON);
|
||||
}
|
||||
|
||||
void lis2dw_enable_stationary_motion_detection(void) {
|
||||
uint8_t configuration = watch_i2c_read8(LIS2DW_ADDRESS, LIS2DW_REG_WAKE_UP_DUR);
|
||||
watch_i2c_write8(LIS2DW_ADDRESS, LIS2DW_REG_WAKE_UP_DUR, configuration | LIS2DW_WAKE_UP_DUR_STATIONARY);
|
||||
}
|
||||
|
||||
void lis2dw_disable_stationary_motion_detection(void) {
|
||||
uint8_t configuration = watch_i2c_read8(LIS2DW_ADDRESS, LIS2DW_REG_WAKE_UP_DUR);
|
||||
watch_i2c_write8(LIS2DW_ADDRESS, LIS2DW_REG_WAKE_UP_DUR, configuration & ~LIS2DW_WAKE_UP_DUR_STATIONARY);
|
||||
}
|
||||
|
||||
void lis2dw_enable_tap_detection(void) {
|
||||
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_VAL_TAP_EVENT_ENABLED);
|
||||
|
||||
Reference in New Issue
Block a user