Added support for Inky pHAT v2

pull/12/head
Thereatra 5 years ago
parent c53a2960d0
commit fe8e5b41fa

@ -2,7 +2,7 @@
// Use of this source code is governed under the Apache License, Version 2.0 // Use of this source code is governed under the Apache License, Version 2.0
// that can be found in the LICENSE file. // that can be found in the LICENSE file.
// Package inky drives an Inky pHAT or wHAT E ink display. // Package inky drives an Inky pHAT, pHAT v2 or wHAT E ink display.
// //
// Datasheet // Datasheet
// //

@ -69,12 +69,15 @@ type Model int
const ( const (
PHAT Model = iota PHAT Model = iota
WHAT WHAT
PHAT2
) )
func (m *Model) String() string { func (m *Model) String() string {
switch *m { switch *m {
case PHAT: case PHAT:
return "PHAT" return "PHAT"
case PHAT2:
return "PHAT2"
case WHAT: case WHAT:
return "WHAT" return "WHAT"
default: default:
@ -87,6 +90,8 @@ func (m *Model) Set(s string) error {
switch s { switch s {
case "PHAT": case "PHAT":
*m = PHAT *m = PHAT
case "PHAT2":
*m = PHAT2
case "WHAT": case "WHAT":
*m = WHAT *m = WHAT
default: default:
@ -148,6 +153,9 @@ func New(p spi.Port, dc gpio.PinOut, reset gpio.PinOut, busy gpio.PinIn, o *Opts
case PHAT: case PHAT:
d.bounds = image.Rect(0, 0, 104, 212) d.bounds = image.Rect(0, 0, 104, 212)
d.flipVertically = true d.flipVertically = true
case PHAT2:
d.bounds = image.Rect(0, 0, 122, 250)
d.flipVertically = true
case WHAT: case WHAT:
d.bounds = image.Rect(0, 0, 400, 300) d.bounds = image.Rect(0, 0, 400, 300)
} }

Loading…
Cancel
Save