配置 PWM ADC LCD

This commit is contained in:
2026-07-14 17:51:39 +08:00
parent 0a5c478a42
commit 2d0d000a38
67 changed files with 33357 additions and 911 deletions

View File

@@ -0,0 +1,109 @@
/*
* 模块名称LCD 绘图模块
* 模块功能:提供字符、字符串(中英文混合)、线条、矩形、圆形等图形绘制
* 适用平台STM32F103C8T6 + ST7735S + 底层 st7735s.c
* 作者:王建锋
* 创建日期2026-07-14
* 修改记录:
* 2026-07-14 王建锋 从 st7735s.c 拆分
*/
#ifndef __LCD_H
#define __LCD_H
#ifdef __cplusplus
extern "C" {
#endif
#include "st7735s.h"
#include <stdint.h>
/* 字体定义 */
#define FONT_WIDTH_8 8 /* 8x16字体宽度含间距 */
#define FONT_HEIGHT_16 16 /* 8x16字体高度 */
/* === 字符/字符串绘制 === */
/*
* 函数功能显示一个8x16 ASCII字符
* 入口参数x - 列坐标
* y - 行坐标
* ch - 字符 (ASCII 32-126)
* color - 字符颜色 (RGB565)
* bg_color - 背景颜色 (RGB565)
* 返回值:无
*/
void lcd_draw_char(uint16_t x, uint16_t y, char ch, uint16_t color, uint16_t bg_color);
/*
* 函数功能显示字符串ASCII
* 入口参数x - 列坐标
* y - 行坐标
* str - 字符串指针
* color - 字符颜色 (RGB565)
* bg_color - 背景颜色 (RGB565)
* 返回值:无
*/
void lcd_draw_string(uint16_t x, uint16_t y, const char *str, uint16_t color, uint16_t bg_color);
/*
* 函数功能显示一个16x16 CJK汉字
* 入口参数x - 列坐标
* y - 行坐标
* unicode - Unicode码点 (如 0x4E00="一")
* color - 字符颜色 (RGB565)
* bg_color - 背景颜色 (RGB565)
* 返回值:无
*/
void lcd_draw_chinese(uint16_t x, uint16_t y, uint16_t unicode, uint16_t color, uint16_t bg_color);
/*
* 函数功能显示UTF-8字符串自动中英文混合
* 入口参数x - 列坐标
* y - 行坐标
* str - UTF-8字符串指针
* color - 字符颜色 (RGB565)
* bg_color - 背景颜色 (RGB565)
* 返回值:无
*/
void lcd_draw_chinese_string(uint16_t x, uint16_t y, const char *str, uint16_t color, uint16_t bg_color);
/* === 图形绘制 === */
/*
* 函数功能画线Bresenham算法
* 入口参数x1 - 起始列
* y1 - 起始行
* x2 - 结束列
* y2 - 结束行
* color - 颜色 (RGB565)
* 返回值:无
*/
void lcd_draw_line(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t color);
/*
* 函数功能:画空心矩形
* 入口参数x - 左上角列
* y - 左上角行
* width - 宽度
* height - 高度
* color - 颜色 (RGB565)
* 返回值:无
*/
void lcd_draw_rect(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t color);
/*
* 函数功能画空心圆Bresenham算法
* 入口参数x0 - 圆心列
* y0 - 圆心行
* radius - 半径
* color - 颜色 (RGB565)
* 返回值:无
*/
void lcd_draw_circle(uint16_t x0, uint16_t y0, uint16_t radius, uint16_t color);
#ifdef __cplusplus
}
#endif
#endif /* __LCD_H */