diff --git a/src/W800_SDK_v1.00.10/app/app_drivers/watch_peripherals/watch_peripherals.c b/src/W800_SDK_v1.00.10/app/app_drivers/watch_peripherals/watch_peripherals.c index 1dee650..6d72582 100644 --- a/src/W800_SDK_v1.00.10/app/app_drivers/watch_peripherals/watch_peripherals.c +++ b/src/W800_SDK_v1.00.10/app/app_drivers/watch_peripherals/watch_peripherals.c @@ -10,6 +10,7 @@ #include "bma456w.h" #include "CST816D.h" #include "app_utils.h" +#include "watch_settings.h" #define INTERRUPT_POLICY (0) #define POLL_POLICY (1) @@ -374,6 +375,34 @@ void watch_peripherals_vibrate_with_pattern(uint8_t strength, const uint16_t pat tls_timer_start(_vibration_motor_timer_id); } +void watch_peripherals_vibrate_on_item_click(void) +{ + if(!persistency_get_settings()->display.display_vibrate_on_touch_duration) + return; + uint16_t vibration_strength = (persistency_get_settings()->display.display_vibrate_on_touch_strength + 1)*32; + uint32_t vibration_duration_ms = 0; + + if(persistency_get_settings()->display.display_vibrate_on_touch_duration) + vibration_duration_ms = persistency_get_settings()->display.display_vibrate_on_touch_duration*50 + 50; + + watch_peripherals_vibrate(vibration_strength > 255 ? 255 : vibration_strength, vibration_duration_ms); +} + +void watch_peripherals_vibrate_on_message_notifications(void) +{ + if(!persistency_get_settings()->notification.notification_vibration_duration) + return; + + uint16_t vibration_strength = (persistency_get_settings()->notification.notification_vibration_strength + 1) * 32; + uint32_t vibration_duration_ms = 0; + + if(persistency_get_settings()->notification.notification_vibration_duration) + vibration_duration_ms = persistency_get_settings()->notification.notification_vibration_duration * 50 + 50; + + uint16_t vibration_pattern[VIBRATION_PATTERN_SLOTS] = {vibration_duration_ms, vibration_duration_ms, vibration_duration_ms}; + watch_peripherals_vibrate_with_pattern(vibration_strength > 255 ? 255 : vibration_strength, vibration_pattern); +} + void watch_peripherals_set_brightness(uint8_t brightness) { extern LCDConfig_t LCDConfig; @@ -749,7 +778,8 @@ void watch_peripherals_watch_sleep(void) // First, we disable the display backlight and we set all the peripherals in their low power mode lcd_set_backlight(&LCDConfig, 0); lcd_sleep(&LCDConfig, true); - watch_peripherals_magnetometer_power_mode_set(QMC5883L_Mode_Control_Standby); + // Set a restore function to apply the correct power mode when we leave sleep + //watch_peripherals_magnetometer_power_mode_set(QMC5883L_Mode_Control_Standby); if(CST816D_sleep()) APP_LOG_DEBUG("CST816D Sleep cmd ok"); else diff --git a/src/W800_SDK_v1.00.10/app/app_drivers/watch_peripherals/watch_peripherals.h b/src/W800_SDK_v1.00.10/app/app_drivers/watch_peripherals/watch_peripherals.h index 9a353e1..2945b26 100644 --- a/src/W800_SDK_v1.00.10/app/app_drivers/watch_peripherals/watch_peripherals.h +++ b/src/W800_SDK_v1.00.10/app/app_drivers/watch_peripherals/watch_peripherals.h @@ -95,6 +95,27 @@ void watch_peripherals_vibrate(uint8_t strength, uint32_t durationMs); */ void watch_peripherals_vibrate_with_pattern(uint8_t strength, const uint16_t pattern[VIBRATION_PATTERN_SLOTS]); +/** + * @brief Helper function which vibrates the watch to indicate that an item was clicked using + * the current watch settings. + * + */ +void watch_peripherals_vibrate_on_item_click(void); + +/** + * @brief Helper function which vibrates the watch to indicate the reception of a message notification using + * the current watch settings. + * + */ +void watch_peripherals_vibrate_on_message_notifications(void); + +/** + * @brief Helper function which vibrates the watch to notify the user that a call is incoming using + * the current watch settings. + * + */ +void watch_peripherals_vibrate_on_call_notifications(void); + /** * @brief Sets the brightness of the LCD display *