add tft
This commit is contained in:
@@ -26,10 +26,16 @@ enum class Button: uint8_t {
|
||||
B2 = 1,
|
||||
B3 = 2,
|
||||
B4 = 3,
|
||||
|
||||
GREEN = 0,
|
||||
RED = 1,
|
||||
YELLOW = 2,
|
||||
BLUE = 3,
|
||||
|
||||
LEFT = 0,
|
||||
DOWN = 1,
|
||||
UP = 2,
|
||||
RIGHT = 3,
|
||||
};
|
||||
|
||||
constexpr uint8_t raw_value(Button v) { return static_cast<uint8_t>(v); }
|
||||
@@ -85,7 +91,6 @@ constexpr char keypad_key_to_char(KeypadKey key) {
|
||||
return lookup[static_cast<uint8_t>(key) & 0b1111];
|
||||
}
|
||||
|
||||
|
||||
struct SwitchFlip {
|
||||
private:
|
||||
// [bit2: up] [bit1-0: switch]
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
#ifndef TFT_HPP
|
||||
#define TFT_HPP
|
||||
|
||||
#include <lvgl.h>
|
||||
#include <freertos/FreeRTOS.h>
|
||||
|
||||
// Uncomment the following line to enable using double buffering of LVGL color
|
||||
// data.
|
||||
// #define USE_DOUBLE_BUFFERING 1
|
||||
|
||||
// rotation swaps the horizontal and vertical pixel counts
|
||||
#define DISPLAY_HORIZONTAL_PIXELS 480
|
||||
#define DISPLAY_VERTICAL_PIXELS 320
|
||||
#define DISPLAY_COMMAND_BITS 8
|
||||
#define DISPLAY_PARAMETER_BITS 8
|
||||
#define DISPLAY_REFRESH_HZ 40000000
|
||||
#define DISPLAY_SPI_QUEUE_LEN 10
|
||||
#define SPI_MAX_TRANSFER_SIZE 32768
|
||||
|
||||
#define TFT_INVERT_COLOR false
|
||||
|
||||
// Default to 50 lines of color data
|
||||
#define LV_BUFFER_SIZE DISPLAY_HORIZONTAL_PIXELS * 50
|
||||
#define LVGL_UPDATE_PERIOD_MS 5
|
||||
|
||||
#define BACKLIGHT_LEDC_MODE LEDC_LOW_SPEED_MODE
|
||||
#define BACKLIGHT_LEDC_CHANNEL LEDC_CHANNEL_0
|
||||
#define BACKLIGHT_LEDC_TIMER LEDC_TIMER_1
|
||||
#define BACKLIGHT_LEDC_TIMER_RESOLUTION LEDC_TIMER_10_BIT
|
||||
#define BACKLIGHT_LEDC_FRQUENCY 5000
|
||||
|
||||
extern lv_obj_t* screen;
|
||||
|
||||
void init_tft();
|
||||
|
||||
bool lvgl_lock(TickType_t ticks_to_wait);
|
||||
void lvgl_unlock();
|
||||
|
||||
#endif // TFT_HPP
|
||||
Reference in New Issue
Block a user