accelerometer: don't initialize on wake if already set up
This commit is contained in:
parent
bb5aa4ff7c
commit
1a5ccd34a0
@ -716,6 +716,8 @@ void app_setup(void) {
|
|||||||
watch_register_interrupt_callback(HAL_GPIO_BTN_ALARM_pin(), cb_alarm_btn_interrupt, INTERRUPT_TRIGGER_BOTH);
|
watch_register_interrupt_callback(HAL_GPIO_BTN_ALARM_pin(), cb_alarm_btn_interrupt, INTERRUPT_TRIGGER_BOTH);
|
||||||
|
|
||||||
#ifdef I2C_SERCOM
|
#ifdef I2C_SERCOM
|
||||||
|
// if accelerometer was already detected and set up, no need to set it up again.
|
||||||
|
if (!movement_state.has_lis2dw) {
|
||||||
watch_enable_i2c();
|
watch_enable_i2c();
|
||||||
if (lis2dw_begin()) {
|
if (lis2dw_begin()) {
|
||||||
movement_state.has_lis2dw = true;
|
movement_state.has_lis2dw = true;
|
||||||
@ -761,6 +763,7 @@ void app_setup(void) {
|
|||||||
} else {
|
} else {
|
||||||
watch_disable_i2c();
|
watch_disable_i2c();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
watch_enable_buzzer();
|
watch_enable_buzzer();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user