From 1573a8c4cde1cd9528b422b2dcc598e37ffe94a7 Mon Sep 17 00:00:00 2001 From: jacqueline Date: Thu, 2 May 2024 19:12:26 +1000 Subject: WIP merge cyclically dependent components into one big component --- src/tangara/input/feedback_haptics.cpp | 37 ++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 src/tangara/input/feedback_haptics.cpp (limited to 'src/tangara/input/feedback_haptics.cpp') diff --git a/src/tangara/input/feedback_haptics.cpp b/src/tangara/input/feedback_haptics.cpp new file mode 100644 index 00000000..90a912ec --- /dev/null +++ b/src/tangara/input/feedback_haptics.cpp @@ -0,0 +1,37 @@ +/* + * Copyright 2024 jacqueline + * + * SPDX-License-Identifier: GPL-3.0-only + */ + +#include "input/feedback_haptics.hpp" + +#include + +#include "lvgl/lvgl.h" + +#include "core/lv_event.h" +#include "esp_log.h" + +#include "haptics.hpp" + +namespace input { + +using Effect = drivers::Haptics::Effect; + +Haptics::Haptics(drivers::Haptics& haptics_) : haptics_(haptics_) {} + +auto Haptics::feedback(uint8_t event_type) -> void { + switch (event_type) { + case LV_EVENT_FOCUSED: + haptics_.PlayWaveformEffect(Effect::kMediumClick1_100Pct); + break; + case LV_EVENT_CLICKED: + haptics_.PlayWaveformEffect(Effect::kSharpClick_100Pct); + break; + default: + break; + } +} + +} // namespace input -- cgit v1.2.3