kopia lustrzana https://github.com/espressif/esp-idf
lcd: unify callback prototype
rodzic
aa73e423d4
commit
e09e39c94f
|
@ -65,6 +65,22 @@ esp_err_t esp_lcd_panel_io_tx_color(esp_lcd_panel_io_handle_t io, int lcd_cmd, c
|
|||
*/
|
||||
esp_err_t esp_lcd_panel_io_del(esp_lcd_panel_io_handle_t io);
|
||||
|
||||
/**
|
||||
* @brief Type of LCD panel IO event data
|
||||
*/
|
||||
typedef struct {
|
||||
} esp_lcd_panel_io_event_data_t;
|
||||
|
||||
/**
|
||||
* @brief Declare the prototype of the function that will be invoked when panel IO finishes transferring color data
|
||||
*
|
||||
* @param[in] panel_io LCD panel IO handle, which is created by factory API like `esp_lcd_new_panel_io_spi()`
|
||||
* @param[in] edata Panel IO event data, fed by driver
|
||||
* @param[in] user_ctx User data, passed from `esp_lcd_panel_io_xxx_config_t`
|
||||
* @return Whether a high priority task has been waken up by this function
|
||||
*/
|
||||
typedef bool (*esp_lcd_panel_io_color_trans_done_cb_t)(esp_lcd_panel_io_handle_t panel_io, esp_lcd_panel_io_event_data_t *edata, void *user_ctx);
|
||||
|
||||
/**
|
||||
* @brief Panel IO configuration structure, for SPI interface
|
||||
*/
|
||||
|
@ -74,8 +90,8 @@ typedef struct {
|
|||
int spi_mode; /*!< Traditional SPI mode (0~3) */
|
||||
unsigned int pclk_hz; /*!< Frequency of pixel clock */
|
||||
size_t trans_queue_depth; /*!< Size of internal transaction queue */
|
||||
bool (*on_color_trans_done)(esp_lcd_panel_io_handle_t panel_io, void *user_data, void *event_data); /*!< Callback, invoked when color data transfer has finished */
|
||||
void *user_data; /*!< User private data, passed directly to on_trans_frame_done's user_data */
|
||||
esp_lcd_panel_io_color_trans_done_cb_t on_color_trans_done; /*!< Callback invoked when color data transfer has finished */
|
||||
void *user_ctx; /*!< User private data, passed directly to on_color_trans_done's user_ctx */
|
||||
int lcd_cmd_bits; /*!< Bit-width of LCD command */
|
||||
int lcd_param_bits; /*!< Bit-width of LCD parameter */
|
||||
struct {
|
||||
|
@ -100,8 +116,8 @@ esp_err_t esp_lcd_new_panel_io_spi(esp_lcd_spi_bus_handle_t bus, const esp_lcd_p
|
|||
|
||||
typedef struct {
|
||||
uint32_t dev_addr; /*!< I2C device address */
|
||||
bool (*on_color_trans_done)(esp_lcd_panel_io_handle_t panel_io, void *user_data, void *event_data); /*!< Callback, invoked when color data transfer has finished */
|
||||
void *user_data; /*!< User private data, passed directly to on_trans_frame_done's user_data */
|
||||
esp_lcd_panel_io_color_trans_done_cb_t on_color_trans_done; /*!< Callback invoked when color data transfer has finished */
|
||||
void *user_ctx; /*!< User private data, passed directly to on_color_trans_done's user_ctx */
|
||||
size_t control_phase_bytes; /*!< I2C LCD panel will encode control information (e.g. D/C seclection) into control phase, in several bytes */
|
||||
unsigned int dc_bit_offset; /*!< Offset of the D/C selection bit in control phase */
|
||||
int lcd_cmd_bits; /*!< Bit-width of LCD command */
|
||||
|
@ -168,8 +184,8 @@ typedef struct {
|
|||
int cs_gpio_num; /*!< GPIO used for CS line, set to -1 will declaim exclusively use of I80 bus */
|
||||
unsigned int pclk_hz; /*!< Frequency of pixel clock */
|
||||
size_t trans_queue_depth; /*!< Transaction queue size, larger queue, higher throughput */
|
||||
bool (*on_color_trans_done)(esp_lcd_panel_io_handle_t panel_io, void *user_data, void *event_data); /*!< Callback, invoked when color data was tranferred done */
|
||||
void *user_data; /*!< User private data, passed directly to on_trans_done's user_data */
|
||||
esp_lcd_panel_io_color_trans_done_cb_t on_color_trans_done; /*!< Callback invoked when color data was tranferred done */
|
||||
void *user_ctx; /*!< User private data, passed directly to on_color_trans_done's user_ctx */
|
||||
int lcd_cmd_bits; /*!< Bit-width of LCD command */
|
||||
int lcd_param_bits; /*!< Bit-width of LCD parameter */
|
||||
struct {
|
||||
|
|
|
@ -18,6 +18,37 @@ extern "C" {
|
|||
#if SOC_LCD_RGB_SUPPORTED
|
||||
/**
|
||||
* @brief LCD RGB timing structure
|
||||
*
|
||||
* Total Width
|
||||
* <--------------------------------------------------->
|
||||
* Hsync width HBP Active Width HFP
|
||||
* <---><--><--------------------------------------><--->
|
||||
* ____ ____|_______________________________________|____|
|
||||
* |___| | | |
|
||||
* | | |
|
||||
* __| | | |
|
||||
* /|\ /|\ | | | |
|
||||
* | VSYNC| | | | |
|
||||
* |Width\|/ |__ | | |
|
||||
* | /|\ | | | |
|
||||
* | VBP | | | | |
|
||||
* | \|/_____|_________|_______________________________________| |
|
||||
* | /|\ | | / / / / / / / / / / / / / / / / / / / | |
|
||||
* | | | |/ / / / / / / / / / / / / / / / / / / /| |
|
||||
* Total | | | |/ / / / / / / / / / / / / / / / / / / /| |
|
||||
* Heigh | | | |/ / / / / / / / / / / / / / / / / / / /| |
|
||||
* |Active| | |/ / / / / / / / / / / / / / / / / / / /| |
|
||||
* |Heigh | | |/ / / / / / Active Display Area / / / /| |
|
||||
* | | | |/ / / / / / / / / / / / / / / / / / / /| |
|
||||
* | | | |/ / / / / / / / / / / / / / / / / / / /| |
|
||||
* | | | |/ / / / / / / / / / / / / / / / / / / /| |
|
||||
* | | | |/ / / / / / / / / / / / / / / / / / / /| |
|
||||
* | | | |/ / / / / / / / / / / / / / / / / / / /| |
|
||||
* | \|/_____|_________|_______________________________________| |
|
||||
* | /|\ | |
|
||||
* | VFP | | |
|
||||
* \|/ \|/_____|______________________________________________________|
|
||||
*
|
||||
*/
|
||||
typedef struct {
|
||||
unsigned int pclk_hz; /*!< Frequency of pixel clock */
|
||||
|
@ -38,6 +69,22 @@ typedef struct {
|
|||
} flags;
|
||||
} esp_lcd_rgb_timing_t;
|
||||
|
||||
/**
|
||||
* @brief Type of RGB LCD panel event data
|
||||
*/
|
||||
typedef struct {
|
||||
} esp_lcd_rgb_panel_event_data_t;
|
||||
|
||||
/**
|
||||
* @brief Declare the prototype of the function that will be invoked when panel IO finishes transferring color data
|
||||
*
|
||||
* @param[in] panel LCD panel handle, returned from `esp_lcd_new_rgb_panel`
|
||||
* @param[in] edata Panel event data, fed by driver
|
||||
* @param[in] user_ctx User data, passed from `esp_lcd_rgb_panel_config_t`
|
||||
* @return Whether a high priority task has been waken up by this function
|
||||
*/
|
||||
typedef bool (*esp_lcd_rgb_panel_frame_trans_done_cb_t)(esp_lcd_panel_handle_t panel, esp_lcd_rgb_panel_event_data_t *edata, void *user_ctx);
|
||||
|
||||
/**
|
||||
* @brief LCD RGB panel configuration structure
|
||||
*/
|
||||
|
@ -51,8 +98,8 @@ typedef struct {
|
|||
int pclk_gpio_num; /*!< GPIO used for PCLK signal */
|
||||
int data_gpio_nums[SOC_LCD_RGB_DATA_WIDTH]; /*!< GPIOs used for data lines */
|
||||
int disp_gpio_num; /*!< GPIO used for display control signal, set to -1 if it's not used */
|
||||
bool (*on_frame_trans_done)(esp_lcd_panel_handle_t panel, void *user_data); /*!< Callback, invoked when one frame buffer has transferred done */
|
||||
void *user_data; /*!< User data which would be passed to on_frame_trans_done's user_data */
|
||||
esp_lcd_rgb_panel_frame_trans_done_cb_t on_frame_trans_done; /*!< Callback invoked when one frame buffer has transferred done */
|
||||
void *user_ctx; /*!< User data which would be passed to on_frame_trans_done's user_ctx */
|
||||
struct {
|
||||
unsigned int disp_active_low: 1; /*!< If this flag is enabled, a low level of display control signal can turn the screen on; vice versa */
|
||||
unsigned int relax_on_idle: 1; /*!< If this flag is enabled, the host won't refresh the LCD if nothing changed in host's frame buffer (this is usefull for LCD with built-in GRAM) */
|
||||
|
|
|
@ -33,9 +33,9 @@ typedef struct {
|
|||
int lcd_param_bits; // Bit width of LCD parameter
|
||||
uint32_t control_phase_cmd; // control byte when transferring command
|
||||
uint32_t control_phase_data; // control byte when transferring data
|
||||
bool (*on_color_trans_done)(esp_lcd_panel_io_handle_t panel_io, void *user_data, void *event_data); // User register's callback, invoked when color data trans done
|
||||
void *user_data; // User's private data, passed directly to callback on_color_trans_done()
|
||||
uint8_t cmdlink_buffer[]; // pre-alloc I2C command link buffer, to be reused in all transactions
|
||||
esp_lcd_panel_io_color_trans_done_cb_t on_color_trans_done; // User register's callback, invoked when color data trans done
|
||||
void *user_ctx; // User's private data, passed directly to callback on_color_trans_done()
|
||||
uint8_t cmdlink_buffer[]; // pre-alloc I2C command link buffer, to be reused in all transactions
|
||||
} lcd_panel_io_i2c_t;
|
||||
|
||||
esp_err_t esp_lcd_new_panel_io_i2c(esp_lcd_i2c_bus_handle_t bus, const esp_lcd_panel_io_i2c_config_t *io_config, esp_lcd_panel_io_handle_t *ret_io)
|
||||
|
@ -51,9 +51,9 @@ esp_err_t esp_lcd_new_panel_io_i2c(esp_lcd_i2c_bus_handle_t bus, const esp_lcd_p
|
|||
i2c_panel_io->lcd_cmd_bits = io_config->lcd_cmd_bits;
|
||||
i2c_panel_io->lcd_param_bits = io_config->lcd_param_bits;
|
||||
i2c_panel_io->on_color_trans_done = io_config->on_color_trans_done;
|
||||
i2c_panel_io->user_ctx = io_config->user_ctx;
|
||||
i2c_panel_io->control_phase_data = (!io_config->flags.dc_low_on_data) << (io_config->dc_bit_offset);
|
||||
i2c_panel_io->control_phase_cmd = (io_config->flags.dc_low_on_data) << (io_config->dc_bit_offset);
|
||||
i2c_panel_io->user_data = io_config->user_data;
|
||||
i2c_panel_io->dev_addr = io_config->dev_addr;
|
||||
i2c_panel_io->base.del = panel_io_i2c_del;
|
||||
i2c_panel_io->base.tx_param = panel_io_i2c_tx_param;
|
||||
|
@ -104,7 +104,7 @@ static esp_err_t panel_io_i2c_tx_buffer(esp_lcd_panel_io_t *io, int lcd_cmd, con
|
|||
if (!is_param) {
|
||||
// trans done callback
|
||||
if (i2c_panel_io->on_color_trans_done) {
|
||||
i2c_panel_io->on_color_trans_done(&(i2c_panel_io->base), i2c_panel_io->user_data, NULL);
|
||||
i2c_panel_io->on_color_trans_done(&(i2c_panel_io->base), NULL, i2c_panel_io->user_ctx);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -81,8 +81,8 @@ struct lcd_i80_trans_descriptor_t {
|
|||
lcd_panel_io_i80_t *i80_device; // i80 device issuing this transaction
|
||||
const void *data; // Data buffer
|
||||
uint32_t data_length; // Data buffer size
|
||||
void *cb_user_data; // private data used by trans_done_cb
|
||||
bool (*trans_done_cb)(esp_lcd_panel_io_handle_t panel_io, void *user_data, void *event_data); // transaction done callback
|
||||
esp_lcd_panel_io_color_trans_done_cb_t trans_done_cb; // transaction done callback
|
||||
void *user_ctx; // private data used by trans_done_cb
|
||||
struct {
|
||||
unsigned int dc_level: 1; // Level of DC line for this transaction
|
||||
} flags;
|
||||
|
@ -97,11 +97,11 @@ struct lcd_panel_io_i80_t {
|
|||
QueueHandle_t trans_queue; // Transaction queue, transactions in this queue are pending for scheduler to dispatch
|
||||
QueueHandle_t done_queue; // Transaction done queue, transactions in this queue are finished but not recycled by the caller
|
||||
size_t queue_size; // Size of transaction queue
|
||||
size_t num_trans_inflight; // Number of transactions that are undergoing (the descriptor not recycled yet)
|
||||
size_t num_trans_inflight; // Number of transactions that are undergoing (the descriptor not recycled yet)
|
||||
int lcd_cmd_bits; // Bit width of LCD command
|
||||
int lcd_param_bits; // Bit width of LCD parameter
|
||||
void *cb_user_data; // private data used when transfer color data
|
||||
bool (*on_color_trans_done)(esp_lcd_panel_io_handle_t panel_io, void *user_data, void *event_data); // color data trans done callback
|
||||
void *user_ctx; // private data used when transfer color data
|
||||
esp_lcd_panel_io_color_trans_done_cb_t on_color_trans_done; // color data trans done callback
|
||||
LIST_ENTRY(lcd_panel_io_i80_t) device_list_entry; // Entry of i80 device list
|
||||
struct {
|
||||
unsigned int dc_cmd_level: 1; // Level of DC line in CMD phase
|
||||
|
@ -274,7 +274,7 @@ esp_err_t esp_lcd_new_panel_io_i80(esp_lcd_i80_bus_handle_t bus, const esp_lcd_p
|
|||
i80_device->dc_levels.dc_data_level = io_config->dc_levels.dc_data_level;
|
||||
i80_device->cs_gpio_num = io_config->cs_gpio_num;
|
||||
i80_device->on_color_trans_done = io_config->on_color_trans_done;
|
||||
i80_device->cb_user_data = io_config->user_data;
|
||||
i80_device->user_ctx = io_config->user_ctx;
|
||||
i80_device->flags.cs_active_high = io_config->flags.cs_active_high;
|
||||
i80_device->flags.swap_color_bytes = io_config->flags.swap_color_bytes;
|
||||
i80_device->flags.pclk_idle_low = io_config->flags.pclk_idle_low;
|
||||
|
@ -557,7 +557,7 @@ static esp_err_t panel_io_i80_tx_color(esp_lcd_panel_io_t *io, int lcd_cmd, cons
|
|||
|
||||
// sending LCD color data to queue
|
||||
trans_desc->trans_done_cb = next_device->on_color_trans_done;
|
||||
trans_desc->cb_user_data = next_device->cb_user_data;
|
||||
trans_desc->user_ctx = next_device->user_ctx;
|
||||
trans_desc->flags.dc_level = next_device->dc_levels.dc_data_level; // DC level for data transaction
|
||||
i2s_lcd_prepare_color_buffer(trans_desc, color, color_size);
|
||||
// send transaction to trans_queue
|
||||
|
@ -697,7 +697,7 @@ static IRAM_ATTR void lcd_default_isr_handler(void *args)
|
|||
}
|
||||
// device callback
|
||||
if (trans_desc->trans_done_cb) {
|
||||
if (trans_desc->trans_done_cb(&cur_device->base, trans_desc->cb_user_data, NULL)) {
|
||||
if (trans_desc->trans_done_cb(&cur_device->base, NULL, trans_desc->user_ctx)) {
|
||||
need_yield = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -77,8 +77,8 @@ struct lcd_i80_trans_descriptor_t {
|
|||
uint32_t cmd_cycles; // Command cycles
|
||||
const void *data; // Data buffer
|
||||
uint32_t data_length; // Data buffer size
|
||||
void *cb_user_data; // private data used by trans_done_cb
|
||||
bool (*trans_done_cb)(esp_lcd_panel_io_handle_t panel_io, void *user_data, void *event_data); // transaction done callback
|
||||
void *user_ctx; // private data used by trans_done_cb
|
||||
esp_lcd_panel_io_color_trans_done_cb_t trans_done_cb; // transaction done callback
|
||||
};
|
||||
|
||||
struct lcd_panel_io_i80_t {
|
||||
|
@ -90,11 +90,11 @@ struct lcd_panel_io_i80_t {
|
|||
QueueHandle_t trans_queue; // Transaction queue, transactions in this queue are pending for scheduler to dispatch
|
||||
QueueHandle_t done_queue; // Transaction done queue, transactions in this queue are finished but not recycled by the caller
|
||||
size_t queue_size; // Size of transaction queue
|
||||
size_t num_trans_inflight; // Number of transactions that are undergoing (the descriptor not recycled yet)
|
||||
size_t num_trans_inflight; // Number of transactions that are undergoing (the descriptor not recycled yet)
|
||||
int lcd_cmd_bits; // Bit width of LCD command
|
||||
int lcd_param_bits; // Bit width of LCD parameter
|
||||
void *cb_user_data; // private data used when transfer color data
|
||||
bool (*on_color_trans_done)(esp_lcd_panel_io_handle_t panel_io, void *user_data, void *event_data); // color data trans done callback
|
||||
void *user_ctx; // private data used when transfer color data
|
||||
esp_lcd_panel_io_color_trans_done_cb_t on_color_trans_done; // color data trans done callback
|
||||
LIST_ENTRY(lcd_panel_io_i80_t) device_list_entry; // Entry of i80 device list
|
||||
struct {
|
||||
unsigned int dc_idle_level: 1; // Level of DC line in IDLE phase
|
||||
|
@ -267,7 +267,7 @@ esp_err_t esp_lcd_new_panel_io_i80(esp_lcd_i80_bus_handle_t bus, const esp_lcd_p
|
|||
i80_device->flags.pclk_idle_low = io_config->flags.pclk_idle_low;
|
||||
i80_device->flags.pclk_active_neg = io_config->flags.pclk_active_neg;
|
||||
i80_device->on_color_trans_done = io_config->on_color_trans_done;
|
||||
i80_device->cb_user_data = io_config->user_data;
|
||||
i80_device->user_ctx = io_config->user_ctx;
|
||||
// fill panel io function table
|
||||
i80_device->base.del = panel_io_i80_del;
|
||||
i80_device->base.tx_param = panel_io_i80_tx_param;
|
||||
|
@ -434,7 +434,7 @@ static esp_err_t panel_io_i80_tx_color(esp_lcd_panel_io_t *io, int lcd_cmd, cons
|
|||
trans_desc->data = color;
|
||||
trans_desc->data_length = color_size;
|
||||
trans_desc->trans_done_cb = i80_device->on_color_trans_done;
|
||||
trans_desc->cb_user_data = i80_device->cb_user_data;
|
||||
trans_desc->user_ctx = i80_device->user_ctx;
|
||||
// send transaction to trans_queue
|
||||
xQueueSend(i80_device->trans_queue, &trans_desc, portMAX_DELAY);
|
||||
i80_device->num_trans_inflight++;
|
||||
|
@ -591,7 +591,7 @@ IRAM_ATTR static void lcd_default_isr_handler(void *args)
|
|||
}
|
||||
// device callback
|
||||
if (trans_desc->trans_done_cb) {
|
||||
if (trans_desc->trans_done_cb(&cur_device->base, trans_desc->cb_user_data, NULL)) {
|
||||
if (trans_desc->trans_done_cb(&cur_device->base, NULL, trans_desc->user_ctx)) {
|
||||
need_yield = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,8 +37,8 @@ typedef struct {
|
|||
esp_lcd_panel_io_t base; // Base class of generic lcd panel io
|
||||
spi_device_handle_t spi_dev; // SPI device handle
|
||||
int dc_gpio_num; // D/C line GPIO number
|
||||
bool (*on_color_trans_done)(esp_lcd_panel_io_handle_t panel_io, void *user_data, void *event_data); // User register's callback, invoked when color data trans done
|
||||
void *user_data; // User's private data, passed directly to callback on_color_trans_done
|
||||
esp_lcd_panel_io_color_trans_done_cb_t on_color_trans_done; // User register's callback, invoked when color data trans done
|
||||
void *user_ctx; // User's private data, passed directly to callback on_color_trans_done
|
||||
size_t queue_size; // Size of transaction queue
|
||||
size_t num_trans_inflight; // Number of transactions that are undergoing (the descriptor not recycled yet)
|
||||
int lcd_cmd_bits; // Bit width of LCD command
|
||||
|
@ -62,7 +62,7 @@ esp_err_t esp_lcd_new_panel_io_spi(esp_lcd_spi_bus_handle_t bus, const esp_lcd_p
|
|||
ESP_GOTO_ON_FALSE(spi_panel_io, ESP_ERR_NO_MEM, err, TAG, "no mem for spi panel io");
|
||||
|
||||
spi_device_interface_config_t devcfg = {
|
||||
.flags = SPI_DEVICE_HALFDUPLEX,
|
||||
.flags = SPI_DEVICE_HALFDUPLEX, // only use TX path, so half duplex is enough
|
||||
.clock_speed_hz = io_config->pclk_hz,
|
||||
.mode = io_config->spi_mode,
|
||||
.spics_io_num = io_config->cs_gpio_num,
|
||||
|
@ -87,9 +87,9 @@ esp_err_t esp_lcd_new_panel_io_spi(esp_lcd_spi_bus_handle_t bus, const esp_lcd_p
|
|||
spi_panel_io->flags.dc_data_level = !io_config->flags.dc_low_on_data;
|
||||
spi_panel_io->flags.octal_mode = io_config->flags.octal_mode;
|
||||
spi_panel_io->on_color_trans_done = io_config->on_color_trans_done;
|
||||
spi_panel_io->user_ctx = io_config->user_ctx;
|
||||
spi_panel_io->lcd_cmd_bits = io_config->lcd_cmd_bits;
|
||||
spi_panel_io->lcd_param_bits = io_config->lcd_param_bits;
|
||||
spi_panel_io->user_data = io_config->user_data;
|
||||
spi_panel_io->dc_gpio_num = io_config->dc_gpio_num;
|
||||
spi_panel_io->queue_size = io_config->trans_queue_depth;
|
||||
spi_panel_io->base.tx_param = panel_io_spi_tx_param;
|
||||
|
@ -271,7 +271,7 @@ static void lcd_spi_post_trans_color_cb(spi_transaction_t *trans)
|
|||
lcd_spi_trans_descriptor_t *lcd_trans = __containerof(trans, lcd_spi_trans_descriptor_t, base);
|
||||
if (lcd_trans->flags.trans_is_color) {
|
||||
if (spi_panel_io->on_color_trans_done) {
|
||||
spi_panel_io->on_color_trans_done(&spi_panel_io->base, spi_panel_io->user_data, NULL);
|
||||
spi_panel_io->on_color_trans_done(&spi_panel_io->base, NULL, spi_panel_io->user_ctx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -78,8 +78,8 @@ struct esp_rgb_panel_t {
|
|||
int new_frame_id; // ID for new frame, we use ID to identify whether the frame content has been updated
|
||||
int cur_frame_id; // ID for current transferring frame
|
||||
SemaphoreHandle_t done_sem; // Binary semaphore, indicating if the new frame has been flushed to LCD
|
||||
bool (*on_frame_trans_done)(esp_lcd_panel_t *panel, void *user_data); // Callback, invoked after frame trans done
|
||||
void *user_data; // Reserved user's data of callback functions
|
||||
esp_lcd_rgb_panel_frame_trans_done_cb_t on_frame_trans_done; // Callback, invoked after frame trans done
|
||||
void *user_ctx; // Reserved user's data of callback functions
|
||||
int x_gap; // Extra gap in x coordinate, it's used when calculate the flush window
|
||||
int y_gap; // Extra gap in y coordinate, it's used when calculate the flush window
|
||||
struct {
|
||||
|
@ -164,7 +164,7 @@ esp_err_t esp_lcd_new_rgb_panel(const esp_lcd_rgb_panel_config_t *rgb_panel_conf
|
|||
rgb_panel->disp_gpio_num = rgb_panel_config->disp_gpio_num;
|
||||
rgb_panel->flags.disp_en_level = !rgb_panel_config->flags.disp_active_low;
|
||||
rgb_panel->on_frame_trans_done = rgb_panel_config->on_frame_trans_done;
|
||||
rgb_panel->user_data = rgb_panel_config->user_data;
|
||||
rgb_panel->user_ctx = rgb_panel_config->user_ctx;
|
||||
// fill function table
|
||||
rgb_panel->base.del = rgb_panel_del;
|
||||
rgb_panel->base.reset = rgb_panel_reset;
|
||||
|
@ -493,7 +493,7 @@ IRAM_ATTR static void lcd_default_isr_handler(void *args)
|
|||
if (intr_status & LCD_LL_EVENT_VSYNC_END) {
|
||||
if (panel->flags.new_frame) { // the finished one is a new frame
|
||||
if (panel->on_frame_trans_done) {
|
||||
if (panel->on_frame_trans_done(&panel->base, panel->user_data)) {
|
||||
if (panel->on_frame_trans_done(&panel->base, NULL, panel->user_ctx)) {
|
||||
need_yield = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -77,9 +77,9 @@ TEST_CASE("lcd panel with i2c interface (ssd1306)", "[lcd]")
|
|||
#if CONFIG_LV_USE_USER_DATA
|
||||
#include "test_lvgl_port.h"
|
||||
#if CONFIG_LV_COLOR_DEPTH_1
|
||||
static bool notify_lvgl_ready_to_flush(esp_lcd_panel_io_handle_t panel_io, void *user_data, void *event_data)
|
||||
static bool notify_lvgl_ready_to_flush(esp_lcd_panel_io_handle_t panel_io, esp_lcd_panel_io_event_data_t *edata, void *user_ctx)
|
||||
{
|
||||
lv_disp_t *disp = *(lv_disp_t **)user_data;
|
||||
lv_disp_t *disp = *(lv_disp_t **)user_ctx;
|
||||
lv_disp_flush_ready(&disp->driver);
|
||||
return false;
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ TEST_CASE("lvgl gui with i2c interface (ssd1306)", "[lcd][lvgl][ignore]")
|
|||
.lcd_cmd_bits = 8, // According to SSD1306 datasheet
|
||||
.lcd_param_bits = 8, // According to SSD1306 datasheet
|
||||
.on_color_trans_done = notify_lvgl_ready_to_flush,
|
||||
.user_data = &disp,
|
||||
.user_ctx = &disp,
|
||||
};
|
||||
TEST_ESP_OK(esp_lcd_new_panel_io_i2c((esp_lcd_i2c_bus_handle_t)TEST_I2C_HOST_ID, &io_config, &io_handle));
|
||||
|
||||
|
|
|
@ -413,9 +413,9 @@ TEST_CASE("lcd panel with i80 interface (st7789, 8bits)", "[lcd]")
|
|||
#if CONFIG_LV_USE_USER_DATA
|
||||
#include "test_lvgl_port.h"
|
||||
|
||||
static bool notify_lvgl_ready_to_flush(esp_lcd_panel_io_handle_t panel_io, void *user_data, void *event_data)
|
||||
static bool notify_lvgl_ready_to_flush(esp_lcd_panel_io_handle_t panel_io, esp_lcd_panel_io_event_data_t *edata, void *user_ctx)
|
||||
{
|
||||
lv_disp_t *disp = *(lv_disp_t **)user_data;
|
||||
lv_disp_t *disp = *(lv_disp_t **)user_ctx;
|
||||
lv_disp_flush_ready(&disp->driver);
|
||||
return false;
|
||||
}
|
||||
|
@ -465,7 +465,7 @@ TEST_CASE("lvgl gui with i80 interface (st7789, 8bits)", "[lcd][lvgl][ignore]")
|
|||
.swap_color_bytes = 1,
|
||||
},
|
||||
.on_color_trans_done = notify_lvgl_ready_to_flush,
|
||||
.user_data = &disp,
|
||||
.user_ctx = &disp,
|
||||
.lcd_cmd_bits = 8,
|
||||
.lcd_param_bits = 8,
|
||||
};
|
||||
|
@ -537,7 +537,7 @@ TEST_CASE("lvgl gui with i80 interface (nt35510, 8/16bits)", "[lcd][lvgl][ignore
|
|||
.dc_data_level = 1,
|
||||
},
|
||||
.on_color_trans_done = notify_lvgl_ready_to_flush,
|
||||
.user_data = &disp,
|
||||
.user_ctx = &disp,
|
||||
.lcd_cmd_bits = 16,
|
||||
.lcd_param_bits = 16,
|
||||
};
|
||||
|
|
|
@ -105,9 +105,9 @@ TEST_CASE("lcd rgb lcd panel", "[lcd]")
|
|||
#if CONFIG_LV_USE_USER_DATA
|
||||
#include "test_lvgl_port.h"
|
||||
|
||||
static bool notify_lvgl_ready_to_flush(esp_lcd_panel_handle_t panel, void *user_data)
|
||||
static bool notify_lvgl_ready_to_flush(esp_lcd_panel_handle_t panel, esp_lcd_rgb_panel_event_data_t *edata, void *user_ctx)
|
||||
{
|
||||
lv_disp_t *disp = *(lv_disp_t **)user_data;
|
||||
lv_disp_t *disp = *(lv_disp_t **)user_ctx;
|
||||
lv_disp_flush_ready(&disp->driver);
|
||||
return false;
|
||||
}
|
||||
|
@ -157,7 +157,7 @@ TEST_CASE("lvgl gui with rgb interface", "[lcd][lvgl][ignore]")
|
|||
},
|
||||
.flags.fb_in_psram = 1,
|
||||
.on_frame_trans_done = notify_lvgl_ready_to_flush,
|
||||
.user_data = &disp,
|
||||
.user_ctx = &disp,
|
||||
};
|
||||
TEST_ESP_OK(esp_lcd_new_rgb_panel(&panel_config, &panel_handle));
|
||||
TEST_ESP_OK(esp_lcd_panel_reset(panel_handle));
|
||||
|
|
|
@ -15,9 +15,7 @@
|
|||
#define TEST_SPI_HOST_ID (1)
|
||||
#define TEST_LCD_PIXEL_CLOCK_HZ (20 * 1000 * 1000) // 20MHz
|
||||
|
||||
typedef bool (*trans_done_callback_t)(esp_lcd_panel_io_handle_t, void *, void *);
|
||||
|
||||
static void lcd_initialize_spi(esp_lcd_panel_io_handle_t *io_handle, trans_done_callback_t on_color_trans_done, void *user_data, int cmd_bits, int param_bits, bool oct_mode)
|
||||
static void lcd_initialize_spi(esp_lcd_panel_io_handle_t *io_handle, esp_lcd_panel_io_color_trans_done_cb_t on_color_trans_done, void *user_ctx, int cmd_bits, int param_bits, bool oct_mode)
|
||||
{
|
||||
gpio_config_t bk_gpio_config = {
|
||||
.mode = GPIO_MODE_OUTPUT,
|
||||
|
@ -54,7 +52,7 @@ static void lcd_initialize_spi(esp_lcd_panel_io_handle_t *io_handle, trans_done_
|
|||
.lcd_cmd_bits = cmd_bits,
|
||||
.lcd_param_bits = param_bits,
|
||||
.on_color_trans_done = on_color_trans_done,
|
||||
.user_data = user_data
|
||||
.user_ctx = user_ctx
|
||||
};
|
||||
if (oct_mode) {
|
||||
io_config.flags.octal_mode = 1;
|
||||
|
@ -187,9 +185,9 @@ TEST_CASE("lcd panel with 1-line spi interface (st7789)", "[lcd]")
|
|||
#if CONFIG_LV_USE_USER_DATA
|
||||
#include "test_lvgl_port.h"
|
||||
|
||||
static bool notify_lvgl_ready_to_flush(esp_lcd_panel_io_handle_t panel_io, void *user_data, void *event_data)
|
||||
static bool notify_lvgl_ready_to_flush(esp_lcd_panel_io_handle_t panel_io, esp_lcd_panel_io_event_data_t *edata, void *user_ctx)
|
||||
{
|
||||
lv_disp_t *disp = *(lv_disp_t **)user_data;
|
||||
lv_disp_t *disp = *(lv_disp_t **)user_ctx;
|
||||
lv_disp_flush_ready(&disp->driver);
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1,16 +1,8 @@
|
|||
// Copyright 2021 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
@ -63,17 +55,20 @@ static inline void lcd_ll_set_group_clock_src(lcd_cam_dev_t *dev, lcd_clock_sour
|
|||
}
|
||||
}
|
||||
|
||||
__attribute__((always_inline))
|
||||
static inline void lcd_ll_set_clock_idle_level(lcd_cam_dev_t *dev, bool level)
|
||||
{
|
||||
dev->lcd_clock.lcd_ck_idle_edge = level;
|
||||
}
|
||||
|
||||
__attribute__((always_inline))
|
||||
static inline void lcd_ll_set_pixel_clock_edge(lcd_cam_dev_t *dev, bool active_on_neg)
|
||||
{
|
||||
dev->lcd_clock.lcd_clk_equ_sysclk = 0; // if we want to pixel_clk == lcd_clk, just make clkcnt = 0
|
||||
dev->lcd_clock.lcd_ck_out_edge = active_on_neg;
|
||||
}
|
||||
|
||||
__attribute__((always_inline))
|
||||
static inline void lcd_ll_set_pixel_clock_prescale(lcd_cam_dev_t *dev, uint32_t prescale)
|
||||
{
|
||||
// Formula: pixel_clk = lcd_clk / (1 + clkcnt_n)
|
||||
|
@ -85,6 +80,7 @@ static inline void lcd_ll_enable_rgb_yuv_convert(lcd_cam_dev_t *dev, bool en)
|
|||
dev->lcd_rgb_yuv.lcd_conv_bypass = en;
|
||||
}
|
||||
|
||||
__attribute__((always_inline))
|
||||
static inline void lcd_ll_set_phase_cycles(lcd_cam_dev_t *dev, uint32_t cmd_cycles, uint32_t dummy_cycles, uint32_t data_cycles)
|
||||
{
|
||||
HAL_ASSERT(cmd_cycles <= 2);
|
||||
|
@ -118,6 +114,7 @@ static inline void lcd_ll_enable_output_always_on(lcd_cam_dev_t *dev, bool en)
|
|||
dev->lcd_user.lcd_always_out_en = en;
|
||||
}
|
||||
|
||||
__attribute__((always_inline))
|
||||
static inline void lcd_ll_start(lcd_cam_dev_t *dev)
|
||||
{
|
||||
dev->lcd_user.lcd_update = 1; // update parameters before start transaction
|
||||
|
@ -136,17 +133,20 @@ static inline void lcd_ll_reset(lcd_cam_dev_t *dev)
|
|||
dev->lcd_user.lcd_reset = 0;
|
||||
}
|
||||
|
||||
__attribute__((always_inline))
|
||||
static inline void lcd_ll_reverse_data_bit_order(lcd_cam_dev_t *dev, bool en)
|
||||
{
|
||||
// whether to change LCD_DATA_out[N:0] to LCD_DATA_out[0:N]
|
||||
dev->lcd_user.lcd_bit_order = en;
|
||||
}
|
||||
|
||||
__attribute__((always_inline))
|
||||
static inline void lcd_ll_reverse_data_byte_order(lcd_cam_dev_t *dev, bool en)
|
||||
{
|
||||
dev->lcd_user.lcd_byte_order = en;
|
||||
}
|
||||
|
||||
__attribute__((always_inline))
|
||||
static inline void lcd_ll_reverse_data_8bits_order(lcd_cam_dev_t *dev, bool en)
|
||||
{
|
||||
dev->lcd_user.lcd_8bits_order = en;
|
||||
|
@ -158,6 +158,7 @@ static inline void lcd_ll_fifo_reset(lcd_cam_dev_t *dev)
|
|||
dev->lcd_misc.lcd_afifo_reset = 0;
|
||||
}
|
||||
|
||||
__attribute__((always_inline))
|
||||
static inline void lcd_ll_set_dc_level(lcd_cam_dev_t *dev, bool idle_phase, bool cmd_phase, bool dummy_phase, bool data_phase)
|
||||
{
|
||||
dev->lcd_misc.lcd_cd_idle_edge = idle_phase;
|
||||
|
@ -171,6 +172,7 @@ static inline void lcd_ll_set_dc_delay_ticks(lcd_cam_dev_t *dev, uint32_t delay)
|
|||
dev->lcd_dly_mode.lcd_cd_mode = delay;
|
||||
}
|
||||
|
||||
__attribute__((always_inline))
|
||||
static inline void lcd_ll_set_command(lcd_cam_dev_t *dev, uint32_t data_width, uint32_t command)
|
||||
{
|
||||
// if command phase has two cycles, in the first cycle, command[15:0] is sent out via lcd_data_out[15:0]
|
||||
|
@ -250,11 +252,13 @@ static inline void lcd_ll_enable_interrupt(lcd_cam_dev_t *dev, uint32_t mask, bo
|
|||
}
|
||||
}
|
||||
|
||||
__attribute__((always_inline))
|
||||
static inline uint32_t lcd_ll_get_interrupt_status(lcd_cam_dev_t *dev)
|
||||
{
|
||||
return dev->lc_dma_int_st.val & 0x03;
|
||||
}
|
||||
|
||||
__attribute__((always_inline))
|
||||
static inline void lcd_ll_clear_interrupt_status(lcd_cam_dev_t *dev, uint32_t mask)
|
||||
{
|
||||
dev->lc_dma_int_clr.val = mask & 0x03;
|
||||
|
|
|
@ -1,22 +1,8 @@
|
|||
// Copyright 2021 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
/*******************************************************************************
|
||||
* NOTICE
|
||||
* The HAL is not public api, don't use in application code.
|
||||
* See readme.md in soc/README.md
|
||||
******************************************************************************/
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
|
|
|
@ -1,16 +1,8 @@
|
|||
// Copyright 2021 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
|
@ -21,15 +13,12 @@ extern "C" {
|
|||
/**
|
||||
* @brief LCD clock source
|
||||
* @note User should select the clock source based on the real requirement:
|
||||
* ╔═════════════════════╦══════════════════════════╦════════════════════════════╗
|
||||
* ║ LCD clock source ║ Features ║ Power Management ║
|
||||
* ╠═════════════════════╬══════════════════════════╬════════════════════════════╣
|
||||
* ║ LCD_CLK_SRC_PLL160M ║ High resolution, fixed ║ ESP_PM_APB_FREQ_MAX lock ║
|
||||
* ╠═════════════════════╬══════════════════════════╬════════════════════════════╣
|
||||
* ║ LCD_CLK_SRC_APLL ║ Configurable resolution ║ ESP_PM_NO_LIGHT_SLEEP lock ║
|
||||
* ╠═════════════════════╬══════════════════════════╬════════════════════════════╣
|
||||
* ║ LCD_CLK_SRC_XTAL ║ Medium resolution, fixed ║ No PM lock ║
|
||||
* ╚═════════════════════╩══════════════════════════╩════════════════════════════╝
|
||||
*
|
||||
* | LCD clock source | Features | Power Management |
|
||||
* |---------------------|--------------------------|----------------------------|
|
||||
* | LCD_CLK_SRC_PLL160M | High resolution, fixed | ESP_PM_APB_FREQ_MAX lock |
|
||||
* | LCD_CLK_SRC_APLL | Configurable resolution | ESP_PM_NO_LIGHT_SLEEP lock |
|
||||
* | LCD_CLK_SRC_XTAL | Medium resolution, fixed | No PM lock |
|
||||
*/
|
||||
typedef enum {
|
||||
LCD_CLK_SRC_PLL160M, /*!< Select PLL160M as the source clock */
|
||||
|
|
|
@ -1,16 +1,8 @@
|
|||
// Copyright 2021 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include "hal/lcd_hal.h"
|
||||
#include "hal/lcd_ll.h"
|
||||
|
|
|
@ -1,16 +1,8 @@
|
|||
// Copyright 2021 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include "soc/soc.h"
|
||||
#include "soc/lcd_periph.h"
|
||||
|
|
|
@ -1,16 +1,8 @@
|
|||
// Copyright 2021 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include "soc/lcd_periph.h"
|
||||
#include "soc/gpio_sig_map.h"
|
||||
|
|
|
@ -1,16 +1,7 @@
|
|||
/** Copyright 2021 Espressif Systems (Shanghai) PTE LTD
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
|
|
|
@ -1,16 +1,7 @@
|
|||
/** Copyright 2021 Espressif Systems (Shanghai) PTE LTD
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
|
|
|
@ -1,16 +1,8 @@
|
|||
// Copyright 2021 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include "soc/lcd_periph.h"
|
||||
#include "soc/gpio_sig_map.h"
|
||||
|
|
|
@ -1,16 +1,8 @@
|
|||
// Copyright 2021 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
|
|
|
@ -4,6 +4,6 @@ include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
|||
project(lcd_lvgl)
|
||||
|
||||
# As the upstream LVGL library has build warnings in esp-idf build system, this is only for temporarily workaround
|
||||
# Will remove this file when upstream LVGL fixes the warnings in the next release
|
||||
# Will remove this workaround when upstream LVGL fixes the warnings in the next release
|
||||
idf_component_get_property(lvgl_lib lvgl__lvgl COMPONENT_LIB)
|
||||
target_compile_options(${lvgl_lib} PRIVATE "-Wno-empty-body" "-Wno-strict-prototypes")
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
/* LCD LVGL UI example
|
||||
|
||||
This example code is in the Public Domain (or CC0 licensed, at your option.)
|
||||
|
||||
Unless required by applicable law or agreed to in writing, this
|
||||
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
||||
CONDITIONS OF ANY KIND, either express or implied.
|
||||
*/
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: CC0-1.0
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include "lvgl.h"
|
||||
|
@ -18,6 +15,11 @@
|
|||
LV_IMG_DECLARE(esp_logo)
|
||||
LV_IMG_DECLARE(esp_text)
|
||||
|
||||
typedef struct {
|
||||
lv_obj_t *scr;
|
||||
int count_val;
|
||||
} my_timer_context_t;
|
||||
|
||||
static lv_obj_t *arc[3];
|
||||
static lv_obj_t *img_logo;
|
||||
static lv_obj_t *img_text;
|
||||
|
@ -29,8 +31,9 @@ static lv_color_t arc_color[] = {
|
|||
|
||||
static void anim_timer_cb(lv_timer_t *timer)
|
||||
{
|
||||
static int32_t count = -90;
|
||||
lv_obj_t *scr = (lv_obj_t *) timer->user_data;
|
||||
my_timer_context_t *timer_ctx = (my_timer_context_t *) timer->user_data;
|
||||
int count = timer_ctx->count_val;
|
||||
lv_obj_t *scr = timer_ctx->scr;
|
||||
|
||||
// Play arc animation
|
||||
if (count < 90) {
|
||||
|
@ -58,14 +61,16 @@ static void anim_timer_cb(lv_timer_t *timer)
|
|||
// Move images when arc animation finished
|
||||
if ((count >= 100) && (count <= 180)) {
|
||||
lv_coord_t offset = (sinf((count - 140) * 2.25f / 90.0f) + 1) * 20.0f;
|
||||
lv_obj_align((lv_obj_t *) timer->user_data, LV_ALIGN_CENTER, 0, -offset);
|
||||
lv_obj_align(img_logo, LV_ALIGN_CENTER, 0, -offset);
|
||||
lv_obj_align(img_text, LV_ALIGN_CENTER, 0, 2 * offset);
|
||||
lv_obj_set_style_img_opa(img_text, offset / 40.0f * 255, 0);
|
||||
}
|
||||
|
||||
// Delete timer when all animation finished
|
||||
if (++count >= 180) {
|
||||
if ((count += 5) == 220) {
|
||||
lv_timer_del(timer);
|
||||
} else {
|
||||
timer_ctx->count_val = count;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -95,5 +100,9 @@ void example_lvgl_demo_ui(lv_obj_t *scr)
|
|||
}
|
||||
|
||||
// Create timer for animation
|
||||
lv_timer_create(anim_timer_cb, 20, (void *) scr);
|
||||
static my_timer_context_t my_tim_ctx = {
|
||||
.count_val = -90,
|
||||
};
|
||||
my_tim_ctx.scr = scr;
|
||||
lv_timer_create(anim_timer_cb, 20, &my_tim_ctx);
|
||||
}
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
/* LCD LVGL porting example
|
||||
|
||||
This example code is in the Public Domain (or CC0 licensed, at your option.)
|
||||
|
||||
Unless required by applicable law or agreed to in writing, this
|
||||
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
||||
CONDITIONS OF ANY KIND, either express or implied.
|
||||
*/
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: CC0-1.0
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "freertos/FreeRTOS.h"
|
||||
|
@ -52,9 +49,9 @@ static const char *TAG = "example";
|
|||
|
||||
extern void example_lvgl_demo_ui(lv_obj_t *scr);
|
||||
|
||||
static bool example_notify_lvgl_flush_ready(esp_lcd_panel_io_handle_t panel_io, void *user_data, void *event_data)
|
||||
static bool example_notify_lvgl_flush_ready(esp_lcd_panel_io_handle_t panel_io, esp_lcd_panel_io_event_data_t *edata, void *user_ctx)
|
||||
{
|
||||
lv_disp_drv_t *disp_driver = (lv_disp_drv_t *)user_data;
|
||||
lv_disp_drv_t *disp_driver = (lv_disp_drv_t *)user_ctx;
|
||||
lv_disp_flush_ready(disp_driver);
|
||||
return false;
|
||||
}
|
||||
|
@ -120,7 +117,7 @@ void app_main(void)
|
|||
.dc_data_level = 1,
|
||||
},
|
||||
.on_color_trans_done = example_notify_lvgl_flush_ready,
|
||||
.user_data = &disp_drv,
|
||||
.user_ctx = &disp_drv,
|
||||
.lcd_cmd_bits = EXAMPLE_LCD_CMD_BITS,
|
||||
.lcd_param_bits = EXAMPLE_LCD_PARAM_BITS,
|
||||
};
|
||||
|
|
|
@ -1636,7 +1636,6 @@ components/hal/esp32s3/include/hal/gpspi_flash_ll.h
|
|||
components/hal/esp32s3/include/hal/i2c_ll.h
|
||||
components/hal/esp32s3/include/hal/i2s_ll.h
|
||||
components/hal/esp32s3/include/hal/interrupt_controller_ll.h
|
||||
components/hal/esp32s3/include/hal/lcd_ll.h
|
||||
components/hal/esp32s3/include/hal/ledc_ll.h
|
||||
components/hal/esp32s3/include/hal/mcpwm_ll.h
|
||||
components/hal/esp32s3/include/hal/memprot_ll.h
|
||||
|
@ -1693,8 +1692,6 @@ components/hal/include/hal/i2s_hal.h
|
|||
components/hal/include/hal/i2s_types.h
|
||||
components/hal/include/hal/interrupt_controller_hal.h
|
||||
components/hal/include/hal/interrupt_controller_types.h
|
||||
components/hal/include/hal/lcd_hal.h
|
||||
components/hal/include/hal/lcd_types.h
|
||||
components/hal/include/hal/ledc_hal.h
|
||||
components/hal/include/hal/ledc_types.h
|
||||
components/hal/include/hal/mcpwm_hal.h
|
||||
|
@ -1742,7 +1739,6 @@ components/hal/include/hal/usbh_ll.h
|
|||
components/hal/include/hal/wdt_hal.h
|
||||
components/hal/include/hal/wdt_types.h
|
||||
components/hal/interrupt_controller_hal.c
|
||||
components/hal/lcd_hal.c
|
||||
components/hal/ledc_hal.c
|
||||
components/hal/ledc_hal_iram.c
|
||||
components/hal/mcpwm_hal.c
|
||||
|
@ -2303,7 +2299,6 @@ components/soc/esp32/include/soc/uhci_reg.h
|
|||
components/soc/esp32/include/soc/uhci_struct.h
|
||||
components/soc/esp32/include/soc/wdev_reg.h
|
||||
components/soc/esp32/interrupts.c
|
||||
components/soc/esp32/lcd_periph.c
|
||||
components/soc/esp32/ledc_periph.c
|
||||
components/soc/esp32/mcpwm_periph.c
|
||||
components/soc/esp32/pcnt_periph.c
|
||||
|
@ -2587,7 +2582,6 @@ components/soc/esp32s2/include/soc/usb_wrap_struct.h
|
|||
components/soc/esp32s2/include/soc/usbh_struct.h
|
||||
components/soc/esp32s2/include/soc/wdev_reg.h
|
||||
components/soc/esp32s2/interrupts.c
|
||||
components/soc/esp32s2/lcd_periph.c
|
||||
components/soc/esp32s2/ledc_periph.c
|
||||
components/soc/esp32s2/pcnt_periph.c
|
||||
components/soc/esp32s2/rmt_periph.c
|
||||
|
@ -2651,8 +2645,6 @@ components/soc/esp32s3/include/soc/interrupt_core1_struct.h
|
|||
components/soc/esp32s3/include/soc/interrupt_reg.h
|
||||
components/soc/esp32s3/include/soc/interrupt_struct.h
|
||||
components/soc/esp32s3/include/soc/io_mux_reg.h
|
||||
components/soc/esp32s3/include/soc/lcd_cam_reg.h
|
||||
components/soc/esp32s3/include/soc/lcd_cam_struct.h
|
||||
components/soc/esp32s3/include/soc/ledc_caps.h
|
||||
components/soc/esp32s3/include/soc/ledc_reg.h
|
||||
components/soc/esp32s3/include/soc/ledc_struct.h
|
||||
|
@ -2731,7 +2723,6 @@ components/soc/esp32s3/include/soc/wdev_reg.h
|
|||
components/soc/esp32s3/include/soc/world_controller_reg.h
|
||||
components/soc/esp32s3/include/soc/world_controller_struct.h
|
||||
components/soc/esp32s3/interrupts.c
|
||||
components/soc/esp32s3/lcd_periph.c
|
||||
components/soc/esp32s3/ledc_periph.c
|
||||
components/soc/esp32s3/mcpwm_periph.c
|
||||
components/soc/esp32s3/pcnt_periph.c
|
||||
|
@ -2757,7 +2748,6 @@ components/soc/include/soc/hwcrypto_periph.h
|
|||
components/soc/include/soc/i2c_periph.h
|
||||
components/soc/include/soc/i2s_periph.h
|
||||
components/soc/include/soc/interrupts.h
|
||||
components/soc/include/soc/lcd_periph.h
|
||||
components/soc/include/soc/ledc_periph.h
|
||||
components/soc/include/soc/lldesc.h
|
||||
components/soc/include/soc/mcpwm_periph.h
|
||||
|
|
Ładowanie…
Reference in New Issue