waveshare2in13v2: Enable hardware early

Enable the clock and analog parts when configuring the mode. In probably
all use cases a drawing operation is following soon after anyway.
Putting the device to sleep disables these hardware parts again.
pull/43/head
Michael Hanselmann 4 years ago committed by M-A
parent 40f2bd16d7
commit df5238c598

@ -66,16 +66,11 @@ func configDisplayMode(ctrl controller, mode PartialUpdate, lut LUT) {
ctrl.sendCommand(writeDisplayOptionRegister) ctrl.sendCommand(writeDisplayOptionRegister)
ctrl.sendData([]byte{0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00}) ctrl.sendData([]byte{0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00})
if mode == Partial { // Start up the parts likely used by a draw operation soon.
ctrl.sendCommand(displayUpdateControl2) ctrl.sendCommand(displayUpdateControl2)
ctrl.sendData([]byte{ ctrl.sendData([]byte{displayUpdateEnableClock | displayUpdateEnableAnalog})
displayUpdateEnableClock |
displayUpdateEnableAnalog,
})
ctrl.sendCommand(masterActivation) ctrl.sendCommand(masterActivation)
}
ctrl.waitUntilIdle() ctrl.waitUntilIdle()
} }

@ -92,6 +92,8 @@ func TestConfigDisplayMode(t *testing.T) {
{cmd: borderWaveformControl, data: []byte{0x03}}, {cmd: borderWaveformControl, data: []byte{0x03}},
{cmd: writeLutRegister, data: bytes.Repeat([]byte{'F'}, 70)}, {cmd: writeLutRegister, data: bytes.Repeat([]byte{'F'}, 70)},
{cmd: 0x37, data: []byte{0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00}}, {cmd: 0x37, data: []byte{0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00}},
{cmd: displayUpdateControl2, data: []byte{0xc0}},
{cmd: masterActivation},
}, },
}, },
{ {

Loading…
Cancel
Save