mirror of
https://github.com/tinygo-org/drivers.git
synced 2026-08-21 15:09:00 +00:00
+3
-16
@@ -34,7 +34,7 @@ type Config struct {
|
|||||||
Height int16
|
Height int16
|
||||||
}
|
}
|
||||||
|
|
||||||
// New creates a new ST7735 connection. The SPI wire must already be configured.
|
// New creates a new SSD1331 connection. The SPI wire must already be configured.
|
||||||
func New(bus machine.SPI, resetPin, dcPin, csPin machine.Pin) Device {
|
func New(bus machine.SPI, resetPin, dcPin, csPin machine.Pin) Device {
|
||||||
dcPin.Configure(machine.PinConfig{Mode: machine.PinOutput})
|
dcPin.Configure(machine.PinConfig{Mode: machine.PinOutput})
|
||||||
resetPin.Configure(machine.PinConfig{Mode: machine.PinOutput})
|
resetPin.Configure(machine.PinConfig{Mode: machine.PinOutput})
|
||||||
@@ -250,21 +250,8 @@ func (d *Device) Data(data uint8) {
|
|||||||
|
|
||||||
// Tx sends data to the display
|
// Tx sends data to the display
|
||||||
func (d *Device) Tx(data []byte, isCommand bool) {
|
func (d *Device) Tx(data []byte, isCommand bool) {
|
||||||
if isCommand {
|
d.dcPin.Set(!isCommand)
|
||||||
d.csPin.High()
|
d.bus.Tx(data, nil)
|
||||||
d.dcPin.Low()
|
|
||||||
d.csPin.Low()
|
|
||||||
|
|
||||||
d.bus.Tx(data, nil)
|
|
||||||
d.csPin.High()
|
|
||||||
} else {
|
|
||||||
d.csPin.High()
|
|
||||||
d.dcPin.High()
|
|
||||||
d.csPin.Low()
|
|
||||||
|
|
||||||
d.bus.Tx(data, nil)
|
|
||||||
d.csPin.High()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Size returns the current size of the display.
|
// Size returns the current size of the display.
|
||||||
|
|||||||
Reference in New Issue
Block a user