blob: be45236868185911524d76ffee39a018ad2d5bef (
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
/*
* Copyright 2023 jacqueline <me@jacqueline.id.au>
*
* SPDX-License-Identifier: GPL-3.0-only
*/
#pragma once
#include <stdint.h>
#include <deque>
#include <memory>
#include <set>
#include "core/lv_group.h"
#include "feedback_device.hpp"
#include "gpios.hpp"
#include "hal/lv_hal_indev.h"
#include "input_device.hpp"
#include "nvs.hpp"
#include "service_locator.hpp"
#include "touchwheel.hpp"
namespace input {
/*
* Implementation of an LVGL input device. This class composes multiple
* IInputDevice and IFeedbackDevice instances together into a single LVGL
* device.
*/
class LvglInputDriver {
public:
LvglInputDriver(std::shared_ptr<system_fsm::ServiceLocator>);
auto read(lv_indev_data_t* data) -> void;
auto feedback(uint8_t) -> void;
auto registration() -> lv_indev_t* { return registration_; }
auto lock(bool l) -> void { is_locked_ = l; }
private:
std::shared_ptr<system_fsm::ServiceLocator> services_;
lv_indev_drv_t driver_;
lv_indev_t* registration_;
std::vector<std::unique_ptr<IInputDevice>> inputs_;
std::vector<std::unique_ptr<IFeedbackDevice>> feedbacks_;
bool is_locked_;
};
} // namespace input
|