forked from igkov/bcomp11
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patholed128.c
42 lines (38 loc) · 1.19 KB
/
oled128.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include "oled128.h"
#include "bcomp.h"
#include "event.h"
extern void sh1106_init(uint8_t contrast, uint8_t inverse);
extern void sh1106_draw(const uint8_t *bitmaparray);
extern void sh1106_contrast(uint8_t contrast);
extern void ssd1306_init(uint8_t contrast, uint8_t inverse);
extern void ssd1306_draw(const uint8_t *bitmaparray);
extern void ssd1306_contrast(uint8_t contrast);
void oled_init(uint8_t contrast, uint8_t inverse) {
if (bconfig.oled_type == 0) {
ssd1306_init(contrast, inverse);
} else
if (bconfig.oled_type == 1) {
// Çàäåðæêà ïåðåä èíèöèàëèçàöèåé êîíòðîëëåðà SH1106.
// Ïðèçâàíà ïðåäîòâðàòèòü îøèáêè èíèöèàëèçàöèè ýêðàíà
// (çàìå÷åíû ñèòóàöèè íà Release-ñáîðêå, êîãäà ÷àñòü
// ýêðàíà íå îòîáðàæàåò èíôîðìàöèþ èëè ñîäåðæèò ìóñîð).
delay_ms(100);
sh1106_init(contrast, inverse);
}
}
void oled_draw(const uint8_t *bitmaparray) {
if (bconfig.oled_type == 0) {
ssd1306_draw(bitmaparray);
} else
if (bconfig.oled_type == 1) {
sh1106_draw(bitmaparray);
}
}
void oled_contrast(uint8_t contrast) {
if (bconfig.oled_type == 0) {
ssd1306_contrast(contrast);
} else
if (bconfig.oled_type == 1) {
sh1106_contrast(contrast);
}
}