43 lines
1.3 KiB
C
43 lines
1.3 KiB
C
#pragma once
|
|
#include "driver/spi_master.h"
|
|
#include "driver/gpio.h"
|
|
#include "freertos/FreeRTOS.h"
|
|
#include "freertos/task.h"
|
|
#include "esp_lcd_touch_gt911.h"
|
|
#include "display/constants.h"
|
|
#include <driver/i2c.h>
|
|
|
|
class DisplayHandler {
|
|
public:
|
|
DisplayHandler(
|
|
EventGroupHandle_t system_event_group
|
|
) : _system_event_group(system_event_group) { }
|
|
virtual ~DisplayHandler();
|
|
|
|
// required to be called by inheriting class after SPI device is created
|
|
// set set_display_ready to false if further initialization is needed before marking display ready
|
|
virtual void init_devices(bool set_display_ready = true);
|
|
|
|
protected:
|
|
// Allow derived classes to access touch handle
|
|
esp_lcd_touch_handle_t get_touch_handle() const { return _tp_handle; }
|
|
|
|
void epd_write_cmd(uint8_t cmd);
|
|
void epd_write_data(uint8_t data);
|
|
|
|
void epd_write_cmd_with_data(uint8_t cmd, const uint8_t* data, size_t data_len);
|
|
|
|
protected:
|
|
SemaphoreHandle_t _spi_mutex = xSemaphoreCreateMutex();
|
|
spi_device_handle_t _spi = nullptr;
|
|
EventGroupHandle_t _system_event_group = nullptr;
|
|
esp_lcd_panel_io_handle_t _tp_io_handle = nullptr;
|
|
esp_lcd_touch_handle_t _tp_handle = nullptr;
|
|
|
|
void _dangerous_epd_write_cmd_without_lock(uint8_t cmd);
|
|
void _dangerous_epd_write_data_without_lock(uint8_t data);
|
|
|
|
void _epd_init(void);
|
|
void _touch_init(void);
|
|
};
|