74 lines
2.8 KiB
C
74 lines
2.8 KiB
C
/* USER CODE BEGIN Header */
|
||
/**
|
||
******************************************************************************
|
||
* @file screen.h
|
||
* @brief 串口屏驱动接口(用于 JC 系列串口屏,使用 USART1)
|
||
******************************************************************************
|
||
*/
|
||
/* USER CODE END Header */
|
||
|
||
#ifndef __SCREEN_H__
|
||
#define __SCREEN_H__
|
||
|
||
#ifdef __cplusplus
|
||
extern "C" {
|
||
#endif
|
||
|
||
#include <stdint.h>
|
||
|
||
|
||
/**
|
||
* @brief 发送原始命令字符串到屏幕(阻塞直到发送完成)
|
||
* @param cmd C 字符串,命令应以";\r\n"结尾
|
||
* @return 0 成功, 负值 错误
|
||
*/
|
||
int Screen_SendCmd(const char *cmd);
|
||
|
||
|
||
/* 常用封装 - 简短说明见各函数 */
|
||
/** 清屏,layer: 要清除的层号(通常为0) */
|
||
void Screen_Clear(uint8_t layer);
|
||
/** 按地址显示图片(addr 为闪存地址) */
|
||
void Screen_DisplayImage(uint32_t addr);
|
||
/** 设置背光,val: 0 最亮,255 最暗 */
|
||
void Screen_SetBrightness(uint8_t val);
|
||
/** 绘制 16 字号文本(不带背景) */
|
||
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_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_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(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_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);
|
||
|
||
/* 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);
|
||
|
||
/* 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);
|
||
|
||
#ifdef __cplusplus
|
||
}
|
||
#endif
|
||
|
||
#endif /* __SCREEN_H__ */
|