standardizing project framework

This commit is contained in:
kirltrz committed 2026-02-24 13:58:42 +08:00
1 parent 1d31d2b244
commit eff9edb989
11 files changed
+17 -306

No files matched your search

@@ -0,0 +1 @@
836bdeeaf1284004e4673d302f95e515c54cc407595af1aee95626f53ecfba25
@@ -0,0 +1 @@
{"version": "1.0", "algorithm": "sha256", "created_at": "2025-05-21T15:23:42.928981+00:00", "files": [{"path": "CMakeLists.txt", "size": 220, "hash": "91d2932d50423eeeb18b1e8e80a77024b34ee5d9c24f8613e115b07c44ec6375"}, {"path": "idf_component.yml", "size": 173, "hash": "dac48dac2114a65cd0a9396eeb63a44614bde7ef94d7b70c6f132229d2d94433"}, {"path": "esp_lcd_st7305.c", "size": 15189, "hash": "411dd3cd712d30b12c1e207376439f9921f317930c3abd2570e49a5eefdb60a5"}, {"path": "license.txt", "size": 11358, "hash": "cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30"}, {"path": "include/esp_lcd_st7305.h", "size": 5056, "hash": "bd4e2bba98d9c88e7287c7c2f5370b5a2b639bddfebf4d7759ed6d64897df95b"}]}
@@ -0,0 +1,6 @@
idf_component_register(SRCS "esp_lcd_st7305.c"
INCLUDE_DIRS "include"
REQUIRES "esp_lcd" "driver")
include(package_manager)
cu_pkg_define_version(${CMAKE_CURRENT_LIST_DIR})
@@ -0,0 +1,387 @@
#include "esp_lcd_st7305.h"
#include "soc/soc_caps.h"
#include "esp_check.h"
#include "esp_lcd_types.h"
#include <stdlib.h>
#include <sys/cdefs.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_lcd_panel_interface.h"
#include "esp_lcd_panel_io.h"
#include "esp_lcd_panel_vendor.h"
#include "esp_lcd_panel_ops.h"
#include "esp_lcd_panel_commands.h"
#include "driver/gpio.h"
#include "esp_log.h"
#include "esp_check.h"
// 定义面板操作函数
static esp_err_t panel_st7305_del(esp_lcd_panel_t *panel);
static esp_err_t panel_st7305_reset(esp_lcd_panel_t *panel);
static esp_err_t panel_st7305_init(esp_lcd_panel_t *panel);
static esp_err_t panel_st7305_draw_bitmap(esp_lcd_panel_t *panel, int x_start, int y_start, int x_end, int y_end, const void *color_data);
static esp_err_t panel_st7305_invert_color(esp_lcd_panel_t *panel, bool invert_color_data);
static esp_err_t panel_st7305_mirror(esp_lcd_panel_t *panel, bool mirror_x, bool mirror_y);
static esp_err_t panel_st7305_swap_xy(esp_lcd_panel_t *panel, bool swap_axes);
static esp_err_t panel_st7305_set_gap(esp_lcd_panel_t *panel, int x_gap, int y_gap);
static esp_err_t panel_st7305_disp_on_off(esp_lcd_panel_t *panel, bool off);
static inline void _swap_int(int *a, int *b) {
int temp = *a;
*a = *b;
*b = temp;
}
const char *TAG = "st7305";
typedef struct {
esp_lcd_panel_t base;
esp_lcd_panel_io_handle_t io;
int reset_gpio_num;
bool reset_level;
int x_gap;
int y_gap;
int width;
int height;
uint8_t rotation; // 当前旋转角度 (0, 1, 2, 3 对应 0°, 90°, 180°, 270°)
uint8_t fb_bits_per_pixel;
uint8_t madctl_val; // save current value of LCD_CMD_MADCTL register
uint8_t colmod_val; // save current value of LCD_CMD_COLMOD register
const st7305_lcd_init_cmd_t *init_cmds;
uint16_t init_cmds_size;
} st7305_panel_t;
static const st7305_lcd_init_cmd_t st7305_init_cmds[] = {
{0xD6, (uint8_t[]){0x17, 0x02}, 2, 0}, // NVM Load Control
{0xD1, (uint8_t[]){0x01}, 1, 0}, // Booster Enable
{0xC0, (uint8_t[]){0x12, 0x0a}, 2, 0}, // Gate Voltage Setting
{0xC1, (uint8_t[]){0x73, 0x3E, 0x3C, 0x3C}, 4, 0}, // VSHP Setting (4.8V)
{0xC2, (uint8_t[]){0x00, 0x21, 0x23, 0x23}, 4, 0}, // VSLP Setting (0.98V)
{0xC4, (uint8_t[]){0x32, 0x5C, 0x5A, 0x5A}, 4, 0}, // VSHN Setting (-3.6V)
{0xC5, (uint8_t[]){0x32, 0x35, 0x37, 0x37}, 4, 0}, // VSLN Setting (0.22V)
{0xD8, (uint8_t[]){0x80, 0xE9}, 2, 0}, // OSC Setting: Enable OSC, HPM Frame Rate Max = 51Hz
{0xB2, (uint8_t[]){0x12}, 1, 0}, // Frame Rate Control (HPM=51hz)
{0xB3, (uint8_t[]){0xE5, 0xF6, 0x17, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x71}, 10, 0}, // Update Period Gate EQ Control in HPM
{0xB4, (uint8_t[]){0x05, 0x46, 0x77, 0x77, 0x77, 0x77, 0x76, 0x45}, 8, 0}, // Update Period Gate EQ Control in LPM
{0x62, (uint8_t[]){0x32, 0x03, 0x1F}, 3, 0}, // Gate Timing Control
{0xB7, (uint8_t[]){0x13}, 1, 0}, // Source EQ Enable
{0xB0, (uint8_t[]){0x32}, 1, 0}, // Gate Line Setting: 200 line (50 * 4)
{0x11, NULL, 0, 120}, // Sleep out (delay 120ms)
{0xC9, (uint8_t[]){0x00}, 1, 0}, // Source Voltage Select
{0x36, (uint8_t[]){0x48}, 1, 0}, // Memory Data Access Control (MX=1; DO=1)
{0x3A, (uint8_t[]){0x11}, 1, 0}, // Data Format Select
{0xB9, (uint8_t[]){0x20}, 1, 0}, // Gamma Mode Setting
{0xB8, (uint8_t[]){0x29}, 1, 0}, // Panel Setting
{0x2A, (uint8_t[]){0x16, 0x26}, 2, 0}, // Column Address Setting (0x16,0x26)
{0x2B, (uint8_t[]){0x00, 0x63}, 2, 0}, // Row Address Setting (0x00,0x63)
{0x35, (uint8_t[]){0x00}, 1, 0}, // TE
{0xD0, (uint8_t[]){0xFF}, 1, 0}, // Auto power down ON
{0x38, NULL, 0, 0}, // HPM: High Power Mode ON
{0x29, NULL, 0, 0}, // Display ON
{0x20, NULL, 0, 0}, // Display Inversion Off
{0xBB, (uint8_t[]){0x4F}, 1, 0}, // Enable Clear RAM, clear RAM to 0
};
esp_err_t esp_lcd_new_panel_st7305(const esp_lcd_panel_io_handle_t io, const esp_lcd_panel_dev_config_t *panel_dev_config,
esp_lcd_panel_handle_t *ret_panel)
{
esp_err_t ret = ESP_OK;
st7305_panel_t *st7305 = NULL;
gpio_config_t io_conf = { 0 };
ESP_GOTO_ON_FALSE(io && panel_dev_config && ret_panel, ESP_ERR_INVALID_ARG, err, TAG, "invalid argument");
st7305 = (st7305_panel_t *)calloc(1, sizeof(st7305_panel_t));
ESP_GOTO_ON_FALSE(st7305, ESP_ERR_NO_MEM, err, TAG, "no mem for st7305 panel");
if (panel_dev_config->reset_gpio_num >= 0) {
io_conf.mode = GPIO_MODE_OUTPUT;
io_conf.pin_bit_mask = 1ULL << panel_dev_config->reset_gpio_num;
ESP_GOTO_ON_ERROR(gpio_config(&io_conf), err, TAG, "configure GPIO for RST line failed");
}
st7305->width = ST7305_WIDTH;
st7305->height = ST7305_HEIGHT;
st7305->madctl_val = 0; // 初始化MADCTL值
st7305->rotation = 0; // 初始化MADCTL值
st7305->io = io;
st7305->reset_gpio_num = panel_dev_config->reset_gpio_num;
st7305->reset_level = panel_dev_config->flags.reset_active_high;
if (panel_dev_config->vendor_config) {
st7305->init_cmds = ((st7305_vendor_config_t *)panel_dev_config->vendor_config)->init_cmds;
st7305->init_cmds_size = ((st7305_vendor_config_t *)panel_dev_config->vendor_config)->init_cmds_size;
}
st7305->base.del = panel_st7305_del;
st7305->base.reset = panel_st7305_reset;
st7305->base.init = panel_st7305_init;
st7305->base.draw_bitmap = panel_st7305_draw_bitmap;
st7305->base.invert_color = panel_st7305_invert_color;
st7305->base.set_gap = panel_st7305_set_gap;
st7305->base.mirror = panel_st7305_mirror;
st7305->base.swap_xy = panel_st7305_swap_xy;
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0)
st7305->base.disp_off = panel_st7305_disp_on_off;
#else
st7305->base.disp_on_off = panel_st7305_disp_on_off;
#endif
*ret_panel = &(st7305->base);
ESP_LOGD(TAG, "new st7305 panel @%p", st7305);
// ESP_LOGI(TAG, "LCD panel create success, version: %d.%d.%d", ESP_LCD_ILI9341_VER_MAJOR, ESP_LCD_ILI9341_VER_MINOR,
// ESP_LCD_ILI9341_VER_PATCH);
return ESP_OK;
err:
if (st7305) {
if (panel_dev_config->reset_gpio_num >= 0) {
gpio_reset_pin(panel_dev_config->reset_gpio_num);
}
free(st7305);
}
return ret;
}
// Panel删除函数
static esp_err_t panel_st7305_del(esp_lcd_panel_t *panel)
{
st7305_panel_t *st7305 = __containerof(panel, st7305_panel_t, base);
if (st7305->reset_gpio_num >= 0) {
gpio_reset_pin(st7305->reset_gpio_num);
}
free(st7305);
return ESP_OK;
}
// Panel复位函数
static esp_err_t panel_st7305_reset(esp_lcd_panel_t *panel)
{
st7305_panel_t *st7305 = __containerof(panel, st7305_panel_t, base);
// 执行硬件复位
if (st7305->reset_gpio_num >= 0) {
gpio_set_level(st7305->reset_gpio_num, st7305->reset_level);
vTaskDelay(pdMS_TO_TICKS(10));
gpio_set_level(st7305->reset_gpio_num, !st7305->reset_level);
vTaskDelay(pdMS_TO_TICKS(10));
}
return ESP_OK;
}
// Panel初始化函数
static esp_err_t panel_st7305_init(esp_lcd_panel_t *panel)
{
st7305_panel_t *st7305 = __containerof(panel, st7305_panel_t, base);
esp_lcd_panel_io_handle_t io = st7305->io;
// 发送初始化命令序列
for (size_t i = 0; i < sizeof(st7305_init_cmds) / sizeof(st7305_lcd_init_cmd_t); i++) {
if (st7305_init_cmds[i].data_bytes > 0) {
esp_lcd_panel_io_tx_param(io, st7305_init_cmds[i].cmd,
st7305_init_cmds[i].data,
st7305_init_cmds[i].data_bytes);
} else {
esp_lcd_panel_io_tx_param(io, st7305_init_cmds[i].cmd, NULL, 0);
}
if (st7305_init_cmds[i].delay_ms > 0) {
vTaskDelay(pdMS_TO_TICKS(st7305_init_cmds[i].delay_ms));
}
}
return ESP_OK;
}
static esp_err_t panel_st7305_draw_bitmap(esp_lcd_panel_t *panel, int x_start, int y_start, int x_end, int y_end, const void *color_data)
{
st7305_panel_t *st7305 = __containerof(panel, st7305_panel_t, base);
esp_lcd_panel_io_handle_t io = st7305->io;
// 创建主缓冲区和临时缓冲区(大小基于面板分辨率)
uint16_t pages = (st7305->height) / 8;
size_t lcd_buf_size = (size_t)st7305->width * pages +100;
uint8_t *lcd_buffer = heap_caps_malloc(lcd_buf_size, MALLOC_CAP_DMA);
uint8_t *temp_buffer = heap_caps_malloc(lcd_buf_size, MALLOC_CAP_DMA);
if (!lcd_buffer || !temp_buffer) {
if (lcd_buffer) free(lcd_buffer);
if (temp_buffer) free(temp_buffer);
return ESP_ERR_NO_MEM;
}
// 直接复制输入数据到主缓冲区
// memcpy(lcd_buffer, color_data, 384 * 21);
// // memset(lcd_buffer, 0, 384 * 21);
// // 数据格式转换
// uint16_t k = 0;
// for (uint16_t i = 0; i < ST7305_WIDTH; i += 2) {
// for (uint16_t j = 0; j < 21; j += 3) {
// for (uint8_t y = 0; y < 3; y++) {
// if ((j + y) < 21) {
// uint8_t b1 = lcd_buffer[(j + y) * ST7305_WIDTH + i];
// uint8_t b2 = lcd_buffer[(j + y) * ST7305_WIDTH + i + 1];
// // 第一组4位
// uint8_t mix = ((b1 & 0x01) << 7) | ((b2 & 0x01) << 6) |
// ((b1 & 0x02) << 4) | ((b2 & 0x02) << 3) |
// ((b1 & 0x04) << 1) | ((b2 & 0x04)) |
// ((b1 & 0x08) >> 2) | ((b2 & 0x08) >> 3);
// temp_buffer[k++] = mix;
// // 第二组4位
// b1 >>= 4;
// b2 >>= 4;
// mix = ((b1 & 0x01) << 7) | ((b2 & 0x01) << 6) |
// ((b1 & 0x02) << 4) | ((b2 & 0x02) << 3) |
// ((b1 & 0x04) << 1) | ((b2 & 0x04)) |
// ((b1 & 0x08) >> 2) | ((b2 & 0x08) >> 3);
// temp_buffer[k++] = mix;
// }
// }
// }
// }
memset(lcd_buffer, 0, lcd_buf_size);
// 判断是否需要交换XY
bool is_xy_swapped = (st7305->madctl_val & ST7305_MADCTL_MV);
// 复制并转换数据到lcd_buffer
const uint8_t *src = (const uint8_t *)color_data;
if (!is_xy_swapped) {
// 正常模式
memcpy(lcd_buffer, src, lcd_buf_size);
} else {
// XY交换模式 - 需要重新排列数据
for (int y = 0; y < st7305->height; y++) {
for (int x = 0; x < st7305->width; x++) {
// 计算源数据中的位置
uint16_t src_byte_idx = (y >> 3) * st7305->width + x;
uint8_t src_bit_pos = y & 0x07;
bool pixel = src[src_byte_idx] & (1 << src_bit_pos);
// 计算目标位置(交换x和y)
uint16_t dst_byte_idx = (x >> 3) * st7305->height + y;
uint8_t dst_bit_pos = x & 0x07;
if (pixel) {
lcd_buffer[dst_byte_idx] |= (1 << dst_bit_pos);
}
}
}
}
/*
// 数据格式转换
uint16_t k = 0;
uint16_t width = is_xy_swapped ? st7305->height : st7305->width;
uint16_t stride = is_xy_swapped ? st7305->height : st7305->width;
uint16_t pages_loop = is_xy_swapped ? (st7305->width) / 8 : pages;
for (uint16_t i = 0; i < width; i += 2) {
for (uint16_t j = 0; j < pages_loop; j += 3) {
for (uint8_t y = 0; y < 3; y++) {
if ((j + y) < pages_loop) {
uint8_t b1 = lcd_buffer[(j + y) * stride + i];
uint8_t b2 = lcd_buffer[(j + y) * stride + i + 1];
// 第一组4位
uint8_t mix = ((b1 & 0x01) << 7) | ((b2 & 0x01) << 6) |
((b1 & 0x02) << 4) | ((b2 & 0x02) << 3) |
((b1 & 0x04) << 1) | ((b2 & 0x04)) |
((b1 & 0x08) >> 2) | ((b2 & 0x08) >> 3);
temp_buffer[k++] = mix;
// 第二组4位
b1 >>= 4;
b2 >>= 4;
mix = ((b1 & 0x01) << 7) | ((b2 & 0x01) << 6) |
((b1 & 0x02) << 4) | ((b2 & 0x02) << 3) |
((b1 & 0x04) << 1) | ((b2 & 0x04)) |
((b1 & 0x08) >> 2) | ((b2 & 0x08) >> 3);
temp_buffer[k++] = mix;
}
}
}
}
*/
// 设置显示范围和发送数据
uint8_t caset[] = {0x16, 0x26};
uint8_t raset[] = {0x00, 0x63};
esp_lcd_panel_io_tx_param(io, ST7305_CMD_CASET, caset, sizeof(caset));
esp_lcd_panel_io_tx_param(io, ST7305_CMD_RASET, raset, sizeof(raset));
esp_lcd_panel_io_tx_color(io, ST7305_CMD_RAMWR, lcd_buffer, lcd_buf_size);
free(lcd_buffer);
free(temp_buffer);
return ESP_OK;
}
// 颜色反转函数
static esp_err_t panel_st7305_invert_color(esp_lcd_panel_t *panel, bool invert_color_data)
{
st7305_panel_t *st7305 = __containerof(panel, st7305_panel_t, base);
esp_lcd_panel_io_tx_param(st7305->io, invert_color_data ? 0x21 : 0x20, NULL, 0);
return ESP_OK;
}
// 镜像函数
// 旋转接口实现
static esp_err_t panel_st7305_mirror(esp_lcd_panel_t *panel, bool mirror_x, bool mirror_y)
{
st7305_panel_t *st7305 = __containerof(panel, st7305_panel_t, base);
esp_lcd_panel_io_handle_t io = st7305->io;
if (mirror_x) {
st7305->madctl_val |= ST7305_MADCTL_MY;
} else {
st7305->madctl_val &= ~ST7305_MADCTL_MY;
}
if (mirror_y) {
st7305->madctl_val |= ST7305_MADCTL_MX;
} else {
st7305->madctl_val &= ~ST7305_MADCTL_MX;
}
ESP_RETURN_ON_ERROR(esp_lcd_panel_io_tx_param(io, LCD_CMD_MADCTL, (uint8_t[]) {
st7305->madctl_val
}, 1), TAG, "send command failed");
return ESP_OK;
}
static esp_err_t panel_st7305_swap_xy(esp_lcd_panel_t *panel, bool swap_axes)
{
st7305_panel_t *st7305 = __containerof(panel, st7305_panel_t, base);
esp_lcd_panel_io_handle_t io = st7305->io;
if (swap_axes) {
st7305->madctl_val |= ST7305_MADCTL_MV;
} else {
st7305->madctl_val &= ~ST7305_MADCTL_MV;
}
ESP_RETURN_ON_ERROR(esp_lcd_panel_io_tx_param(io, LCD_CMD_MADCTL, (uint8_t[]) {
st7305->madctl_val
}, 1), TAG, "send command failed");
return ESP_OK;
}
// 设置偏移函数
static esp_err_t panel_st7305_set_gap(esp_lcd_panel_t *panel, int x_gap, int y_gap)
{
st7305_panel_t *st7305 = __containerof(panel, st7305_panel_t, base);
st7305->x_gap = x_gap;
st7305->y_gap = y_gap;
return ESP_OK;
}
// 添加显示开关函数
static esp_err_t panel_st7305_disp_on_off(esp_lcd_panel_t *panel, bool on)
{
st7305_panel_t *st7305 = __containerof(panel, st7305_panel_t, base);
esp_lcd_panel_io_tx_param(st7305->io, on ? ST7305_CMD_DISPON : ST7305_CMD_DISPOFF, NULL, 0);
return ESP_OK;
}
@@ -0,0 +1,8 @@
dependencies:
cmake_utilities:
version: 0.*
idf:
version: '>=4.4'
description: ESP LCD ST7305
url: https://github.com/Kevincoooool/esp_lcd_st7305
version: 0.0.2
@@ -0,0 +1,115 @@
#pragma once
#include <stdint.h>
#include "esp_lcd_types.h"
#include "esp_lcd_panel_vendor.h"
#include "hal/spi_ll.h"
#include "esp_lcd_panel_vendor.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief LCD panel initialization commands.
*
*/
typedef struct {
int cmd; /*<! The specific LCD command */
const void *data; /*<! Buffer that holds the command specific data */
size_t data_bytes; /*<! Size of `data` in memory, in bytes */
unsigned int delay_ms; /*<! Delay in milliseconds after this command */
} st7305_lcd_init_cmd_t;
/**
* @brief LCD panel vendor configuration.
*
* @note This structure needs to be passed to the `vendor_config` field in `esp_lcd_panel_dev_config_t`.
*
*/
typedef struct {
const st7305_lcd_init_cmd_t *init_cmds; /*!< Pointer to initialization commands array. Set to NULL if using default commands.
* The array should be declared as `static const` and positioned outside the function.
* Please refer to `vendor_specific_init_default` in source file.
*/
uint16_t init_cmds_size; /*<! Number of commands in above array */
} st7305_vendor_config_t;
// ST7305显示配置参数
#define ST7305_RESOLUTION_HOR 200 // 水平分辨率
#define ST7305_RESOLUTION_VER 200 // 垂直分辨率
#define ST7305_BITS_PER_PIXEL 1 // 每像素位数
#define ST7305_WIDTH ST7305_RESOLUTION_HOR // 显示屏宽度
#define ST7305_HEIGHT ST7305_RESOLUTION_VER // 显示屏高度
// ST7305控制命令
#define ST7305_CMD_NOP 0x00 // 空操作
#define ST7305_CMD_SWRESET 0x01 // 软件复位
#define ST7305_CMD_SLPOUT 0x11 // 退出睡眠模式
#define ST7305_CMD_NORON 0x13 // 正常显示模式
#define ST7305_CMD_INVOFF 0x20 // 显示反转关闭
#define ST7305_CMD_INVON 0x21 // 显示反转开启
#define ST7305_CMD_DISPOFF 0x28 // 显示关闭
#define ST7305_CMD_DISPON 0x29 // 显示开启
#define ST7305_CMD_CASET 0x2A // 列地址设置
#define ST7305_CMD_RASET 0x2B // 行地址设置
#define ST7305_CMD_RAMWR 0x2C // 内存写入
#define ST7305_CMD_MADCTL 0x36 // 内存数据访问控制
// MADCTL位定义
#define ST7305_MADCTL_MY 0x80 // 行地址顺序
#define ST7305_MADCTL_MX 0x40 // 列地址顺序
#define ST7305_MADCTL_MV 0x20 // 行列交换
#define ST7305_MADCTL_ML 0x10 // 垂直刷新顺序
#define ST7305_MADCTL_RGB 0x00 // RGB-BGR顺序
#define ST7305_ROTATION_180 (ST7305_MADCTL_MY | ST7305_MADCTL_MX)
/**
* @brief Create LCD panel for model ST7305
*
* @note Vendor specific initialization can be different between manufacturers, should consult the LCD supplier for initialization sequence code.
*
* @param[in] io LCD panel IO handle
* @param[in] panel_dev_config general panel device configuration
* @param[out] ret_panel Returned LCD panel handle
* @return
* - ESP_ERR_INVALID_ARG if parameter is invalid
* - ESP_ERR_NO_MEM if out of memory
* - ESP_OK on success
*/
esp_err_t esp_lcd_new_panel_st7305(const esp_lcd_panel_io_handle_t io, const esp_lcd_panel_dev_config_t *panel_dev_config, esp_lcd_panel_handle_t *ret_panel);
#define ST7305_PANEL_BUS_SPI_CONFIG(sclk, mosi, max_trans_sz) \
{ \
.sclk_io_num = sclk, \
.mosi_io_num = mosi, \
.miso_io_num = -1, \
.quadhd_io_num = -1, \
.quadwp_io_num = -1, \
.max_transfer_sz = max_trans_sz, \
}
/**
* @brief LCD panel IO configuration structure
*
* @param[in] cs SPI chip select pin number
* @param[in] dc SPI data/command pin number
* @param[in] cb Callback function when SPI transfer is done
* @param[in] cb_ctx Callback function context
*
*/
#define ST7305_PANEL_IO_SPI_CONFIG(cs, dc, callback, callback_ctx) \
{ \
.cs_gpio_num = cs, \
.dc_gpio_num = dc, \
.spi_mode = 0, \
.pclk_hz = 60 * 1000 * 1000, \
.trans_queue_depth = 10, \
.on_color_trans_done = callback, \
.user_ctx = callback_ctx, \
.lcd_cmd_bits = 8, \
.lcd_param_bits = 8, \
}
#ifdef __cplusplus
}
#endif
@@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
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.