From 5d3b5b528557cb07d71713510b6ec9f79a1b7a00 Mon Sep 17 00:00:00 2001 From: anschrammh Date: Fri, 24 Mar 2023 14:54:16 +0100 Subject: [PATCH] Added new wrapper functions to interact more easily with the watch's peripherals --- .../watch_peripherals/watch_peripherals.c | 14 ++++++++++++++ .../watch_peripherals/watch_peripherals.h | 19 +++++++++++++++++++ 2 files changed, 33 insertions(+) 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 845405c..8f1d2e0 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 @@ -116,6 +116,8 @@ battery_controller_status_e watch_peripherals_get_battery_controller_status(void void watch_peripherals_vibrate(uint8_t strength, uint32_t durationMs) { APP_LOG_DEBUG("Vibration started"); + /* No need to do anything if the duration is 0 or if the strength is 0 */ + if(!strength || !durationMs) return; /* We start the timer which will stop the vibration after durationMs time */ tls_timer_change(_vibration_motor_timer_id, durationMs); wm_pwm0_config(VIBRATION_MOTOR_ENABLE); @@ -123,3 +125,15 @@ void watch_peripherals_vibrate(uint8_t strength, uint32_t durationMs) tls_pwm_duty_set(VIBRATION_MOTOR_PWM_CHANNEL, strength); tls_timer_start(_vibration_motor_timer_id); } + +void watch_peripherals_set_brightness(uint8_t brightness) +{ + extern LCDConfig_t LCDConfig; + lcd_set_backlight(&LCDConfig, brightness); +} + +void watch_peripherals_set_orientation(LCDOrientation_e orientation) +{ + extern LCDConfig_t LCDConfig; + lcd_orientation(&LCDConfig, orientation); +} 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 def62b8..e81226c 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 @@ -4,6 +4,7 @@ */ #ifndef WATCH_PERIPHERALS_H #define WATCH_PERIPHERALS_H +#include "lcd.h" #include "wm_type_def.h" typedef enum battery_unit @@ -63,4 +64,22 @@ battery_controller_status_e watch_peripherals_get_battery_controller_status(void */ void watch_peripherals_vibrate(uint8_t strength, uint32_t durationMs); +/** + * @brief Sets the brightness of the LCD display + * + * @param brightness from 0 (backlight off) to 255 backlight fully on + */ +void watch_peripherals_set_brightness(uint8_t brightness); + +/** + * @brief Sets the orientation of the LCD display + * + * @param orientation the value of the orientation to set : + * - LCD_ORIENTATION_DEFAULT or LCD_ORIENTATION_0 + * - LCD_ORIENTATION_90 + * - LCD_ORIENTATION_180 + * - LCD_ORIENTATION_270 + */ +void watch_peripherals_set_orientation(LCDOrientation_e orientation); + #endif //WATCH_PERIPHERALS_H \ No newline at end of file