Added new wrapper functions to interact more easily with the watch's peripherals

This commit is contained in:
anschrammh 2023-03-24 14:54:16 +01:00
parent beec1570c0
commit 5d3b5b5285
2 changed files with 33 additions and 0 deletions

View File

@ -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);
}

View File

@ -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