-
Notifications
You must be signed in to change notification settings - Fork 3
/
esphome-sh1107.yaml
81 lines (72 loc) · 1.52 KB
/
esphome-sh1107.yaml
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
esphome:
name: esphome-sh1107
external_components:
- source:
type: local
path: components
esp32:
board: featheresp32
framework:
type: esp-idf
logger:
globals:
- id: inverse_display
type: bool
restore_value: no
initial_value: 'false'
i2c:
frequency: 800kHz
scan: true
font:
- file: "fonts/DelugiaComplete.ttf"
id: my_font
size: 18
display:
- platform: sh1107_i2c
model: SH1107 64X128
id: my_display
rotation: 90
contrast: 0.1
lambda: |-
it.print(it.get_width() / 2, it.get_height() / 2, id(my_font), TextAlign::CENTER, "Hello World");
it.line(0, 0, it.get_width(), it.get_height());
it.line(0,it.get_height(),it.get_width(),0);
it.rectangle(0,0,it.get_width(),it.get_height());
binary_sensor:
- platform: gpio
id: button_a
pin:
number: 15
inverted: true
mode:
input: true
pullup: true
on_click:
then:
- lambda: |-
id(my_display).set_contrast(0.1);
- platform: gpio
id: button_b
pin:
number: 32
inverted: true
mode:
input: true
pullup: true
on_click:
then:
- lambda: |-
id(my_display).set_contrast(1.0);
- platform: gpio
id: button_c
pin:
number: 14
inverted: true
mode:
input: true
pullup: true
on_click:
then:
- lambda: |-
id(inverse_display) = !id(inverse_display);
id(my_display).set_invert(id(inverse_display));