summaryrefslogtreecommitdiff
path: root/src/input/feedback_haptics.cpp
blob: 5e83d0d66ea4ac78abee206974addc5d93babee7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
 * Copyright 2024 jacqueline <me@jacqueline.id.au>
 *
 * SPDX-License-Identifier: GPL-3.0-only
 */

#include "feedback_haptics.hpp"

#include <cstdint>

#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