diff options
| author | ailurux <ailuruxx@gmail.com> | 2024-05-10 13:06:20 +1000 |
|---|---|---|
| committer | ailurux <ailuruxx@gmail.com> | 2024-05-10 13:06:20 +1000 |
| commit | 3f177cdb8880abf199f4445f1398cd69fb813892 (patch) | |
| tree | e20de4949b1344c826e5af41ab701f3db75b21bc /src/input/input_touch_dpad.cpp | |
| parent | 8019c7691889cde4c3d40bbd78d485a92d713bbf (diff) | |
| parent | e4ce7c4ac23402e09be8d6a52e0f739c0dff4ff0 (diff) | |
| download | tangara-fw-3f177cdb8880abf199f4445f1398cd69fb813892.tar.gz | |
Merge branch 'main' into file-browser
Diffstat (limited to 'src/input/input_touch_dpad.cpp')
| -rw-r--r-- | src/input/input_touch_dpad.cpp | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/src/input/input_touch_dpad.cpp b/src/input/input_touch_dpad.cpp deleted file mode 100644 index f0805993..00000000 --- a/src/input/input_touch_dpad.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 2024 jacqueline <me@jacqueline.id.au> - * - * SPDX-License-Identifier: GPL-3.0-only - */ - -#include "input_touch_dpad.hpp" - -#include <cstdint> - -#include "hal/lv_hal_indev.h" - -#include "event_queue.hpp" -#include "haptics.hpp" -#include "input_device.hpp" -#include "input_hook_actions.hpp" -#include "input_touch_dpad.hpp" -#include "touchwheel.hpp" - -namespace input { - -TouchDPad::TouchDPad(drivers::TouchWheel& wheel) - : wheel_(wheel), - centre_("centre", actions::select(), {}, {}), - up_("up", actions::scrollUp()), - right_("right", {}, {}, {}), - down_("down", actions::scrollDown()), - left_("left", actions::goBack()) {} - -auto TouchDPad::read(lv_indev_data_t* data) -> void { - wheel_.Update(); - auto wheel_data = wheel_.GetTouchWheelData(); - - centre_.update(wheel_data.is_button_touched, data); - - up_.update( - wheel_data.is_wheel_touched && - drivers::TouchWheel::isAngleWithin(wheel_data.wheel_position, 0, 32), - data); - right_.update( - wheel_data.is_wheel_touched && drivers::TouchWheel::isAngleWithin( - wheel_data.wheel_position, 192, 32), - data); - down_.update( - wheel_data.is_wheel_touched && drivers::TouchWheel::isAngleWithin( - wheel_data.wheel_position, 128, 32), - data); - left_.update( - wheel_data.is_wheel_touched && - drivers::TouchWheel::isAngleWithin(wheel_data.wheel_position, 64, 32), - data); -} - -auto TouchDPad::name() -> std::string { - return "dpad"; -} - -auto TouchDPad::hooks() -> std::vector<TriggerHooks> { - return {centre_, up_, right_, down_, left_}; -} - -} // namespace input |
