blob: 607f81f1f2d8d8851a152a359bbba9d4442da314 (
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
|
/*
* Copyright 2024 jacqueline <me@jacqueline.id.au>
*
* SPDX-License-Identifier: GPL-3.0-only
*/
#include "input_volume_buttons.hpp"
#include "event_queue.hpp"
#include "gpios.hpp"
#include "input_hook_actions.hpp"
namespace input {
VolumeButtons::VolumeButtons(drivers::IGpios& gpios)
: gpios_(gpios),
up_("upper", actions::volumeUp()),
down_("lower", actions::volumeDown()) {}
auto VolumeButtons::read(lv_indev_data_t* data) -> void {
up_.update(!gpios_.Get(drivers::IGpios::Pin::kKeyUp), data);
down_.update(!gpios_.Get(drivers::IGpios::Pin::kKeyDown), data);
}
auto VolumeButtons::name() -> std::string {
return "buttons";
}
auto VolumeButtons::hooks() -> std::vector<TriggerHooks> {
return {up_, down_};
}
} // namespace input
|