mirror of
https://github.com/tinygo-org/drivers.git
synced 2026-08-03 06:27:47 +00:00
4a0bcba87c
epd2in66b: add working driver Co-authored-by: Thomas Richner <thomas.richner@oviva.com>
35 lines
799 B
Go
35 lines
799 B
Go
//go:build pico
|
|
|
|
package epd2in66b
|
|
|
|
import (
|
|
"machine"
|
|
)
|
|
|
|
// DefaultConfig contains the default config for the https://www.waveshare.com/wiki/Pico-ePaper-2.66 module
|
|
var DefaultConfig = Config{
|
|
DataPin: machine.GP8,
|
|
ChipSelectPin: machine.GP9,
|
|
ResetPin: machine.GP12,
|
|
BusyPin: machine.GP13,
|
|
}
|
|
|
|
// NewPicoModule allocates a new device backed by the https://www.waveshare.com/wiki/Pico-ePaper-2.66 module
|
|
// This will also configure the SPI1 bus and configure the device with the DefaultConfig
|
|
func NewPicoModule() (Device, error) {
|
|
spi := machine.SPI1
|
|
|
|
if err := spi.Configure(machine.SPIConfig{
|
|
Frequency: Baudrate,
|
|
}); err != nil {
|
|
return Device{}, err
|
|
}
|
|
|
|
dev := New(spi)
|
|
if err := dev.Configure(DefaultConfig); err != nil {
|
|
return dev, err
|
|
}
|
|
|
|
return dev, nil
|
|
}
|