diff --git a/waveshare2in13v2/controller.go b/waveshare2in13v2/controller.go index ad35077..adcb53a 100644 --- a/waveshare2in13v2/controller.go +++ b/waveshare2in13v2/controller.go @@ -63,11 +63,10 @@ func configDisplayMode(ctrl controller, mode PartialUpdate, lut LUT) { ctrl.sendCommand(writeLutRegister) ctrl.sendData(lut[:70]) - if mode == Partial { - // Undocumented command used in vendor example code. - ctrl.sendCommand(0x37) - ctrl.sendData([]byte{0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00}) + ctrl.sendCommand(writeDisplayOptionRegister) + ctrl.sendData([]byte{0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00}) + if mode == Partial { ctrl.sendCommand(displayUpdateControl2) ctrl.sendData([]byte{ displayUpdateEnableClock | diff --git a/waveshare2in13v2/controller_test.go b/waveshare2in13v2/controller_test.go index c536ea7..5c6436f 100644 --- a/waveshare2in13v2/controller_test.go +++ b/waveshare2in13v2/controller_test.go @@ -91,6 +91,7 @@ func TestConfigDisplayMode(t *testing.T) { {cmd: writeVcomRegister, data: []byte{0x55}}, {cmd: borderWaveformControl, data: []byte{0x03}}, {cmd: writeLutRegister, data: bytes.Repeat([]byte{'F'}, 70)}, + {cmd: 0x37, data: []byte{0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00}}, }, }, { diff --git a/waveshare2in13v2/waveshare213v2.go b/waveshare2in13v2/waveshare213v2.go index b67a636..8187bb4 100644 --- a/waveshare2in13v2/waveshare213v2.go +++ b/waveshare2in13v2/waveshare213v2.go @@ -37,6 +37,7 @@ const ( setDummyLinePeriod byte = 0x3A setGateTime byte = 0x3B borderWaveformControl byte = 0x3C + writeDisplayOptionRegister byte = 0x37 setRAMXAddressStartEndPosition byte = 0x44 setRAMYAddressStartEndPosition byte = 0x45 setRAMXAddressCounter byte = 0x4E