mirror of
https://github.com/tinygo-org/drivers.git
synced 2026-08-20 06:28:59 +00:00
finish rewrites!
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
//go:build baremetal
|
||||
|
||||
package epd2in66b
|
||||
|
||||
import "machine"
|
||||
|
||||
type Config struct {
|
||||
ResetPin machine.Pin
|
||||
DataPin machine.Pin
|
||||
ChipSelectPin machine.Pin
|
||||
BusyPin machine.Pin
|
||||
}
|
||||
|
||||
// Configure configures the device and its pins.
|
||||
func (d *Device) Configure(c Config) error {
|
||||
cs := c.ChipSelectPin
|
||||
dc := c.DataPin
|
||||
rst := c.ResetPin
|
||||
busy := c.BusyPin
|
||||
|
||||
cs.Configure(machine.PinConfig{Mode: machine.PinOutput})
|
||||
dc.Configure(machine.PinConfig{Mode: machine.PinOutput})
|
||||
rst.Configure(machine.PinConfig{Mode: machine.PinOutput})
|
||||
busy.Configure(machine.PinConfig{Mode: machine.PinInput})
|
||||
d.cs = cs.Set
|
||||
d.dc = dc.Set
|
||||
d.rst = rst.Set
|
||||
d.busy = busy.Get
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user