From bcb291992c28087b60c908a1b41b467ab498d80c Mon Sep 17 00:00:00 2001 From: Daniel Esteban Date: Fri, 11 Oct 2019 18:13:12 +0200 Subject: [PATCH] ssd1331: make SPI TX faster same change as PR #89 --- ssd1331/ssd1331.go | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/ssd1331/ssd1331.go b/ssd1331/ssd1331.go index c76d7ee..1534418 100644 --- a/ssd1331/ssd1331.go +++ b/ssd1331/ssd1331.go @@ -34,7 +34,7 @@ type Config struct { 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 { dcPin.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 func (d *Device) Tx(data []byte, isCommand bool) { - if isCommand { - d.csPin.High() - 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() - } + d.dcPin.Set(!isCommand) + d.bus.Tx(data, nil) } // Size returns the current size of the display.