Fix incorrect usage. a 'pin number' was passed to port.Connect(), when that parameter is actually the bit count.

pull/106/head
George Sexton 1 year ago
parent 7e3e54275b
commit bc639221ca

@ -160,7 +160,7 @@ func NewImpression(p spi.Port, dc gpio.PinOut, reset gpio.PinOut, busy gpio.PinI
// is 192K Bytes. To make the Impression 7.3 treat this as single trans- // is 192K Bytes. To make the Impression 7.3 treat this as single trans-
// action, we have to take over control of the CS pin and manipulate it // action, we have to take over control of the CS pin and manipulate it
// as required. // as required.
c, err := p.Connect(cSpeed, spi.Mode0|spi.NoCS, cs0Pin) c, err := p.Connect(cSpeed, spi.Mode0|spi.NoCS, 8)
if err != nil { if err != nil {
return nil, fmt.Errorf("failed to connect to inky over spi: %v", err) return nil, fmt.Errorf("failed to connect to inky over spi: %v", err)
} }
@ -191,7 +191,7 @@ func NewImpression(p spi.Port, dc gpio.PinOut, reset gpio.PinOut, busy gpio.PinI
model: o.Model, model: o.Model,
variant: o.DisplayVariant, variant: o.DisplayVariant,
pcbVariant: o.PCBVariant, pcbVariant: o.PCBVariant,
cs: gpioreg.ByName("GPIO8"), cs: gpioreg.ByName(cs0Pin),
}, },
saturation: 50, // Looks good enough for most of the images. saturation: 50, // Looks good enough for most of the images.
} }

@ -23,7 +23,7 @@ var _ display.Drawer = &Dev{}
var _ conn.Resource = &Dev{} var _ conn.Resource = &Dev{}
const ( const (
cs0Pin = 8 cs0Pin = "GPIO8"
) )
var borderColor = map[Color]byte{ var borderColor = map[Color]byte{
@ -75,7 +75,7 @@ func New(p spi.Port, dc gpio.PinOut, reset gpio.PinOut, busy gpio.PinIn, o *Opts
return nil, fmt.Errorf("unsupported color: %v", o.ModelColor) return nil, fmt.Errorf("unsupported color: %v", o.ModelColor)
} }
c, err := p.Connect(488*physic.KiloHertz, spi.Mode0, cs0Pin) c, err := p.Connect(488*physic.KiloHertz, spi.Mode0 | spi.NoCS, 8)
if err != nil { if err != nil {
return nil, fmt.Errorf("failed to connect to inky over spi: %v", err) return nil, fmt.Errorf("failed to connect to inky over spi: %v", err)
} }
@ -101,7 +101,7 @@ func New(p spi.Port, dc gpio.PinOut, reset gpio.PinOut, busy gpio.PinIn, o *Opts
model: o.Model, model: o.Model,
variant: o.DisplayVariant, variant: o.DisplayVariant,
pcbVariant: o.PCBVariant, pcbVariant: o.PCBVariant,
cs: gpioreg.ByName("GPIO8"), cs: gpioreg.ByName(cs0Pin),
} }
switch o.Model { switch o.Model {

Loading…
Cancel
Save