You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// FunctionSet = 0x20, // Basic instruction set, only supported mode currently
21
+
// }
22
+
23
+
pubtraitPcd8544Backend{
13
24
fncommand(&mutself,command:u8);
14
25
fndata(&mutself,data:&[u8]);
26
+
}
27
+
28
+
pubstructPcd8544Driver<B:Pcd8544Backend>{
29
+
backend:B,
30
+
xpos:u8,
31
+
ypos:u8,
32
+
buffer:[0u8;BUFFER_SIZE],
33
+
}
34
+
35
+
impl<B:Pcd8544Backend>Pcd8544Driver<B>{
36
+
pubfnnew(backend:B) -> Self{
37
+
Self{
38
+
backend,
39
+
xpos:0,
40
+
ypos:0,
41
+
}
42
+
}
15
43
16
-
fninit(&mutself){
17
-
self.command(0x21);// chip active; horizontal addressing mode (V = 0); use extended instruction set (H = 1)
18
-
// set LCD Vop (contrast), which may require some tweaking:
19
-
self.command(0xB8);// try 0xB1 (for 3.3V red SparkFun), 0xB8 (for 3.3V blue SparkFun), 0xBF if your display is too dark, or 0x80 to 0xFF if experimenting
20
-
self.command(0x04);// set temp coefficient
21
-
self.command(0x14);// LCD bias mode 1:48: try 0x13 or 0x14
44
+
pubfninit(&mutself){
45
+
self.backend.command(0x21);// chip active; horizontal addressing mode (V = 0); use extended instruction set (H = 1)
46
+
// set LCD Vop (contrast), which may require some tweaking:
47
+
self.backend.command(0xB8);// try 0xB1 (for 3.3V red SparkFun), 0xB8 (for 3.3V blue SparkFun), 0xBF if your display is too dark, or 0x80 to 0xFF if experimenting
48
+
self.backend.command(0x04);// set temp coefficient
49
+
self.backend.command(0x14);// LCD bias mode 1:48: try 0x13 or 0x14
22
50
23
-
self.command(0x20);// we must send 0x20 before modifying the display control mode
24
-
self.command(0x0C);// set display control to normal mode: 0x0D for inverse
51
+
self.backend.command(0x20);// we must send 0x20 before modifying the display control mode
52
+
self.backend.command(0x0C);// set display control to normal mode: 0x0D for inverse
0 commit comments