You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
800 B
34 lines
800 B
1 year ago
|
/*
|
||
|
* Copyright 2024 jacqueline <me@jacqueline.id.au>
|
||
|
*
|
||
|
* SPDX-License-Identifier: GPL-3.0-only
|
||
|
*/
|
||
|
|
||
|
#include "input_volume_buttons.hpp"
|
||
1 year ago
|
#include "event_queue.hpp"
|
||
1 year ago
|
#include "gpios.hpp"
|
||
1 year ago
|
#include "input_hook_actions.hpp"
|
||
1 year ago
|
|
||
|
namespace input {
|
||
|
|
||
1 year ago
|
VolumeButtons::VolumeButtons(drivers::IGpios& gpios)
|
||
1 year ago
|
: gpios_(gpios),
|
||
|
up_("upper", actions::volumeUp()),
|
||
|
down_("lower", actions::volumeDown()) {}
|
||
1 year ago
|
|
||
|
auto VolumeButtons::read(lv_indev_data_t* data) -> void {
|
||
1 year ago
|
up_.update(!gpios_.Get(drivers::IGpios::Pin::kKeyUp), data);
|
||
|
down_.update(!gpios_.Get(drivers::IGpios::Pin::kKeyDown), data);
|
||
1 year ago
|
}
|
||
|
|
||
1 year ago
|
auto VolumeButtons::name() -> std::string {
|
||
|
return "buttons";
|
||
|
}
|
||
|
|
||
1 year ago
|
auto VolumeButtons::triggers()
|
||
|
-> std::vector<std::reference_wrapper<TriggerHooks>> {
|
||
1 year ago
|
return {up_, down_};
|
||
|
}
|
||
|
|
||
1 year ago
|
} // namespace input
|