mirror of
https://github.com/tinygo-org/drivers.git
synced 2026-08-18 13:43:58 +00:00
refactor: add display.Pin interface and use it everywhere that is easy to do so
Signed-off-by: deadprogram <ron@hybridgroup.com>
This commit is contained in:
committed by
Yurii Soldak
parent
d02d21ecea
commit
38c606d813
+5
-6
@@ -6,7 +6,6 @@ package pcd8544 // import "tinygo.org/x/drivers/pcd8544"
|
||||
import (
|
||||
"errors"
|
||||
"image/color"
|
||||
"machine"
|
||||
"time"
|
||||
|
||||
"tinygo.org/x/drivers"
|
||||
@@ -15,9 +14,9 @@ import (
|
||||
// Device wraps an SPI connection.
|
||||
type Device struct {
|
||||
bus drivers.SPI
|
||||
dcPin machine.Pin
|
||||
rstPin machine.Pin
|
||||
scePin machine.Pin
|
||||
dcPin drivers.Pin
|
||||
rstPin drivers.Pin
|
||||
scePin drivers.Pin
|
||||
buffer []byte
|
||||
width int16
|
||||
height int16
|
||||
@@ -29,8 +28,8 @@ type Config struct {
|
||||
Height int16
|
||||
}
|
||||
|
||||
// New creates a new PCD8544 connection. The SPI bus must already be configured.
|
||||
func New(bus drivers.SPI, dcPin, rstPin, scePin machine.Pin) *Device {
|
||||
// New creates a new PCD8544 connection. The SPI bus and pins must already be configured.
|
||||
func New(bus drivers.SPI, dcPin, rstPin, scePin drivers.Pin) *Device {
|
||||
return &Device{
|
||||
bus: bus,
|
||||
dcPin: dcPin,
|
||||
|
||||
Reference in New Issue
Block a user