- Updated all boards to use `hal::Configuration.createDevices` - Updated all boards to use new directory structure and file naming convention - Refactored `Xpt2046SoftSpi` driver. - Created `Axp2101Power` device in `Drivers/AXP2101` - Removed global static instances from some drivers (instances that kept a reference to the Device*) - Improved `SystemInfoApp` UI: better memory labels, hide external memory bar when there's no PSRAM - Fix for HAL: register touch devices after displays are registered - Fix for Boot splash hanging on WiFi init: unlock file lock after using it
53 lines
1.5 KiB
C++
53 lines
1.5 KiB
C++
#pragma once
|
|
|
|
#include <Tactility/hal/keyboard/KeyboardDevice.h>
|
|
|
|
#include <Tca8418.h>
|
|
#include <driver/gpio.h>
|
|
#include <driver/ledc.h>
|
|
|
|
#include <Tactility/Timer.h>
|
|
|
|
class TpagerKeyboard final : public tt::hal::keyboard::KeyboardDevice {
|
|
|
|
lv_indev_t* _Nullable kbHandle = nullptr;
|
|
gpio_num_t backlightPin = GPIO_NUM_NC;
|
|
ledc_timer_t backlightTimer;
|
|
ledc_channel_t backlightChannel;
|
|
bool backlightOkay = false;
|
|
int backlightImpulseDuty = 0;
|
|
QueueHandle_t queue;
|
|
|
|
std::shared_ptr<Tca8418> keypad;
|
|
std::unique_ptr<tt::Timer> inputTimer;
|
|
std::unique_ptr<tt::Timer> backlightImpulseTimer;
|
|
|
|
bool initBacklight(gpio_num_t pin, uint32_t frequencyHz, ledc_timer_t timer, ledc_channel_t channel);
|
|
void processKeyboard();
|
|
void processBacklightImpulse();
|
|
|
|
static void readCallback(lv_indev_t* indev, lv_indev_data_t* data);
|
|
|
|
public:
|
|
|
|
TpagerKeyboard(const std::shared_ptr<Tca8418>& tca) : keypad(tca) {
|
|
queue = xQueueCreate(20, sizeof(char));
|
|
}
|
|
|
|
~TpagerKeyboard() {
|
|
vQueueDelete(queue);
|
|
}
|
|
|
|
std::string getName() const override { return "T-Lora Pager Keyboard"; }
|
|
std::string getDescription() const override { return "T-Lora Pager I2C keyboard with encoder"; }
|
|
|
|
bool startLvgl(lv_display_t* display) override;
|
|
bool stopLvgl() override;
|
|
|
|
bool isAttached() const override;
|
|
lv_indev_t* _Nullable getLvglIndev() override { return kbHandle; }
|
|
|
|
bool setBacklightDuty(uint8_t duty);
|
|
void makeBacklightImpulse();
|
|
};
|