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/device_factory.cpp | |
| parent | 8019c7691889cde4c3d40bbd78d485a92d713bbf (diff) | |
| parent | e4ce7c4ac23402e09be8d6a52e0f739c0dff4ff0 (diff) | |
| download | tangara-fw-3f177cdb8880abf199f4445f1398cd69fb813892.tar.gz | |
Merge branch 'main' into file-browser
Diffstat (limited to 'src/input/device_factory.cpp')
| -rw-r--r-- | src/input/device_factory.cpp | 58 |
1 files changed, 0 insertions, 58 deletions
diff --git a/src/input/device_factory.cpp b/src/input/device_factory.cpp deleted file mode 100644 index 65f4d785..00000000 --- a/src/input/device_factory.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2023 jacqueline <me@jacqueline.id.au> - * - * SPDX-License-Identifier: GPL-3.0-only - */ - -#include "device_factory.hpp" - -#include <memory> - -#include "feedback_haptics.hpp" -#include "input_device.hpp" -#include "input_nav_buttons.hpp" -#include "input_touch_dpad.hpp" -#include "input_touch_wheel.hpp" -#include "input_volume_buttons.hpp" - -namespace input { - -DeviceFactory::DeviceFactory( - std::shared_ptr<system_fsm::ServiceLocator> services) - : services_(services) { - if (services->touchwheel()) { - wheel_ = - std::make_shared<TouchWheel>(services->nvs(), **services->touchwheel()); - } -} - -auto DeviceFactory::createInputs(drivers::NvsStorage::InputModes mode) - -> std::vector<std::shared_ptr<IInputDevice>> { - std::vector<std::shared_ptr<IInputDevice>> ret; - switch (mode) { - case drivers::NvsStorage::InputModes::kButtonsOnly: - ret.push_back(std::make_shared<NavButtons>(services_->gpios())); - break; - case drivers::NvsStorage::InputModes::kDirectionalWheel: - ret.push_back(std::make_shared<VolumeButtons>(services_->gpios())); - if (services_->touchwheel()) { - ret.push_back(std::make_shared<TouchDPad>(**services_->touchwheel())); - } - break; - case drivers::NvsStorage::InputModes::kRotatingWheel: - default: // Don't break input over a bad enum value. - ret.push_back(std::make_shared<VolumeButtons>(services_->gpios())); - if (wheel_) { - ret.push_back(wheel_); - } - break; - } - return ret; -} - -auto DeviceFactory::createFeedbacks() - -> std::vector<std::shared_ptr<IFeedbackDevice>> { - return {std::make_shared<Haptics>(services_->haptics())}; -} - -} // namespace input |
