shuichan_new/STM32F103_App1/HardWare/OLED/oled.h

22 lines
1.2 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#ifndef __OLED_H
#define __OLED_H
#include "main.h"
/* 128x64 OLED(SSD1306 I2C) + 晶联讯 GB2312 字库 IC(SPI) 驱动
* 屏幕: SSD1306 I2C(SCL=PB5 SDA=PB4, 与 EEPROM 共总线, 地址 0x78, 无 RST)
* 字库: SPI, 与 W25Q64 共三线(CLK=PB6 DI=PB7 DO=PB9), CS2=PB3 独立片选
* 显示字符串必须是 GB2312/GBK 编码(本工程源文件即 GBK,直接写中文字面量即可)。
* 屏幕 128x64:16 像素高的行共 4 行(row 0~3),每行 8 个汉字或 16 个 ASCII。 */
void oled_init(void); /* GPIO + 屏幕初始化(app_init 调用) */
void oled_clear(void); /* 全屏清屏 */
void oled_off(void); /* 关显示(0xAE),黑屏,断电前调用 */
void oled_locate(uint8_t row, uint8_t col8); /* 定位:row 0~3,col8 为 8 像素单位 0~15 */
void oled_xoff(uint8_t px);
uint8_t oled_text_w(const char *gbk_str); /* 文本像素宽度(汉字16/ASCII8) */ /* 在当前列基础上右移 px 像素(防烧屏偏移用) */
void oled_print(const char *gbk_str); /* 从当前位置显示 GBK 字符串 */
void oled_print_line(const char *gbk_str); /* 整行显示:不足 128px 用空格补齐覆盖旧内容 */
void oled_show_qrcode(const char *text); /* 开机二维码页: 内容=ClientID, 左侧QR+右侧ID文本 */
#endif /* __OLED_H */