```
refactor(gbk_text): 重构GBK文本常量定义并优化命名 移除过时的文本定义,使用更简洁通用的名称替换原有特定功能的文本 常量,并更新相应的长度定义和别名映射。 BREAKING CHANGE: 原有的特定功能文本常量已被移除,需使用新的通 用名称进行访问。 ```
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file screen.h
|
||||
* @brief 串口屏驱动接口(用于 JC 系列串口屏,使用 USART1)
|
||||
******************************************************************************
|
||||
*/
|
||||
******************************************************************************
|
||||
* @file screen.h
|
||||
* @brief 串口屏驱动接口(用于 JC 系列串口屏,使用 USART1)
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
|
||||
#ifndef __SCREEN_H__
|
||||
@@ -15,10 +15,37 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
/* 颜色使用统一的标志 */
|
||||
#define TEXT_COLOR 15 /* 白色 */
|
||||
#define BG_COLOR 0 /* 黑色 */
|
||||
#define BG_COLOR 0 /* 黑色 */
|
||||
|
||||
|
||||
#define SCREEN_LEFT 1
|
||||
#define SCREEN_RIGHT 126
|
||||
|
||||
#define TITLE_LINE_Y 28
|
||||
#define ZONE1_LINE_Y 60
|
||||
#define ZONE2_LINE_Y 93
|
||||
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint16_t y_clear_start; // 清除区域起始
|
||||
uint16_t y_clear_end; // 清除区域结束
|
||||
uint16_t y_text; // 文本基线
|
||||
} ScreenZone_t;
|
||||
|
||||
|
||||
static const ScreenZone_t g_zones[3] =
|
||||
{
|
||||
{29, 60, 37}, // Zone1
|
||||
{61, 93, 69}, // Zone2
|
||||
{94, 126, 102} // Zone3
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -44,47 +71,71 @@ void Screen_DrawText16(uint16_t x, uint16_t y, const char *text, uint8_t color);
|
||||
/* 额外封装命令 */
|
||||
void Screen_SetRotation(uint8_t dir);
|
||||
void Screen_SetBaud(uint32_t baud);
|
||||
void Screen_DisplayImageAtAddr(uint32_t addr, uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint8_t mode);
|
||||
void Screen_DisplayImageByIndex(uint32_t index, uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint8_t mode);
|
||||
void Screen_DisplayImageAtAddr(uint32_t addr, uint16_t x, uint16_t y,
|
||||
uint16_t w, uint16_t h, uint8_t mode);
|
||||
void Screen_DisplayImageByIndex(uint32_t index, uint16_t x, uint16_t y,
|
||||
uint16_t w, uint16_t h, uint8_t mode);
|
||||
void Screen_Pixel(uint16_t x, uint16_t y, uint8_t color);
|
||||
void Screen_Line(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint8_t color);
|
||||
void Screen_Box(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint8_t color);
|
||||
void Screen_BoxFill(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint8_t color);
|
||||
void Screen_Line(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2,
|
||||
uint8_t color);
|
||||
void Screen_Box(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2,
|
||||
uint8_t color);
|
||||
void Screen_BoxFill(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2,
|
||||
uint8_t color);
|
||||
void Screen_Circle(uint16_t x, uint16_t y, uint16_t r, uint8_t color);
|
||||
void Screen_CircleFill(uint16_t x, uint16_t y, uint16_t r, uint8_t color);
|
||||
void Screen_SetBGColor(uint8_t color);
|
||||
void Screen_DrawText16V_GBK(uint16_t x, uint16_t y, const uint8_t *gbk_buf, uint16_t gbk_len, uint8_t color);
|
||||
void Screen_DrawText16V_GBK(uint16_t x, uint16_t y, const uint8_t *gbk_buf,
|
||||
uint16_t gbk_len, uint8_t color);
|
||||
/* 带/不带背景的文本 */
|
||||
void Screen_DrawText16V(uint16_t x, uint16_t y, const char *text, uint8_t color);
|
||||
void Screen_DrawText16V(uint16_t x, uint16_t y, const char *text,
|
||||
uint8_t color);
|
||||
void Screen_DrawText24(uint16_t x, uint16_t y, const char *text, uint8_t color);
|
||||
void Screen_DrawText24V(uint16_t x, uint16_t y, const char *text, uint8_t color);
|
||||
void Screen_DrawText24V(uint16_t x, uint16_t y, const char *text,
|
||||
uint8_t color);
|
||||
void Screen_DrawText32(uint16_t x, uint16_t y, const char *text, uint8_t color);
|
||||
void Screen_DrawText32V(uint16_t x, uint16_t y, const char *text, uint8_t color);
|
||||
void Screen_DrawText48(uint16_t x, uint16_t y, const char *text, uint8_t color, uint8_t transparent);
|
||||
void Screen_DrawText32V(uint16_t x, uint16_t y, const char *text,
|
||||
uint8_t color);
|
||||
void Screen_DrawText48(uint16_t x, uint16_t y, const char *text, uint8_t color,
|
||||
uint8_t transparent);
|
||||
|
||||
/* Button */
|
||||
void Screen_Button(uint16_t x, uint16_t y, uint16_t w, uint16_t h, const char *label, uint8_t fontColor, uint8_t bgColor, uint8_t pressFlag, uint8_t style);
|
||||
void Screen_Button(uint16_t x, uint16_t y, uint16_t w, uint16_t h,
|
||||
const char *label, uint8_t fontColor, uint8_t bgColor,
|
||||
uint8_t pressFlag, uint8_t style);
|
||||
|
||||
/* Qrcode */
|
||||
void Screen_QRCode(uint16_t x, uint16_t y, const char *url);
|
||||
void Screen_QRCodeEx(uint16_t x, uint16_t y, const char *url, uint16_t size, uint8_t color);
|
||||
|
||||
/* 版本信息 */
|
||||
void Screen_Ver(void);
|
||||
void Screen_QRCodeEx(uint16_t x, uint16_t y, const char *url, uint16_t size,
|
||||
uint8_t color);
|
||||
|
||||
// GBK
|
||||
void Screen_DrawText16_GBK(uint16_t x,uint16_t y,const uint8_t *gbk,uint16_t len,uint8_t color);
|
||||
void Screen_DrawText16V_GBK(uint16_t x,uint16_t y,const uint8_t *gbk,uint16_t len,uint8_t color);
|
||||
void Screen_DrawText16_GBK(uint16_t x, uint16_t y, const uint8_t *gbk,
|
||||
uint16_t len, uint8_t color);
|
||||
void Screen_DrawText16V_GBK(uint16_t x, uint16_t y, const uint8_t *gbk,
|
||||
uint16_t len, uint8_t color);
|
||||
|
||||
void Screen_DrawText24_GBK(uint16_t x,uint16_t y,const uint8_t *gbk,uint16_t len,uint8_t color);
|
||||
void Screen_DrawText24V_GBK(uint16_t x,uint16_t y,const uint8_t *gbk,uint16_t len,uint8_t color);
|
||||
void Screen_DrawText24_GBK(uint16_t x, uint16_t y, const uint8_t *gbk,
|
||||
uint16_t len, uint8_t color);
|
||||
void Screen_DrawText24V_GBK(uint16_t x, uint16_t y, const uint8_t *gbk,
|
||||
uint16_t len, uint8_t color);
|
||||
|
||||
void Screen_DrawText32_GBK(uint16_t x,uint16_t y,const uint8_t *gbk,uint16_t len,uint8_t color);
|
||||
void Screen_DrawText32V_GBK(uint16_t x,uint16_t y,const uint8_t *gbk,uint16_t len,uint8_t color);
|
||||
void Screen_DrawText32_GBK(uint16_t x, uint16_t y, const uint8_t *gbk,
|
||||
uint16_t len, uint8_t color);
|
||||
void Screen_DrawText32V_GBK(uint16_t x, uint16_t y, const uint8_t *gbk,
|
||||
uint16_t len, uint8_t color);
|
||||
|
||||
void Screen_DrawText48_GBK(uint16_t x,uint16_t y,const uint8_t *gbk,uint16_t len,uint8_t color,uint8_t transparent);
|
||||
void Screen_DrawText48_GBK(uint16_t x, uint16_t y, const uint8_t *gbk,
|
||||
uint16_t len, uint8_t color, uint8_t transparent);
|
||||
|
||||
// 清空屏幕相关
|
||||
void Screen_ClearZone(uint8_t zone);
|
||||
void Screen_ClearAllZones(void);
|
||||
|
||||
// 显示相关
|
||||
|
||||
void Screen_ShowInZone(uint8_t zone, const uint8_t * text,uint16_t text_len);
|
||||
|
||||
void Screen_ClearContent(void);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user