shuichan_old/V1.5/STM32F103_App1/HardWare/OLED/oled.h

22 lines
1.1 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 OLEDSSD1306 兼容指令)+ 晶联讯 GB2312 字库 IC全部 GPIO 模拟 SPI。
* 接线CLK=PC12 MOSI=PC9 DC=PC8 CS1=PC7(屏幕片选) FSO=PC6(字库输出,接MCU输入)
* CS2=PB15(字库片选)
* 显示字符串必须是 GB2312/GBK 编码(本工程源文件即 GBK直接写中文字面量即可
* 屏幕 128x6416 像素高的行共 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~3col8 为 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 用空格补齐覆盖旧内容 */
#endif /* __OLED_H */