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
|
||||
+6
-5
@@ -6,11 +6,12 @@
|
||||
#define PIN_SDA (GPIO_NUM_7)
|
||||
#define PIN_SCL (GPIO_NUM_15)
|
||||
|
||||
#define PIN_LCD_MISO (GPIO_NUM_16)
|
||||
#define PIN_LCD_MOSI (GPIO_NUM_17)
|
||||
#define PIN_LCD_CLK (GPIO_NUM_18)
|
||||
#define PIN_LCD_RS (GPIO_NUM_8)
|
||||
#define PIN_LCD_RST (GPIO_NUM_9)
|
||||
#define PIN_TFT_CS (GPIO_NUM_NC)
|
||||
#define PIN_TFT_MISO (GPIO_NUM_16)
|
||||
#define PIN_TFT_MOSI (GPIO_NUM_17)
|
||||
#define PIN_TFT_CLK (GPIO_NUM_18)
|
||||
#define PIN_TFT_RS (GPIO_NUM_8)
|
||||
#define PIN_TFT_RST (GPIO_NUM_9)
|
||||
|
||||
#define PIN_USB_DM (GPIO_NUM_19)
|
||||
#define PIN_USB_DP (GPIO_NUM_20)
|
||||
|
||||
Reference in New Issue
Block a user