Skip to content

Commit

Permalink
waveshare213v2: Add named constants for display update flags
Browse files Browse the repository at this point in the history
  • Loading branch information
hansmi authored and maruel committed Dec 24, 2021
1 parent 0c6b49f commit 3650bc7
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
13 changes: 11 additions & 2 deletions waveshare2in13v2/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ func configDisplayMode(ctrl controller, mode PartialUpdate, lut LUT) {
ctrl.sendData([]byte{0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00})

ctrl.sendCommand(displayUpdateControl2)
ctrl.sendData([]byte{0xC0})
ctrl.sendData([]byte{
displayUpdateEnableClock |
displayUpdateEnableAnalog,
})

ctrl.sendCommand(masterActivation)
}
Expand All @@ -89,7 +92,13 @@ func updateDisplay(ctrl controller, mode PartialUpdate) {
ctrl.sendData([]byte{displayUpdateFlags})

ctrl.sendCommand(displayUpdateControl2)
ctrl.sendData([]byte{0xC7})
ctrl.sendData([]byte{
displayUpdateDisableClock |
displayUpdateDisableAnalog |
displayUpdateDisplay |
displayUpdateEnableClock |
displayUpdateEnableAnalog,
})

ctrl.sendCommand(masterActivation)
ctrl.waitUntilIdle()
Expand Down
12 changes: 12 additions & 0 deletions waveshare2in13v2/waveshare213v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,18 @@ const (
sourceDrivingVoltageVSL_neg15V = 0x32
)

// Flags for the displayUpdateControl2 command
const (
displayUpdateDisableClock byte = 1 << iota
displayUpdateDisableAnalog
displayUpdateDisplay
displayUpdateMode2
displayUpdateLoadLUTFromOTP
displayUpdateLoadTemperature
displayUpdateEnableClock
displayUpdateEnableAnalog
)

// Dev defines the handler which is used to access the display.
type Dev struct {
c conn.Conn
Expand Down

0 comments on commit 3650bc7

Please sign in to comment.