@@ -6,10 +6,11 @@ package ssd1351 // import "tinygo.org/x/drivers/ssd1351"
66import (
77 "errors"
88 "image/color"
9- "machine"
109 "time"
1110
1211 "tinygo.org/x/drivers"
12+ "tinygo.org/x/drivers/internal/legacy"
13+ "tinygo.org/x/drivers/internal/pin"
1314)
1415
1516var (
@@ -20,11 +21,11 @@ var (
2021// Device wraps an SPI connection.
2122type Device struct {
2223 bus drivers.SPI
23- dcPin machine. Pin
24- resetPin machine. Pin
25- csPin machine. Pin
26- enPin machine. Pin
27- rwPin machine. Pin
24+ dcPin pin. OutputStruct
25+ resetPin pin. OutputStruct
26+ csPin pin. OutputStruct
27+ enPin pin. OutputStruct
28+ rwPin pin. OutputStruct
2829 width int16
2930 height int16
3031 rowOffset int16
@@ -41,14 +42,14 @@ type Config struct {
4142}
4243
4344// New creates a new SSD1351 connection. The SPI wire must already be configured.
44- func New (bus drivers.SPI , resetPin , dcPin , csPin , enPin , rwPin machine. Pin ) Device {
45+ func New (bus drivers.SPI , resetPin , dcPin , csPin , enPin , rwPin pin. Output ) Device {
4546 return Device {
4647 bus : bus ,
47- dcPin : dcPin ,
48- resetPin : resetPin ,
49- csPin : csPin ,
50- enPin : enPin ,
51- rwPin : rwPin ,
48+ dcPin : pin. OutputStruct { Output : dcPin } ,
49+ resetPin : pin. OutputStruct { Output : resetPin } ,
50+ csPin : pin. OutputStruct { Output : csPin } ,
51+ enPin : pin. OutputStruct { Output : enPin } ,
52+ rwPin : pin. OutputStruct { Output : rwPin } ,
5253 }
5354}
5455
@@ -72,12 +73,12 @@ func (d *Device) Configure(cfg Config) {
7273 d .bufferLength = d .height
7374 }
7475
75- // configure GPIO pins
76- d . dcPin . Configure (machine. PinConfig { Mode : machine . PinOutput } )
77- d . resetPin . Configure (machine. PinConfig { Mode : machine . PinOutput } )
78- d . csPin . Configure (machine. PinConfig { Mode : machine . PinOutput } )
79- d . enPin . Configure (machine. PinConfig { Mode : machine . PinOutput } )
80- d . rwPin . Configure (machine. PinConfig { Mode : machine . PinOutput } )
76+ // configure GPIO pins (on baremetal targets only, for backwards compatibility)
77+ legacy . ConfigurePinOut ( d . dcPin )
78+ legacy . ConfigurePinOut ( d . resetPin )
79+ legacy . ConfigurePinOut ( d . csPin )
80+ legacy . ConfigurePinOut ( d . enPin )
81+ legacy . ConfigurePinOut ( d . rwPin )
8182
8283 // reset the device
8384 d .resetPin .High ()
0 commit comments