dbf850c434
- M5 Unit Modules library + M5 Unit Test app - Minor fixes for TodoList, TwoEleven, Snake, Brainfuck and Breakout - Fixed SerialConsole to use the uart controller as it was broken in one of the many updates - Fixed keyboard input in TwoEleven, Breakout, Magic8Ball and Snake - Bluetooth Media Keys app, supports pressing physical keys to trigger the corresponding buttonmatrix button - Epub Reader app
30 lines
957 B
C++
30 lines
957 B
C++
#pragma once
|
|
#include "TestViewBase.h"
|
|
#include <UnitByteButton.h>
|
|
#include <UnitPaHub.h>
|
|
|
|
class TestUnitByteButton final : public TestViewBase {
|
|
public:
|
|
void onStart(lv_obj_t* parent, AppHandle handle, M5UnitTest* app) override;
|
|
void onStop() override;
|
|
|
|
private:
|
|
static constexpr int BTN_COUNT = UnitByteButton::BUTTON_COUNT;
|
|
static constexpr uint32_t COLOR_OFF = 0x001100;
|
|
static constexpr uint32_t COLOR_ON = 0x00FF44;
|
|
static constexpr uint32_t COLOR_ERROR = 0x440000;
|
|
static constexpr uint32_t COLOR_PRESSED = 0xFFFF00;
|
|
|
|
UnitPaHub hub_;
|
|
UnitByteButton unit_;
|
|
lv_obj_t* indicators_[BTN_COUNT] = {};
|
|
lv_timer_t* timer_ = nullptr;
|
|
uint32_t ledColors_[BTN_COUNT] = {};
|
|
bool prevPressed_[BTN_COUNT]= {};
|
|
bool usingPaHub_ = false;
|
|
|
|
void selectIfNeeded();
|
|
static void onTimer(lv_timer_t* t);
|
|
void update();
|
|
};
|