Skip to content

Commit 130c0b2

Browse files
Fixed command bytes (#23)
Changed first bytes for "PreChargePeriod" and "VcomhDeselect" to be what they should be in the datasheet (0xD9 and 0xDB, respectively). This fix got the driver working properly for my hardware (raspberry pi zero w + WaveShare SH1106 HAT). Before this fix, the display would behave differently in based on what seemed to be background cosmic radiation; sometimes it would work perfectly, sometimes it would go dark after a few seconds of displaying something.
1 parent 294e8fa commit 130c0b2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/command.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,10 @@ impl Command {
7474
([0xD5, ((0xF & fosc) << 4) | (0xF & div), 0, 0, 0, 0, 0], 2)
7575
}
7676
Command::PreChargePeriod(phase1, phase2) => (
77-
[0x22, ((0xF & phase2) << 4) | (0xF & phase1), 0, 0, 0, 0, 0],
77+
[0xD9, ((0xF & phase2) << 4) | (0xF & phase1), 0, 0, 0, 0, 0],
7878
2,
7979
),
80-
Command::VcomhDeselect(level) => ([0x35, (level as u8) << 4, 0, 0, 0, 0, 0], 2),
80+
Command::VcomhDeselect(level) => ([0xDB, (level as u8) << 4, 0, 0, 0, 0, 0], 2),
8181
Command::Noop => ([0xE3, 0, 0, 0, 0, 0, 0], 1),
8282
Command::ChargePump(en) => ([0xAD, 0x8A | (en as u8), 0, 0, 0, 0, 0], 2),
8383
};

0 commit comments

Comments
 (0)