新增gd32470z-lckfb配套LCD驱动 (#10311)
pkgs_test / change (push) Has been skipped
ToolsCI / Tools (push) Has been cancelled
AutoTestCI / components/cpp11 (push) Has been cancelled
AutoTestCI / kernel/atomic (push) Has been cancelled
AutoTestCI / kernel/atomic/riscv64 (push) Has been cancelled
AutoTestCI / kernel/atomic_c11 (push) Has been cancelled
AutoTestCI / kernel/atomic_c11/riscv64 (push) Has been cancelled
AutoTestCI / kernel/device (push) Has been cancelled
AutoTestCI / kernel/ipc (push) Has been cancelled
AutoTestCI / kernel/irq (push) Has been cancelled
AutoTestCI / kernel/mem (push) Has been cancelled
AutoTestCI / kernel/mem/riscv64 (push) Has been cancelled
AutoTestCI / kernel/thread (push) Has been cancelled
AutoTestCI / kernel/timer (push) Has been cancelled
AutoTestCI / rtsmart/aarch64 (push) Has been cancelled
AutoTestCI / rtsmart/arm (push) Has been cancelled
AutoTestCI / rtsmart/riscv64 (push) Has been cancelled
AutoTestCI / components/utest (push) Has been cancelled
RT-Thread BSP Static Build Check / 🔍 Summary of Git Diff Changes (push) Has been cancelled
RT-Thread BSP Static Build Check / ${{ matrix.legs.RTT_BSP }} (push) Has been cancelled
RT-Thread BSP Static Build Check / collect-artifacts (push) Has been cancelled
utest_auto_run / AARCH64-rtsmart :default.cfg (push) Has been cancelled
utest_auto_run / A9-rtsmart :default.cfg (push) Has been cancelled
utest_auto_run / RISCV-rtsmart :default.cfg (push) Has been cancelled
utest_auto_run / AARCH64 :default.cfg (push) Has been cancelled
utest_auto_run / A9 :default.cfg (push) Has been cancelled
utest_auto_run / A9-smp :default.cfg (push) Has been cancelled
utest_auto_run / RISCV :default.cfg (push) Has been cancelled
doc_doxygen / doxygen_doc generate (push) Has been cancelled
doc_doxygen / deploy (push) Has been cancelled

* 新增gd32470z-lckfb配套LCD驱动

* 1.使用RTT的编程规范修改注释 2.readme文件新增注意事项以及原作者信息

* Add maintainer info for gd32470z-lckfb-lcd
This commit is contained in:
godmial
2025-05-24 11:19:44 +08:00
committed by GitHub
parent 5153f38047
commit 524ae345c1
13 changed files with 2009 additions and 1 deletions
+3
View File
@@ -75,3 +75,6 @@ tag: workflow
path: .github
owners: supper thomas(supperthomas)<78900636@qq.com>, Bingru Zhang(Rbb666)<751061401@qq.com>, Yuqiang Wang(kurisaW)<2053731441@qq.com>
tag: gd32470z-lckfb-lcd
path: bsp/gd32/arm/gd32470z-lckfb/board/ports
owners: Wu Ying Xiang(godmial)<2633967641@qq.com>
+1 -1
View File
@@ -51,7 +51,7 @@ GD32470Z-LCKFB梁山派是立创开发板推出的一款GD32F470系列的开发
| GPIO | 支持 | PA0, PA1... ---> PIN: 0, 1...113 |
| UART | 支持 | UART0 - UART7 |
| **扩展模块** | **支持情况** | **备注** |
| 暂无 | 暂不支持 | 暂不支持 |
| LCD+触摸屏 | 支持 | 暂不支持中文显示(因 Keil5 编码限制),使用方法请查看bsp\gd32\arm\gd32470z-lckfb\board\ports\README.md |
## 使用说明
+3
View File
@@ -56,5 +56,8 @@ objs.extend(SConscript(os.path.join(libraries_path_prefix, gd32_library, 'SConsc
# include drivers
objs.extend(SConscript(os.path.join(libraries_path_prefix, 'gd32_drivers', 'SConscript')))
# include lcd and drivers
objs.extend(SConscript(os.path.join(RTT_ROOT, 'bsp', 'gd32', 'arm', 'gd32470z-lckfb', 'board', 'ports', 'SConscript')))
# make a building
DoBuilding(TARGET, objs)
+31
View File
@@ -433,6 +433,37 @@ endmenu
menu "Board extended module Drivers"
menuconfig BSP_USING_LCD
bool "Enable LCD"
select RT_USING_LCD
default n
if BSP_USING_LCD
config BSP_USING_TLI
bool "Enable TLI"
default y
config BSP_USING_SDRAM
bool "Enable SDRAM"
select RT_USING_SDRAM
default y
config BSP_USING_TOUCH
bool "Enable TOUCH"
select RT_USING_TOUCH
default n
config BSP_USING_GPU
bool "Enable GPU"
select RT_USING_GPU
default y
config BSP_USING_DRAW_PANEL_EXAMPLE
bool "Enable DRAW PANEL EXAMPLE"
select RT_USING_DRAW_PANEL_EXAMPLE
default n
endif
endmenu
endmenu
@@ -0,0 +1,44 @@
#### 1. 简介
用于 GD32F470 立创开发板配套 RGB LCD 屏幕的驱动,支持触摸。
> **原作者:LCKFB**
> 本驱动最初由 LCKFB 开发,由 godmial 移植到本BSP。
#### 2. 在 ENV 中的开启
ps:建议全部开启
```
Hardware Drivers Config --->
Board extended module Drivers --->
Enable LCD --->
- [*]Enable TLI
- [*]Enable SDRAM
- [*]Enable TOUCH
- [*]Enable GPU
- [*]Enable DRAW PANEL EXAMPLE
```
#### 3. 注意事项
1. 如果屏幕出现刷新抖动,触摸屏出现连点的情况,可以尝试在 `libraries\GD32F4xx_Firmware_Library\CMSIS\GD\GD32F4xx\Source\system_gd32f4xx.c` 将时钟值修改为
`#define __SYSTEM_CLOCK_240M_PLL_25M_HXTAL (uint32_t)(240000000)`
然后重新编译即可
2. 由于代码格式审查原因,本驱动未包含中文显示函数。但可直接移植官方源码中的中文显示函数进行使用。
3. 为避免 `scons` 命令编译不通过,代码使用了如下代码段以适配不同编译器:
```
#if defined(__CC_ARM) || defined(__ARMCC_VERSION)
// Keil MDK
uint16_t ltdc_lcd_framebuf0[800][480] __attribute__((at(LCD_FRAME_BUF_ADDR)));
#elif defined(__GNUC__)
// GCC (RT-Thread)
uint16_t ltdc_lcd_framebuf0[10][10]; // 此行为避免 scons 编译错误而添加
#endif
#### 4. 联系方式
- 维护:godmial
- 主页:<https://github.com/godmial>
@@ -0,0 +1,25 @@
Import('RTT_ROOT')
Import('rtconfig')
from building import *
cwd = GetCurrentDir()
# add the general drivers.
src = Split("""
""")
# add lcd drivers.
if GetDepend('BSP_USING_LCD'):
src += ['drv_lcd.c']
if GetDepend('BSP_USING_TOUCH'):
src += ['drv_touch.c']
if GetDepend('BSP_USING_DRAW_PANEL_EXAMPLE'):
src += ['draw_panel.c']
path = [cwd]
group = DefineGroup('Applications', src, depend = [''], CPPPATH = path)
Return('group')
@@ -0,0 +1,187 @@
/*
* Copyright (c) 2006-2025, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2025-05-23 godmial Refactor to conform to RT-Thread coding style.
*/
#include <board.h>
#include <rthw.h>
#include <rtthread.h>
#include "drv_lcd.h"
#include "drv_touch.h"
#define COLOR_MAX 14
/* Maximum magnification of pixels */
#define PIXEL_SIZE_MAX 20
typedef struct button_struct
{
uint16_t x;
uint16_t y;
uint16_t w;
uint16_t h;
uint16_t color;
uint16_t value;
} widget_object_t;
uint16_t color_buf[COLOR_MAX] = {GRAYBLUE, BLACK, BLUE, BRED, GRED, GBLUE, RED, MAGENTA, GREEN, YELLOW, CYAN, BROWN, BRRED, GRAY};
widget_object_t button_clear, button_color, button_pixel, button_eraser;
/**
* @brief Initialize a widget button with given properties.
*
* @param obj Pointer to the widget object.
* @param x X coordinate of the top-left corner.
* @param y Y coordinate of the top-left corner.
* @param w Width of the widget.
* @param h Height of the widget.
* @param color Color value of the widget.
* @param value Initial value of the widget.
*
* @return None.
*/
void widget_object_init(widget_object_t *obj, uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint16_t color, uint16_t value)
{
obj->x = x;
obj->y = y;
obj->h = h;
obj->w = w;
obj->color = color;
obj->value = value;
}
/**
* @brief Initialize and display the user interface.
*
* This function draws the control buttons for clear, color,
* pixel size, and eraser on the screen.
*
* @return None.
*/
void ui_init(void)
{
char temp_buf[20] = {0};
tli_show_button(button_clear.x, button_clear.y, button_clear.w, button_clear.h, 12, button_clear.color);
tli_show_string(button_clear.x + 20, button_clear.y + 20, WHITE, button_clear.color, 2, "clear", 0);
tli_show_button(button_color.x, button_color.y, button_color.w, button_color.h, 12, button_color.color);
tli_show_string(button_color.x + 20, button_color.y + 20, WHITE, button_color.color, 2, "color", 0);
tli_show_button(button_pixel.x, button_pixel.y, button_pixel.w, button_pixel.h, 12, button_pixel.color);
if (button_pixel.value == 0)
{
tli_show_string(button_pixel.x + 20, button_pixel.y + 20, WHITE, button_pixel.color, 2, "pixel", 0);
button_pixel.value = 1;
}
else
{
sprintf(temp_buf, "%d", button_pixel.value);
tli_show_string(button_pixel.x + (button_pixel.w / 2) - (strlen(temp_buf) / 2 * 16), button_pixel.y + 20, WHITE, button_pixel.color, 2, (uint8_t *)temp_buf, 0);
}
tli_show_button(button_eraser.x, button_eraser.y, button_eraser.w, button_eraser.h, 12, button_eraser.color);
tli_show_string(button_eraser.x + (button_eraser.w / 2) - (strlen("eraser") / 2 * 16), button_eraser.y + 20, WHITE, button_eraser.color, 2, "eraser", 0);
}
/**
* @brief Main routine to test the drawing panel with touch interaction.
*
* Initializes LCD and touch interface, sets up buttons and handles user input
* to draw or erase on the screen based on touch events.
*
* @return Always returns 0.
*/
int draw_panel_test(void)
{
int touch_state = 0;
char color_num = 0;
char pixel_size = 0;
lcd_disp_config();
FT5206_Init();
tli_draw_rectangle(0, 0, 800, 480, WHITE, 1);
widget_object_init(&button_clear, 800 - 130, 480 - 80, 120, 70, BLUE, 0);
widget_object_init(&button_color, 10, 480 - 80, 120, 70, BLUE, 0);
widget_object_init(&button_pixel, 400 - 60, 480 - 80, 120, 70, BLUE, pixel_size);
widget_object_init(&button_eraser, 800 - 130 - 130, 480 - 80, 120, 70, BLUE, 0);
ui_init();
while (1)
{
touch_state = FT5206_Scan(0);
if (touch_state == 1)
{
if (tp_dev.x[0] >= button_color.x && tp_dev.x[0] <= (button_color.x + button_color.w))
{
if (tp_dev.y[0] >= button_color.y && tp_dev.y[0] <= (button_color.y + button_color.h))
{
letgo_scan(0, button_color.x, button_color.y, (button_color.x + button_color.w), (button_color.y + button_color.h));
color_num = (color_num + 1) % COLOR_MAX;
widget_object_init(&button_color, button_color.x, button_color.y, button_color.w, button_color.h, color_buf[color_num], 0);
ui_init();
}
}
if (tp_dev.x[0] >= button_clear.x && tp_dev.x[0] <= (button_clear.x + button_clear.w))
{
if (tp_dev.y[0] >= button_clear.y && tp_dev.y[0] <= (button_clear.y + button_clear.h))
{
letgo_scan(0, button_clear.x, button_clear.y, (button_clear.x + button_clear.w), (button_clear.y + button_clear.h));
tli_draw_rectangle(0, 0, 800, 480, WHITE, 1);
ui_init();
}
}
if (tp_dev.x[0] >= button_pixel.x && tp_dev.x[0] <= (button_pixel.x + button_pixel.w))
{
if (tp_dev.y[0] >= button_pixel.y && tp_dev.y[0] <= (button_pixel.y + button_pixel.h))
{
letgo_scan(0, button_pixel.x, button_pixel.y, (button_pixel.x + button_pixel.w), (button_pixel.y + button_pixel.h));
pixel_size++;
if (pixel_size > PIXEL_SIZE_MAX) pixel_size = 1;
widget_object_init(&button_pixel, button_pixel.x, button_pixel.y, button_pixel.w, button_pixel.h, button_pixel.color, pixel_size);
ui_init();
}
}
if (tp_dev.x[0] >= button_eraser.x && tp_dev.x[0] <= (button_eraser.x + button_eraser.w))
{
if (tp_dev.y[0] >= button_eraser.y && tp_dev.y[0] <= (button_eraser.y + button_eraser.h))
{
letgo_scan(0, button_eraser.x, button_eraser.y, (button_eraser.x + button_eraser.w), (button_eraser.y + button_eraser.h));
button_eraser.value = !button_eraser.value;
if (button_eraser.value)
{
widget_object_init(&button_eraser, 800 - 130 - 130, 480 - 80, 120, 70, BLACK, button_eraser.value);
}
else
{
widget_object_init(&button_eraser, 800 - 130 - 130, 480 - 80, 120, 70, BLUE, button_eraser.value);
}
ui_init();
}
}
if (!button_eraser.value)
{
tli_point_enlarge(tp_dev.x[0], tp_dev.y[0], color_buf[color_num], button_pixel.value);
}
else
{
tli_point_enlarge(tp_dev.x[0], tp_dev.y[0], WHITE, button_pixel.value);
}
}
}
}
INIT_COMPONENT_EXPORT(draw_panel_test);
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,98 @@
/*
* Copyright (c) 2006-2025, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2025-05-23 godmial Refactor to conform to RT-Thread coding style.
*/
#ifndef __DRV_LCD_H__
#define __DRV_LCD_H__
#include <stdint.h>
#include <string.h>
#include <stdio.h>
#ifdef BSP_USING_SDRAM
#include <sdram_port.h>
#endif /* BSP_USING_SDRAM */
/*******************************************************************************
* Definitions
******************************************************************************/
/* LCD resolution and pixel format */
#define LCD_WIDTH 800
#define LCD_HEIGHT 480
#define LCD_FB_BYTE_PER_PIXEL 1
/* Timing parameters for horizontal synchronization */
#define HORIZONTAL_SYNCHRONOUS_PULSE 10
#define HORIZONTAL_BACK_PORCH 150
#define ACTIVE_WIDTH 800
#define HORIZONTAL_FRONT_PORCH 15
/* Timing parameters for vertical synchronization */
#define VERTICAL_SYNCHRONOUS_PULSE 10
#define VERTICAL_BACK_PORCH 140
#define ACTIVE_HEIGHT 480
#define VERTICAL_FRONT_PORCH 40
/* Framebuffer address in SDRAM */
#define LCD_FRAME_BUF_ADDR 0xC0000000 /* SDRAM address for LCD frame buffer */
/* Pen color definitions (RGB565) */
#define WHITE 0xFFFF /* White */
#define BLACK 0x0000 /* Black */
#define BLUE 0x001F /* Blue */
#define BRED 0xF81F /* Blue-Red */
#define GRED 0xFFE0 /* Green-Red */
#define GBLUE 0x07FF /* Green-Blue */
#define RED 0xF800 /* Red */
#define MAGENTA 0xF81F /* Magenta */
#define GREEN 0x07E0 /* Green */
#define CYAN 0x7FFF /* Cyan */
#define YELLOW 0xFFE0 /* Yellow */
#define BROWN 0xBC40 /* Brown */
#define BRRED 0xFC07 /* Brownish red */
#define GRAY 0x8430 /* Gray */
/* GUI color definitions */
#define DARKBLUE 0x01CF /* Dark blue */
#define LIGHTBLUE 0x7D7C /* Light blue */
#define GRAYBLUE 0x5458 /* Grayish blue */
#define LIGHTGREEN 0x841F /* Light green */
#define LGRAY 0xC618 /* Light gray (panel background) */
#define LGRAYBLUE 0xA651 /* Light gray-blue (layer color) */
#define LBBLUE 0x2B12 /* Light brown-blue (selected item reverse color) */
/* Frame buffer declaration based on compiler */
#if defined(__CC_ARM) || defined(__ARMCC_VERSION)
/* Keil MDK Compiler */
extern uint16_t ltdc_lcd_framebuf0[800][480] __attribute__((at(LCD_FRAME_BUF_ADDR)));
#elif defined(__GNUC__)
/* GCC Compiler (used by RT-Thread) */
extern uint16_t ltdc_lcd_framebuf0[10][10]; /* Dummy for GCC compilation */
#endif
/*******************************************************************************
* API
******************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Configure the LCD display controller.
*
* @note This function initializes display timing and output settings.
*/
void lcd_disp_config(void);
#ifdef __cplusplus
}
#endif
#endif /* __DRV_LCD_H__ */
@@ -0,0 +1,481 @@
/*
* Copyright (c) 2006-2025, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2025-05-23 godmial Refactor to conform to RT-Thread coding style.
*/
#include <board.h>
#include <rthw.h>
#include <rtthread.h>
#include "drv_touch.h"
#include "drv_lcd.h"
#define DRV_DEBUG
#define LOG_TAG "drv.touch"
#include <drv_log.h>
_m_tp_dev tp_dev;
const uint16_t FT5206_TPX_TBL[5] = {FT_TP1_REG, FT_TP2_REG, FT_TP3_REG, FT_TP4_REG, FT_TP5_REG};
uint8_t g_gt_tnum = 5; /**< Default number of supported touch points (5-point touch) */
/**
* @brief Delay for a specified number of microseconds.
*
* @note This function uses the SysTick timer to implement microsecond delay by polling.
*
* @param _nus Number of microseconds to delay.
*/
void delay_us(uint32_t _nus)
{
uint8_t fac_us = 0;
uint32_t ticks;
uint32_t t_old, t_now, t_cnt = 0;
uint32_t reload = SysTick->LOAD;
fac_us = SystemCoreClock / 1000000;
ticks = _nus * fac_us - fac_us * 7 / 20;
t_old = SysTick->VAL;
while (1)
{
t_now = SysTick->VAL;
if (t_now < t_old)
{
t_cnt += t_old - t_now;
}
else
{
t_cnt += t_old + (reload - t_now);
}
if (t_cnt >= ticks)
{
break;
}
t_old = t_now;
};
}
/**
* @brief Delay function wrapper for touch operations.
*
* @param us Number of microseconds to delay.
*/
void touch_delay_1us(uint16_t us)
{
delay_us(us);
}
/**
* @brief Delay to control I2C speed.
*
* @note Used between I2C signal toggles to ensure proper timing.
*/
void CT_Delay(void)
{
touch_delay_1us(2);
}
/**
* @brief Initialize the I2C interface for the capacitive touch chip.
*
* @note Configures GPIO ports for SCL and SDA lines as outputs with pull-up resistors.
*/
void CT_IIC_Init(void)
{
/* enable the led clock */
rcu_periph_clock_enable(SCL_RCU);
/* configure led GPIO port */
gpio_mode_set(SCL_PORT, GPIO_MODE_OUTPUT, GPIO_PUPD_PULLUP, SCL_PIN);
gpio_output_options_set(SCL_PORT, GPIO_OTYPE_PP, GPIO_OSPEED_50MHZ, SCL_PIN);
rcu_periph_clock_enable(SDA_RCU);
gpio_mode_set(SDA_PORT, GPIO_MODE_OUTPUT, GPIO_PUPD_PULLUP, SDA_PIN);
gpio_output_options_set(SDA_PORT, GPIO_OTYPE_PP, GPIO_OSPEED_50MHZ, SDA_PIN);
}
/**
* @brief Generate I2C start condition.
*
* @note Starts communication by pulling SDA low while SCL is high.
*/
void CT_IIC_Start(void)
{
CT_SDA_OUT();
SDA_ON;
SCL_ON;
touch_delay_1us(30);
SDA_OFF;
CT_Delay();
SCL_OFF;
}
/**
* @brief Generate I2C stop condition.
*
* @note Ends communication by pulling SDA high while SCL is high.
*/
void CT_IIC_Stop(void)
{
CT_SDA_OUT();
SCL_ON;
touch_delay_1us(30);
SDA_OFF;
CT_Delay();
SDA_ON;
}
/**
* @brief Wait for I2C ACK signal.
*
* @return 0 if ACK received successfully, 1 if timeout occurred.
*
* @warning If ACK is not received within 250 iterations, a stop condition is generated.
*/
uint8_t CT_IIC_Wait_Ack(void)
{
uint8_t ucErrTime = 0;
CT_SDA_IN();
SDA_ON;
SCL_ON;
CT_Delay();
while (CT_READ_SDA)
{
ucErrTime++;
if (ucErrTime > 250)
{
CT_IIC_Stop();
return 1;
}
CT_Delay();
}
SCL_OFF;
return 0;
}
/**
* @brief Generate I2C ACK signal.
*
* @note This is used to acknowledge receipt of a byte in I2C communication.
*/
void CT_IIC_Ack(void)
{
SCL_OFF;
CT_SDA_OUT();
CT_Delay();
SDA_OFF;
CT_Delay();
SCL_ON;
CT_Delay();
SCL_OFF;
}
/**
* @brief Generate I2C NACK signal.
*
* @note This is used to indicate the end of reading in I2C communication.
*/
void CT_IIC_NAck(void)
{
SCL_OFF;
CT_SDA_OUT();
CT_Delay();
SDA_ON;
CT_Delay();
SCL_ON;
CT_Delay();
SCL_OFF;
}
/**
* @brief Send a byte over I2C.
*
* @param txd Byte to send.
*
* @note Sends 8 bits starting from the MSB over the SDA line.
*/
void CT_IIC_Send_Byte(uint8_t txd)
{
uint8_t t;
CT_SDA_OUT();
SCL_OFF;
CT_Delay();
for (t = 0; t < 8; t++)
{
if ((txd & 0x80) >> 7)
{
gpio_bit_set(SDA_PORT, SDA_PIN);
}
else
{
gpio_bit_reset(SDA_PORT, SDA_PIN);
}
txd <<= 1;
SCL_ON;
CT_Delay();
SCL_OFF;
CT_Delay();
}
}
/**
* @brief Read a byte over I2C.
*
* @param ack If 1, send ACK after receiving; if 0, send NACK.
*
* @return The received byte.
*/
uint8_t CT_IIC_Read_Byte(unsigned char ack)
{
volatile uint8_t i, receive = 0;
CT_SDA_IN();
touch_delay_1us(30);
for (i = 0; i < 8; i++)
{
SCL_OFF;
CT_Delay();
SCL_ON;
receive <<= 1;
if (CT_READ_SDA)
receive++;
}
if (!ack)
CT_IIC_NAck();
else
CT_IIC_Ack();
return receive;
}
/**
* @brief Write data to FT5206 register.
*
* @param reg Register address.
* @param buf Pointer to data buffer.
* @param len Length of data to write.
*
* @return 0 if successful, non-zero if any write fails.
*/
uint8_t FT5206_WR_Reg(uint16_t reg, uint8_t *buf, uint8_t len)
{
uint8_t i;
uint8_t ret = 0;
CT_IIC_Start();
CT_IIC_Send_Byte(FT_CMD_WR);
CT_IIC_Wait_Ack();
CT_IIC_Send_Byte(reg & 0XFF);
CT_IIC_Wait_Ack();
for (i = 0; i < len; i++)
{
CT_IIC_Send_Byte(buf[i]);
ret = CT_IIC_Wait_Ack();
if (ret)
break;
}
CT_IIC_Stop();
return ret;
}
/**
* @brief Read data from FT5206 register.
*
* @param reg Register address.
* @param buf Pointer to buffer to store read data.
* @param len Number of bytes to read.
*/
void FT5206_RD_Reg(uint16_t reg, uint8_t *buf, uint8_t len)
{
uint8_t i;
CT_IIC_Start();
CT_IIC_Send_Byte(FT_CMD_WR);
CT_IIC_Wait_Ack();
CT_IIC_Send_Byte(reg & 0XFF);
CT_IIC_Wait_Ack();
CT_IIC_Start();
CT_IIC_Send_Byte(FT_CMD_RD);
CT_IIC_Wait_Ack();
for (i = 0; i < len; i++)
{
buf[i] = CT_IIC_Read_Byte(i == (len - 1) ? 0 : 1);
}
CT_IIC_Stop();
}
/**
* @brief Initialize the FT5206 touch screen controller.
*
* @note Initializes I2C, sets operational modes and touch sensitivity.
*
* @return 0 if initialization is successful.
*/
uint8_t FT5206_Init(void)
{
uint8_t temp[5];
/* enable the led clock */
rcu_periph_clock_enable(INT_RCU);
/* configure led GPIO port */
gpio_mode_set(INT_PORT, GPIO_MODE_INPUT, GPIO_PUPD_NONE, INT_PIN);
CT_IIC_Init();
FT5206_WR_Reg(FT_DEVIDE_MODE, temp, 1);
FT5206_WR_Reg(FT_ID_G_MODE, temp, 1);
temp[0] = 22;
FT5206_WR_Reg(FT_ID_G_THGROUP, temp, 1);
temp[0] = 12;
FT5206_WR_Reg(FT_ID_G_PERIODACTIVE, temp, 1);
FT5206_RD_Reg(FT_ID_G_LIB_VERSION, &temp[0], 2);
printf("CTP ID:%x\r\n", ((uint16_t)temp[0] << 8) + temp[1]);
return 0;
}
/**
* @brief Scan the touch screen using polling.
*
* @param mode 0 for normal scan mode.
*
* @return 1 if a touch is detected, 0 otherwise.
*/
uint8_t FT5206_Scan(uint8_t mode)
{
uint8_t buf[4];
uint8_t i = 0;
uint8_t res = 0;
uint8_t temp;
uint16_t tempsta;
static uint8_t t = 0;
t++;
if ((t % 10) == 0 || t < 10)
{
FT5206_RD_Reg(FT_REG_NUM_FINGER, &mode, 1);
if ((mode & 0XF) && ((mode & 0XF) <= g_gt_tnum))
{
temp = 0XFF << (mode & 0XF);
tempsta = tp_dev.sta;
tp_dev.sta = (~temp) | TP_PRES_DOWN | TP_CATH_PRES;
tp_dev.x[g_gt_tnum - 1] = tp_dev.x[0];
tp_dev.y[g_gt_tnum - 1] = tp_dev.y[0];
for (i = 0; i < g_gt_tnum; i++)
{
if (tp_dev.sta & (1 << i))
{
FT5206_RD_Reg(FT5206_TPX_TBL[i], buf, 4);
if (tp_dev.touchtype & 0X01)
{
tp_dev.y[i] = ((uint16_t)(buf[0] & 0X0F) << 8) + buf[1];
tp_dev.x[i] = ((uint16_t)(buf[2] & 0X0F) << 8) + buf[3];
}
else
{
tp_dev.x[i] = (((uint16_t)(buf[0] & 0X0F) << 8) + buf[1]);
tp_dev.y[i] = ((uint16_t)(buf[2] & 0X0F) << 8) + buf[3];
}
}
}
res = 1;
if (tp_dev.x[0] > ACTIVE_WIDTH || tp_dev.y[0] > ACTIVE_HEIGHT)
{
if ((mode & 0XF) > 1)
{
tp_dev.x[0] = tp_dev.x[1];
tp_dev.y[0] = tp_dev.y[1];
t = 0;
}
else
{
tp_dev.x[0] = tp_dev.x[g_gt_tnum - 1];
tp_dev.y[0] = tp_dev.y[g_gt_tnum - 1];
mode = 0X80;
tp_dev.sta = tempsta;
}
}
else
t = 0;
}
}
if ((mode & 0X1F) == 0)
{
if (tp_dev.sta & TP_PRES_DOWN)
{
tp_dev.sta &= ~TP_PRES_DOWN;
}
else
{
tp_dev.x[0] = 0xffff;
tp_dev.y[0] = 0xffff;
tp_dev.sta &= 0XE0;
}
}
if (t > 240)
t = 10;
return res;
}
/**
* @brief Detect touch release by monitoring a specific touch point.
*
* @param contact Index of touch contact to check.
* @param sx Start X coordinate.
* @param sy Start Y coordinate.
* @param ex End X coordinate.
* @param ey End Y coordinate.
*
* @note Returns when the touch point leaves the specified rectangle.
*/
void letgo_scan(uint16_t contact, uint16_t sx, uint16_t sy, uint16_t ex, uint16_t ey)
{
while (FT5206_Scan(0))
{
if (tp_dev.x[contact] <= sx || tp_dev.x[contact] >= ex)
{
return;
}
if (tp_dev.y[contact] <= sy && tp_dev.y[contact] >= ey)
{
return;
}
}
}
/**
* @brief Example application to test the touch screen functionality.
*
* @return Always returns 0.
*
* @warning This function runs an infinite loop and is intended for manual test only.
*/
int touch_test(void)
{
int touch_state = 0;
FT5206_Init();
while (1)
{
touch_state = FT5206_Scan(0);
if (touch_state == 1)
{
rt_kprintf("touch\r\n");
}
rt_thread_mdelay(10);
}
}
MSH_CMD_EXPORT(touch_test, touch test)
@@ -0,0 +1,187 @@
/*
* Copyright (c) 2006-2025, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2025-05-23 godmial Refactor to conform to RT-Thread coding style.
*/
#ifndef __TOUCH_H__
#define __TOUCH_H__
#include "stdio.h"
#include "string.h"
#include "gd32f4xx.h"
#define SCL_RCU RCU_GPIOB
#define SCL_PORT GPIOB
#define SCL_PIN GPIO_PIN_6
#define SCL_ON gpio_bit_set(SCL_PORT, SCL_PIN)
#define SCL_OFF gpio_bit_reset(SCL_PORT, SCL_PIN)
#define SCL_TOGGLE gpio_bit_toggle(SCL_PORT, SCL_PIN)
#define SDA_RCU RCU_GPIOB
#define SDA_PORT GPIOB
#define SDA_PIN GPIO_PIN_7
#define SDA_ON gpio_bit_set(SDA_PORT, SDA_PIN)
#define SDA_OFF gpio_bit_reset(SDA_PORT, SDA_PIN)
#define SDA_TOGGLE gpio_bit_toggle(SDA_PORT, SDA_PIN)
/* IO direction settings */
#define CT_SDA_IN() gpio_mode_set(SCL_PORT, GPIO_MODE_INPUT, GPIO_PUPD_PULLUP, SDA_PIN); //{GPIOF->MODER&=~(3<<(2*11));GPIOF->MODER|=0<<2*11;} //PF11输入模式
#define CT_SDA_OUT() gpio_mode_set(SCL_PORT, GPIO_MODE_OUTPUT, GPIO_PUPD_PULLUP, SDA_PIN); //{GPIOF->MODER&=~(3<<(2*11));GPIOF->MODER|=1<<2*11;} //PF11输出模式
/* IO operations */
#define CT_IIC_SCL // PBout(0) //SCL
#define CT_IIC_SDA(val) ((val) == 1 ? SDA_ON : SDA_OFF) // PFout(11) //SDA
#define CT_READ_SDA gpio_input_bit_get(SDA_PORT, SDA_PIN) // PFin(11) //输入SDA
/* Reset and interrupt pin definitions */
#define RST_RCU RCU_GPIOD
#define RST_PORT GPIOD
#define RST_PIN GPIO_PIN_12
#define RST_ON gpio_bit_set(RST_PORT, RST_PIN);
#define RST_OFF gpio_bit_reset(RST_PORT, RST_PIN);
#define RST_TOGGLE gpio_bit_toggle(RST_PORT, RST_PIN);
#define INT_RCU RCU_GPIOD
#define INT_PORT GPIOD
#define INT_PIN GPIO_PIN_11
#define INT_ON gpio_bit_set(INT_PORT, INT_PIN);
#define INT_OFF gpio_bit_reset(INT_PORT, INT_PIN);
#define INT_TOGGLE gpio_bit_toggle(INT_PORT, INT_PIN);
/* I2C command definitions */
#define FT_CMD_WR 0X70 /**< FT5206 write command */
#define FT_CMD_RD 0X71 /**< FT5206 read command */
/* FT5206 register definitions */
#define FT_DEVIDE_MODE 0x00 /**< Mode control register */
#define FT_REG_NUM_FINGER 0x02 /**< Touch status register */
#define FT_TP1_REG 0x03 /**< Touch point 1 data */
#define FT_TP2_REG 0x09 /**< Touch point 2 data */
#define FT_TP3_REG 0x0F /**< Touch point 3 data */
#define FT_TP4_REG 0x15 /**< Touch point 4 data */
#define FT_TP5_REG 0x1B /**< Touch point 5 data */
#define FT_ID_G_LIB_VERSION 0xA1 /**< Firmware version */
#define FT_ID_G_MODE 0xA4 /**< Interrupt mode control */
#define FT_ID_G_THGROUP 0x80 /**< Touch sensitivity */
#define FT_ID_G_PERIODACTIVE 0x88 /**< Active period register */
#define TP_PRES_DOWN 0x80 /**< Touch pressed flag */
#define TP_CATH_PRES 0x40 /**< Key press detected flag */
#define CT_MAX_TOUCH 5 /**< Maximum number of supported touch points */
/**
* @brief Touch point device structure.
*/
typedef struct
{
uint16_t x[CT_MAX_TOUCH]; /**< X coordinates of touch points */
uint16_t y[CT_MAX_TOUCH]; /**< Y coordinates of touch points */
uint8_t sta; /**< Touch status flag */
float xfac; /**< X axis scaling factor */
float yfac; /**< Y axis scaling factor */
short xoff; /**< X axis offset */
short yoff; /**< Y axis offset */
uint8_t touchtype; /**< Touch type flag */
} _m_tp_dev;
extern _m_tp_dev tp_dev;
/**
* @brief Initialize I2C GPIO lines.
*/
void CT_IIC_Init(void);
/**
* @brief Generate I2C start condition.
*/
void CT_IIC_Start(void);
/**
* @brief Generate I2C stop condition.
*/
void CT_IIC_Stop(void);
/**
* @brief Send a byte over I2C.
*
* @param txd Byte to send.
*/
void CT_IIC_Send_Byte(uint8_t txd);
/**
* @brief Read a byte over I2C.
*
* @param ack 1 to send ACK after read, 0 for NACK.
*
* @return The received byte.
*/
uint8_t CT_IIC_Read_Byte(unsigned char ack);
/**
* @brief Wait for I2C ACK.
*
* @return 0 on success, non-zero on timeout.
*/
uint8_t CT_IIC_Wait_Ack(void);
/**
* @brief Generate I2C ACK.
*/
void CT_IIC_Ack(void);
/**
* @brief Generate I2C NACK.
*/
void CT_IIC_NAck(void);
/**
* @brief Write data to FT5206 register.
*
* @param reg Register address.
* @param buf Pointer to data.
* @param len Number of bytes to write.
*
* @return 0 if success, non-zero otherwise.
*/
uint8_t FT5206_WR_Reg(uint16_t reg, uint8_t *buf, uint8_t len);
/**
* @brief Read data from FT5206 register.
*
* @param reg Register address.
* @param buf Buffer to store data.
* @param len Number of bytes to read.
*/
void FT5206_RD_Reg(uint16_t reg, uint8_t *buf, uint8_t len);
/**
* @brief Initialize the FT5206 touch controller.
*
* @return 0 if successful.
*/
uint8_t FT5206_Init(void);
/**
* @brief Poll the FT5206 for touch input.
*
* @param mode Scan mode.
*
* @return 1 if touch detected, 0 otherwise.
*/
uint8_t FT5206_Scan(uint8_t mode);
/**
* @brief Wait until touch contact leaves specified area.
*
* @param contact Touch point index.
* @param sx Start X coordinate.
* @param sy Start Y coordinate.
* @param ex End X coordinate.
* @param ey End Y coordinate.
*/
void letgo_scan(uint16_t contact, uint16_t sx, uint16_t sy, uint16_t ex, uint16_t ey);
#endif
@@ -0,0 +1,112 @@
/*
* Copyright (c) 2006-2025, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2025-05-23 godmial Refactor to conform to RT-Thread coding style.
*/
#ifndef __FONT_H__
#define __FONT_H__
const unsigned char asc2_1608[95][16] = {
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*" ",0*/
{0x00, 0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00}, /*"!",1*/
{0x00, 0x48, 0x6C, 0x24, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*""",2*/
{0x00, 0x00, 0x00, 0x24, 0x24, 0x24, 0x7F, 0x12, 0x12, 0x12, 0x7F, 0x12, 0x12, 0x12, 0x00, 0x00}, /*"#",3*/
{0x00, 0x00, 0x08, 0x1C, 0x2A, 0x2A, 0x0A, 0x0C, 0x18, 0x28, 0x28, 0x2A, 0x2A, 0x1C, 0x08, 0x08}, /*"$",4*/
{0x00, 0x00, 0x00, 0x22, 0x25, 0x15, 0x15, 0x15, 0x2A, 0x58, 0x54, 0x54, 0x54, 0x22, 0x00, 0x00}, /*"%",5*/
{0x00, 0x00, 0x00, 0x0C, 0x12, 0x12, 0x12, 0x0A, 0x76, 0x25, 0x29, 0x11, 0x91, 0x6E, 0x00, 0x00}, /*"&",6*/
{0x00, 0x06, 0x06, 0x04, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*"'",7*/
{0x00, 0x40, 0x20, 0x10, 0x10, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x10, 0x10, 0x20, 0x40, 0x00}, /*"(",8*/
{0x00, 0x02, 0x04, 0x08, 0x08, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x08, 0x08, 0x04, 0x02, 0x00}, /*")",9*/
{0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x6B, 0x1C, 0x1C, 0x6B, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00}, /*"*",10*/
{0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0x7F, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, 0x00}, /*"+",11*/
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x04, 0x03}, /*",",12*/
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*"-",13*/
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x00, 0x00}, /*".",14*/
{0x00, 0x00, 0x80, 0x40, 0x40, 0x20, 0x20, 0x10, 0x10, 0x08, 0x08, 0x04, 0x04, 0x02, 0x02, 0x00}, /*"/",15*/
{0x00, 0x00, 0x00, 0x18, 0x24, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x24, 0x18, 0x00, 0x00}, /*"0",16*/
{0x00, 0x00, 0x00, 0x08, 0x0E, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x3E, 0x00, 0x00}, /*"1",17*/
{0x00, 0x00, 0x00, 0x3C, 0x42, 0x42, 0x42, 0x20, 0x20, 0x10, 0x08, 0x04, 0x42, 0x7E, 0x00, 0x00}, /*"2",18*/
{0x00, 0x00, 0x00, 0x3C, 0x42, 0x42, 0x20, 0x18, 0x20, 0x40, 0x40, 0x42, 0x22, 0x1C, 0x00, 0x00}, /*"3",19*/
{0x00, 0x00, 0x00, 0x20, 0x30, 0x28, 0x24, 0x24, 0x22, 0x22, 0x7E, 0x20, 0x20, 0x78, 0x00, 0x00}, /*"4",20*/
{0x00, 0x00, 0x00, 0x7E, 0x02, 0x02, 0x02, 0x1A, 0x26, 0x40, 0x40, 0x42, 0x22, 0x1C, 0x00, 0x00}, /*"5",21*/
{0x00, 0x00, 0x00, 0x38, 0x24, 0x02, 0x02, 0x1A, 0x26, 0x42, 0x42, 0x42, 0x24, 0x18, 0x00, 0x00}, /*"6",22*/
{0x00, 0x00, 0x00, 0x7E, 0x22, 0x22, 0x10, 0x10, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00}, /*"7",23*/
{0x00, 0x00, 0x00, 0x3C, 0x42, 0x42, 0x42, 0x24, 0x18, 0x24, 0x42, 0x42, 0x42, 0x3C, 0x00, 0x00}, /*"8",24*/
{0x00, 0x00, 0x00, 0x18, 0x24, 0x42, 0x42, 0x42, 0x64, 0x58, 0x40, 0x40, 0x24, 0x1C, 0x00, 0x00}, /*"9",25*/
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00}, /*":",26*/
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x04}, /*";",27*/
{0x00, 0x00, 0x00, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x00, 0x00}, /*"<",28*/
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x00, 0x00, 0x00, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00}, /*"=",29*/
{0x00, 0x00, 0x00, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x00, 0x00}, /*">",30*/
{0x00, 0x00, 0x00, 0x3C, 0x42, 0x42, 0x46, 0x40, 0x20, 0x10, 0x10, 0x00, 0x18, 0x18, 0x00, 0x00}, /*"?",31*/
{0x00, 0x00, 0x00, 0x1C, 0x22, 0x5A, 0x55, 0x55, 0x55, 0x55, 0x2D, 0x42, 0x22, 0x1C, 0x00, 0x00}, /*"@",32*/
{0x00, 0x00, 0x00, 0x08, 0x08, 0x18, 0x14, 0x14, 0x24, 0x3C, 0x22, 0x42, 0x42, 0xE7, 0x00, 0x00}, /*"A",33*/
{0x00, 0x00, 0x00, 0x1F, 0x22, 0x22, 0x22, 0x1E, 0x22, 0x42, 0x42, 0x42, 0x22, 0x1F, 0x00, 0x00}, /*"B",34*/
{0x00, 0x00, 0x00, 0x7C, 0x42, 0x42, 0x01, 0x01, 0x01, 0x01, 0x01, 0x42, 0x22, 0x1C, 0x00, 0x00}, /*"C",35*/
{0x00, 0x00, 0x00, 0x1F, 0x22, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x22, 0x1F, 0x00, 0x00}, /*"D",36*/
{0x00, 0x00, 0x00, 0x3F, 0x42, 0x12, 0x12, 0x1E, 0x12, 0x12, 0x02, 0x42, 0x42, 0x3F, 0x00, 0x00}, /*"E",37*/
{0x00, 0x00, 0x00, 0x3F, 0x42, 0x12, 0x12, 0x1E, 0x12, 0x12, 0x02, 0x02, 0x02, 0x07, 0x00, 0x00}, /*"F",38*/
{0x00, 0x00, 0x00, 0x3C, 0x22, 0x22, 0x01, 0x01, 0x01, 0x71, 0x21, 0x22, 0x22, 0x1C, 0x00, 0x00}, /*"G",39*/
{0x00, 0x00, 0x00, 0xE7, 0x42, 0x42, 0x42, 0x42, 0x7E, 0x42, 0x42, 0x42, 0x42, 0xE7, 0x00, 0x00}, /*"H",40*/
{0x00, 0x00, 0x00, 0x3E, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x3E, 0x00, 0x00}, /*"I",41*/
{0x00, 0x00, 0x00, 0x7C, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x11, 0x0F}, /*"J",42*/
{0x00, 0x00, 0x00, 0x77, 0x22, 0x12, 0x0A, 0x0E, 0x0A, 0x12, 0x12, 0x22, 0x22, 0x77, 0x00, 0x00}, /*"K",43*/
{0x00, 0x00, 0x00, 0x07, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x42, 0x7F, 0x00, 0x00}, /*"L",44*/
{0x00, 0x00, 0x00, 0x77, 0x36, 0x36, 0x36, 0x36, 0x2A, 0x2A, 0x2A, 0x2A, 0x2A, 0x6B, 0x00, 0x00}, /*"M",45*/
{0x00, 0x00, 0x00, 0xE3, 0x46, 0x46, 0x4A, 0x4A, 0x52, 0x52, 0x52, 0x62, 0x62, 0x47, 0x00, 0x00}, /*"N",46*/
{0x00, 0x00, 0x00, 0x1C, 0x22, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x22, 0x1C, 0x00, 0x00}, /*"O",47*/
{0x00, 0x00, 0x00, 0x3F, 0x42, 0x42, 0x42, 0x42, 0x3E, 0x02, 0x02, 0x02, 0x02, 0x07, 0x00, 0x00}, /*"P",48*/
{0x00, 0x00, 0x00, 0x1C, 0x22, 0x41, 0x41, 0x41, 0x41, 0x41, 0x4D, 0x53, 0x32, 0x1C, 0x60, 0x00}, /*"Q",49*/
{0x00, 0x00, 0x00, 0x3F, 0x42, 0x42, 0x42, 0x3E, 0x12, 0x12, 0x22, 0x22, 0x42, 0xC7, 0x00, 0x00}, /*"R",50*/
{0x00, 0x00, 0x00, 0x7C, 0x42, 0x42, 0x02, 0x04, 0x18, 0x20, 0x40, 0x42, 0x42, 0x3E, 0x00, 0x00}, /*"S",51*/
{0x00, 0x00, 0x00, 0x7F, 0x49, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x1C, 0x00, 0x00}, /*"T",52*/
{0x00, 0x00, 0x00, 0xE7, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3C, 0x00, 0x00}, /*"U",53*/
{0x00, 0x00, 0x00, 0xE7, 0x42, 0x42, 0x22, 0x24, 0x24, 0x14, 0x14, 0x18, 0x08, 0x08, 0x00, 0x00}, /*"V",54*/
{0x00, 0x00, 0x00, 0x6B, 0x49, 0x49, 0x49, 0x49, 0x55, 0x55, 0x36, 0x22, 0x22, 0x22, 0x00, 0x00}, /*"W",55*/
{0x00, 0x00, 0x00, 0xE7, 0x42, 0x24, 0x24, 0x18, 0x18, 0x18, 0x24, 0x24, 0x42, 0xE7, 0x00, 0x00}, /*"X",56*/
{0x00, 0x00, 0x00, 0x77, 0x22, 0x22, 0x14, 0x14, 0x08, 0x08, 0x08, 0x08, 0x08, 0x1C, 0x00, 0x00}, /*"Y",57*/
{0x00, 0x00, 0x00, 0x7E, 0x21, 0x20, 0x10, 0x10, 0x08, 0x04, 0x04, 0x42, 0x42, 0x3F, 0x00, 0x00}, /*"Z",58*/
{0x00, 0x78, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x78, 0x00}, /*"[",59*/
{0x00, 0x00, 0x02, 0x02, 0x04, 0x04, 0x08, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, 0x20, 0x40, 0x40}, /*"\",60*/
{0x00, 0x1E, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x1E, 0x00}, /*"]",61*/
{0x00, 0x38, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*"^",62*/
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF}, /*"_",63*/
{0x00, 0x06, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*"`",64*/
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x78, 0x44, 0x42, 0x42, 0xFC, 0x00, 0x00}, /*"a",65*/
{0x00, 0x00, 0x00, 0x03, 0x02, 0x02, 0x02, 0x1A, 0x26, 0x42, 0x42, 0x42, 0x26, 0x1A, 0x00, 0x00}, /*"b",66*/
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x02, 0x02, 0x02, 0x44, 0x38, 0x00, 0x00}, /*"c",67*/
{0x00, 0x00, 0x00, 0x60, 0x40, 0x40, 0x40, 0x78, 0x44, 0x42, 0x42, 0x42, 0x64, 0xD8, 0x00, 0x00}, /*"d",68*/
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x7E, 0x02, 0x02, 0x42, 0x3C, 0x00, 0x00}, /*"e",69*/
{0x00, 0x00, 0x00, 0xF0, 0x88, 0x08, 0x08, 0x7E, 0x08, 0x08, 0x08, 0x08, 0x08, 0x3E, 0x00, 0x00}, /*"f",70*/
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x22, 0x22, 0x1C, 0x02, 0x3C, 0x42, 0x42, 0x3C}, /*"g",71*/
{0x00, 0x00, 0x00, 0x03, 0x02, 0x02, 0x02, 0x3A, 0x46, 0x42, 0x42, 0x42, 0x42, 0xE7, 0x00, 0x00}, /*"h",72*/
{0x00, 0x00, 0x00, 0x0C, 0x0C, 0x00, 0x00, 0x0E, 0x08, 0x08, 0x08, 0x08, 0x08, 0x3E, 0x00, 0x00}, /*"i",73*/
{0x00, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, 0x38, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x1E}, /*"j",74*/
{0x00, 0x00, 0x00, 0x03, 0x02, 0x02, 0x02, 0x72, 0x12, 0x0A, 0x16, 0x12, 0x22, 0x77, 0x00, 0x00}, /*"k",75*/
{0x00, 0x00, 0x00, 0x0E, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x3E, 0x00, 0x00}, /*"l",76*/
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x92, 0x92, 0x92, 0x92, 0x92, 0xB7, 0x00, 0x00}, /*"m",77*/
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3B, 0x46, 0x42, 0x42, 0x42, 0x42, 0xE7, 0x00, 0x00}, /*"n",78*/
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3C, 0x00, 0x00}, /*"o",79*/
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1B, 0x26, 0x42, 0x42, 0x42, 0x22, 0x1E, 0x02, 0x07}, /*"p",80*/
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x44, 0x42, 0x42, 0x42, 0x44, 0x78, 0x40, 0xE0}, /*"q",81*/
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x4C, 0x04, 0x04, 0x04, 0x04, 0x1F, 0x00, 0x00}, /*"r",82*/
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x42, 0x02, 0x3C, 0x40, 0x42, 0x3E, 0x00, 0x00}, /*"s",83*/
{0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x3E, 0x08, 0x08, 0x08, 0x08, 0x08, 0x30, 0x00, 0x00}, /*"t",84*/
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x63, 0x42, 0x42, 0x42, 0x42, 0x62, 0xDC, 0x00, 0x00}, /*"u",85*/
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE7, 0x42, 0x24, 0x24, 0x14, 0x08, 0x08, 0x00, 0x00}, /*"v",86*/
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xEB, 0x49, 0x49, 0x55, 0x55, 0x22, 0x22, 0x00, 0x00}, /*"w",87*/
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0x24, 0x18, 0x18, 0x18, 0x24, 0x6E, 0x00, 0x00}, /*"x",88*/
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE7, 0x42, 0x24, 0x24, 0x14, 0x18, 0x08, 0x08, 0x07}, /*"y",89*/
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7E, 0x22, 0x10, 0x08, 0x08, 0x44, 0x7E, 0x00, 0x00}, /*"z",90*/
{0x00, 0xC0, 0x20, 0x20, 0x20, 0x20, 0x20, 0x10, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xC0, 0x00}, /*"{",91*/
{0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10}, /*"|",92*/
{0x00, 0x06, 0x08, 0x08, 0x08, 0x08, 0x08, 0x10, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x06, 0x00}, /*"}",93*/
{0x0C, 0x32, 0xC2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*"~",94*/
};
#endif
@@ -53,6 +53,12 @@ if GetDepend(['BSP_USING_SDRAM']):
src += ['GD32F4xx_standard_peripheral/Source/gd32f4xx_fmc.c']
src += ['GD32F4xx_standard_peripheral/Source/gd32f4xx_exmc.c']
if GetDepend(['BSP_USING_TLI']):
src += ['GD32F4xx_standard_peripheral/Source/gd32f4xx_tli.c']
if GetDepend(['BSP_USING_GPU']):
src += ['GD32F4xx_standard_peripheral/Source/gd32f4xx_ipa.c']
path = [
cwd + '/CMSIS/GD/GD32F4xx/Include',
cwd + '/CMSIS',