• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 FuZhou Lockzhiner Electronic Co., Ltd. All rights reserved.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 #ifndef _OLED_H_
16 #define _OLED_H_
17 
18 /* 定义OLED的行列数目 */
19 #define OLED_COLUMN_MAX         128
20 #define OLED_ROW_MAX            64
21 
22 /* 定义OLED字体大小 */
23 #define OLED_CHR_SIZE_12        12
24 #define OLED_CHR_SIZE_16        16
25 
26 /***************************************************************
27  * 函数名称: oled_init
28  * 说    明: oled初始化
29  * 参    数: 无
30  * 返 回 值: 返回0为成功,反之为失败
31  ***************************************************************/
32 unsigned int oled_init(void);
33 
34 
35 /***************************************************************
36  * 函数名称: oled_deinit
37  * 说    明: oled销毁
38  * 参    数: 无
39  * 返 回 值: 返回0为成功,反之为失败
40  ***************************************************************/
41 unsigned int oled_deinit(void);
42 
43 
44 /***************************************************************
45  * 函数名称: oled_display_on
46  * 说    明: oled显示开启
47  * 参    数: 无
48  * 返 回 值: 无
49  ***************************************************************/
50 void oled_display_on(void);
51 
52 
53 /***************************************************************
54  * 函数名称: oled_display_off
55  * 说    明: oled显示关闭
56  * 参    数: 无
57  * 返 回 值: 无
58  ***************************************************************/
59 void oled_display_off(void);
60 
61 
62 /***************************************************************
63  * 函数名称: oled_clear
64  * 说    明: oled清空
65  * 参    数: 无
66  * 返 回 值: 无
67  ***************************************************************/
68 void oled_clear(void);
69 
70 
71 /***************************************************************
72  * 函数名称: oled_show_char
73  * 说    明: oled显示字符
74  * 参    数:
75  *      @x:字符的X轴坐标
76  *      @y:字符的Y轴坐标
77  *      @chr:字符
78  *      @chr_size:字符的字体,包括12/16两种字体
79  * 返 回 值: 无
80  ***************************************************************/
81 void oled_show_char(uint8_t x, uint8_t y, uint8_t chr, uint8_t chr_size);
82 
83 
84 /***************************************************************
85  * 函数名称: oled_show_num
86  * 说    明: oled显示数字
87  * 参    数:
88  *      @x:数字的X轴坐标
89  *      @y:数字的Y轴坐标
90  *      @num:数字
91  *      @len:数字的位数
92  *      @size:字体大小
93  * 返 回 值: 无
94  ***************************************************************/
95 void oled_show_num(uint8_t x, uint8_t y, uint32_t num, uint8_t len, uint8_t size);
96 
97 
98 /***************************************************************
99  * 函数名称: oled_show_string
100  * 说    明: oled显示字符串
101  * 参    数:
102  *      @x:字符串的X轴坐标
103  *      @y:字符串的Y轴坐标
104  *      @p:字符串
105  *      @chr_size:字符串的位数
106  * 返 回 值: 无
107  ***************************************************************/
108 void oled_show_string(uint8_t x, uint8_t y, uint8_t *p, uint8_t chr_size);
109 
110 
111 /***************************************************************
112  * 函数名称: oled_draw_bmp
113  * 说    明: oled显示图片
114  * 参    数:
115  *      @x0:图片的起始点X轴坐标,取值为0~127
116  *      @y0:图片的起始点Y轴坐标,取值为0~63
117  *      @x1:图片的结束点X轴坐标,取值为0~127
118  *      @y1:图片的结束点Y轴坐标,取值为0~63
119  *      @bmp:图片
120  * 返 回 值: 无
121  ***************************************************************/
122 void oled_draw_bmp(unsigned char x0, unsigned char y0, unsigned char x1, unsigned char y1, unsigned char bmp[]);
123 
124 
125 #endif /* _OLED_H_ */