mirror of
https://github.com/tinygo-org/drivers.git
synced 2026-08-19 14:14:00 +00:00
rename busy fields to isBusy
This commit is contained in:
committed by
deadprogram
parent
807ae3da9b
commit
2e007a6de7
+5
-5
@@ -210,7 +210,7 @@ func (d *Device) SendCommand(command byte) {
|
|||||||
d.bus.SetCommandMode(true)
|
d.bus.SetCommandMode(true)
|
||||||
d.bus.Write([]byte{command})
|
d.bus.Write([]byte{command})
|
||||||
|
|
||||||
for d.busy(command == DISPLAY_CLEAR || command == CURSOR_HOME) {
|
for d.isBusy(command == DISPLAY_CLEAR || command == CURSOR_HOME) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -219,7 +219,7 @@ func (d *Device) sendData(data byte) {
|
|||||||
d.bus.SetCommandMode(false)
|
d.bus.SetCommandMode(false)
|
||||||
d.bus.Write([]byte{data})
|
d.bus.Write([]byte{data})
|
||||||
|
|
||||||
for d.busy(false) {
|
for d.isBusy(false) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -231,9 +231,9 @@ func (d *Device) CreateCharacter(cgramAddr uint8, data []byte) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// busy returns true when hd447890 is busy
|
// isBusy returns true when hd447890 is isBusy
|
||||||
// or after the timeout specified
|
// or after the timeout specified
|
||||||
func (d *Device) busy(longDelay bool) bool {
|
func (d *Device) isBusy(longDelay bool) bool {
|
||||||
if d.bus.WriteOnly() {
|
if d.bus.WriteOnly() {
|
||||||
// Can't read busy flag if write only, so sleep a bit then return
|
// Can't read busy flag if write only, so sleep a bit then return
|
||||||
if longDelay {
|
if longDelay {
|
||||||
@@ -261,7 +261,7 @@ func (d *Device) busy(longDelay bool) bool {
|
|||||||
|
|
||||||
// Busy returns true when hd447890 is busy
|
// Busy returns true when hd447890 is busy
|
||||||
func (d *Device) Busy() bool {
|
func (d *Device) Busy() bool {
|
||||||
return d.busy(false)
|
return d.isBusy(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Size returns the current size of the display.
|
// Size returns the current size of the display.
|
||||||
|
|||||||
+8
-8
@@ -34,7 +34,7 @@ type Device struct {
|
|||||||
cs drivers.PinOutput
|
cs drivers.PinOutput
|
||||||
dc drivers.PinOutput
|
dc drivers.PinOutput
|
||||||
rst drivers.PinOutput
|
rst drivers.PinOutput
|
||||||
busy drivers.PinInput
|
isBusy drivers.PinInput
|
||||||
width int16
|
width int16
|
||||||
height int16
|
height int16
|
||||||
buffer []uint8
|
buffer []uint8
|
||||||
@@ -55,11 +55,11 @@ func New(bus drivers.SPI, csPin, dcPin, rstPin legacy.PinOutput, busyPin legacy.
|
|||||||
legacy.ConfigurePinOut(rstPin)
|
legacy.ConfigurePinOut(rstPin)
|
||||||
legacy.ConfigurePinInput(busyPin)
|
legacy.ConfigurePinInput(busyPin)
|
||||||
return Device{
|
return Device{
|
||||||
bus: bus,
|
bus: bus,
|
||||||
cs: csPin.Set,
|
cs: csPin.Set,
|
||||||
dc: dcPin.Set,
|
dc: dcPin.Set,
|
||||||
rst: rstPin.Set,
|
rst: rstPin.Set,
|
||||||
busy: busyPin.Get,
|
isBusy: busyPin.Get,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -313,14 +313,14 @@ func (d *Device) ClearDisplay() {
|
|||||||
|
|
||||||
// WaitUntilIdle waits until the display is ready
|
// WaitUntilIdle waits until the display is ready
|
||||||
func (d *Device) WaitUntilIdle() {
|
func (d *Device) WaitUntilIdle() {
|
||||||
for !d.busy() {
|
for !d.isBusy() {
|
||||||
time.Sleep(10 * time.Millisecond)
|
time.Sleep(10 * time.Millisecond)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsBusy returns the busy status of the display
|
// IsBusy returns the busy status of the display
|
||||||
func (d *Device) IsBusy() bool {
|
func (d *Device) IsBusy() bool {
|
||||||
return d.busy()
|
return d.isBusy()
|
||||||
}
|
}
|
||||||
|
|
||||||
// ClearBuffer sets the buffer to 0xFF (white)
|
// ClearBuffer sets the buffer to 0xFF (white)
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ type Device struct {
|
|||||||
cs drivers.PinOutput
|
cs drivers.PinOutput
|
||||||
dc drivers.PinOutput
|
dc drivers.PinOutput
|
||||||
rst drivers.PinOutput
|
rst drivers.PinOutput
|
||||||
busy drivers.PinInput
|
isBusy drivers.PinInput
|
||||||
configurePins func()
|
configurePins func()
|
||||||
buffer []uint8
|
buffer []uint8
|
||||||
rotation Rotation
|
rotation Rotation
|
||||||
@@ -89,7 +89,7 @@ func New(bus *machine.SPI, csPin, dcPin, rstPin legacy.PinOutput, busyPin legacy
|
|||||||
cs: csPin.Set,
|
cs: csPin.Set,
|
||||||
dc: dcPin.Set,
|
dc: dcPin.Set,
|
||||||
rst: rstPin.Set,
|
rst: rstPin.Set,
|
||||||
busy: busyPin.Get,
|
isBusy: busyPin.Get,
|
||||||
configurePins: func() {
|
configurePins: func() {
|
||||||
legacy.ConfigurePinOut(csPin)
|
legacy.ConfigurePinOut(csPin)
|
||||||
legacy.ConfigurePinOut(dcPin)
|
legacy.ConfigurePinOut(dcPin)
|
||||||
@@ -378,7 +378,7 @@ func (d *Device) Clear() {
|
|||||||
|
|
||||||
// WaitUntilIdle waits until the display is ready
|
// WaitUntilIdle waits until the display is ready
|
||||||
func (d *Device) WaitUntilIdle() {
|
func (d *Device) WaitUntilIdle() {
|
||||||
for d.busy() {
|
for d.isBusy() {
|
||||||
time.Sleep(100 * time.Millisecond)
|
time.Sleep(100 * time.Millisecond)
|
||||||
}
|
}
|
||||||
time.Sleep(200 * time.Millisecond)
|
time.Sleep(200 * time.Millisecond)
|
||||||
@@ -386,7 +386,7 @@ func (d *Device) WaitUntilIdle() {
|
|||||||
|
|
||||||
// IsBusy returns the busy status of the display
|
// IsBusy returns the busy status of the display
|
||||||
func (d *Device) IsBusy() bool {
|
func (d *Device) IsBusy() bool {
|
||||||
return d.busy()
|
return d.isBusy()
|
||||||
}
|
}
|
||||||
|
|
||||||
// ClearBuffer sets the buffer to 0xFF (white)
|
// ClearBuffer sets the buffer to 0xFF (white)
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ type Device struct {
|
|||||||
cs drivers.PinOutput
|
cs drivers.PinOutput
|
||||||
dc drivers.PinOutput
|
dc drivers.PinOutput
|
||||||
rst drivers.PinOutput
|
rst drivers.PinOutput
|
||||||
busy drivers.PinInput
|
isBusy drivers.PinInput
|
||||||
logicalWidth int16
|
logicalWidth int16
|
||||||
width int16
|
width int16
|
||||||
height int16
|
height int16
|
||||||
@@ -59,11 +59,11 @@ func New(bus drivers.SPI, csPin, dcPin, rstPin legacy.PinOutput, busyPin legacy.
|
|||||||
legacy.ConfigurePinOut(rstPin)
|
legacy.ConfigurePinOut(rstPin)
|
||||||
legacy.ConfigurePinInput(busyPin)
|
legacy.ConfigurePinInput(busyPin)
|
||||||
return Device{
|
return Device{
|
||||||
bus: bus,
|
bus: bus,
|
||||||
cs: csPin.Set,
|
cs: csPin.Set,
|
||||||
dc: dcPin.Set,
|
dc: dcPin.Set,
|
||||||
rst: rstPin.Set,
|
rst: rstPin.Set,
|
||||||
busy: busyPin.Get,
|
isBusy: busyPin.Get,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -298,14 +298,14 @@ func (d *Device) setMemoryPointer(x int16, y int16) {
|
|||||||
|
|
||||||
// WaitUntilIdle waits until the display is ready
|
// WaitUntilIdle waits until the display is ready
|
||||||
func (d *Device) WaitUntilIdle() {
|
func (d *Device) WaitUntilIdle() {
|
||||||
for d.busy() {
|
for d.isBusy() {
|
||||||
time.Sleep(100 * time.Millisecond)
|
time.Sleep(100 * time.Millisecond)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsBusy returns the busy status of the display
|
// IsBusy returns the busy status of the display
|
||||||
func (d *Device) IsBusy() bool {
|
func (d *Device) IsBusy() bool {
|
||||||
return d.busy()
|
return d.isBusy()
|
||||||
}
|
}
|
||||||
|
|
||||||
// ClearBuffer sets the buffer to 0xFF (white)
|
// ClearBuffer sets the buffer to 0xFF (white)
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ type Device struct {
|
|||||||
cs drivers.PinOutput
|
cs drivers.PinOutput
|
||||||
dc drivers.PinOutput
|
dc drivers.PinOutput
|
||||||
rst drivers.PinOutput
|
rst drivers.PinOutput
|
||||||
busy drivers.PinInput
|
isBusy drivers.PinInput
|
||||||
width int16
|
width int16
|
||||||
height int16
|
height int16
|
||||||
buffer [][]uint8
|
buffer [][]uint8
|
||||||
@@ -39,11 +39,11 @@ func New(bus drivers.SPI, csPin, dcPin, rstPin legacy.PinOutput, busyPin legacy.
|
|||||||
legacy.ConfigurePinOut(rstPin)
|
legacy.ConfigurePinOut(rstPin)
|
||||||
legacy.ConfigurePinInput(busyPin)
|
legacy.ConfigurePinInput(busyPin)
|
||||||
return Device{
|
return Device{
|
||||||
bus: bus,
|
bus: bus,
|
||||||
cs: csPin.Set,
|
cs: csPin.Set,
|
||||||
dc: dcPin.Set,
|
dc: dcPin.Set,
|
||||||
rst: rstPin.Set,
|
rst: rstPin.Set,
|
||||||
busy: busyPin.Get,
|
isBusy: busyPin.Get,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -277,14 +277,14 @@ func (d *Device) ClearDisplay() {
|
|||||||
|
|
||||||
// WaitUntilIdle waits until the display is ready
|
// WaitUntilIdle waits until the display is ready
|
||||||
func (d *Device) WaitUntilIdle() {
|
func (d *Device) WaitUntilIdle() {
|
||||||
for !d.busy() {
|
for !d.isBusy() {
|
||||||
time.Sleep(100 * time.Millisecond)
|
time.Sleep(100 * time.Millisecond)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsBusy returns the busy status of the display
|
// IsBusy returns the busy status of the display
|
||||||
func (d *Device) IsBusy() bool {
|
func (d *Device) IsBusy() bool {
|
||||||
return d.busy()
|
return d.isBusy()
|
||||||
}
|
}
|
||||||
|
|
||||||
// ClearBuffer sets the buffer to 0xFF (white)
|
// ClearBuffer sets the buffer to 0xFF (white)
|
||||||
|
|||||||
@@ -18,11 +18,11 @@ const (
|
|||||||
const Baudrate = 4_000_000 // 4 MHz
|
const Baudrate = 4_000_000 // 4 MHz
|
||||||
|
|
||||||
type Device struct {
|
type Device struct {
|
||||||
bus drivers.SPI
|
bus drivers.SPI
|
||||||
cs drivers.PinOutput
|
cs drivers.PinOutput
|
||||||
dc drivers.PinOutput
|
dc drivers.PinOutput
|
||||||
rst drivers.PinOutput
|
rst drivers.PinOutput
|
||||||
busy drivers.PinInput
|
isBusy drivers.PinInput
|
||||||
|
|
||||||
blackBuffer []byte
|
blackBuffer []byte
|
||||||
redBuffer []byte
|
redBuffer []byte
|
||||||
@@ -206,7 +206,7 @@ func (d *Device) WaitUntilIdle() {
|
|||||||
// give it some time to get busy
|
// give it some time to get busy
|
||||||
time.Sleep(50 * time.Millisecond)
|
time.Sleep(50 * time.Millisecond)
|
||||||
|
|
||||||
for d.busy() { // high = busy
|
for d.isBusy() { // high = busy
|
||||||
time.Sleep(10 * time.Millisecond)
|
time.Sleep(10 * time.Millisecond)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,6 @@ func (d *Device) Configure(c Config) error {
|
|||||||
d.cs = cs.Set
|
d.cs = cs.Set
|
||||||
d.dc = dc.Set
|
d.dc = dc.Set
|
||||||
d.rst = rst.Set
|
d.rst = rst.Set
|
||||||
d.busy = busy.Get
|
d.isBusy = busy.Get
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ type Device struct {
|
|||||||
cs drivers.PinOutput
|
cs drivers.PinOutput
|
||||||
dc drivers.PinOutput
|
dc drivers.PinOutput
|
||||||
rst drivers.PinOutput
|
rst drivers.PinOutput
|
||||||
busy drivers.PinInput
|
isBusy drivers.PinInput
|
||||||
logicalWidth int16
|
logicalWidth int16
|
||||||
width int16
|
width int16
|
||||||
height int16
|
height int16
|
||||||
@@ -67,11 +67,11 @@ func New(bus drivers.SPI, csPin, dcPin, rstPin legacy.PinOutput, busyPin legacy.
|
|||||||
legacy.ConfigurePinOut(rstPin)
|
legacy.ConfigurePinOut(rstPin)
|
||||||
legacy.ConfigurePinInput(busyPin)
|
legacy.ConfigurePinInput(busyPin)
|
||||||
return Device{
|
return Device{
|
||||||
bus: bus,
|
bus: bus,
|
||||||
cs: csPin.Set,
|
cs: csPin.Set,
|
||||||
dc: dcPin.Set,
|
dc: dcPin.Set,
|
||||||
rst: rstPin.Set,
|
rst: rstPin.Set,
|
||||||
busy: busyPin.Get,
|
isBusy: busyPin.Get,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -245,14 +245,14 @@ func (d *Device) setMemoryPointer(x int16, y int16) {
|
|||||||
|
|
||||||
// WaitUntilIdle waits until the display is ready
|
// WaitUntilIdle waits until the display is ready
|
||||||
func (d *Device) WaitUntilIdle() {
|
func (d *Device) WaitUntilIdle() {
|
||||||
for d.busy() {
|
for d.isBusy() {
|
||||||
time.Sleep(100 * time.Millisecond)
|
time.Sleep(100 * time.Millisecond)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsBusy returns the busy status of the display
|
// IsBusy returns the busy status of the display
|
||||||
func (d *Device) IsBusy() bool {
|
func (d *Device) IsBusy() bool {
|
||||||
return d.busy()
|
return d.isBusy()
|
||||||
}
|
}
|
||||||
|
|
||||||
// ClearBuffer sets the buffer to 0xFF (white)
|
// ClearBuffer sets the buffer to 0xFF (white)
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ type Device struct {
|
|||||||
cs drivers.PinOutput
|
cs drivers.PinOutput
|
||||||
dc drivers.PinOutput
|
dc drivers.PinOutput
|
||||||
rst drivers.PinOutput
|
rst drivers.PinOutput
|
||||||
busy drivers.PinInput
|
isBusy drivers.PinInput
|
||||||
logicalWidth int16
|
logicalWidth int16
|
||||||
width int16
|
width int16
|
||||||
height int16
|
height int16
|
||||||
@@ -46,11 +46,11 @@ func New(bus drivers.SPI, csPin, dcPin, rstPin legacy.PinOutput, busyPin legacy.
|
|||||||
legacy.ConfigurePinOut(rstPin)
|
legacy.ConfigurePinOut(rstPin)
|
||||||
legacy.ConfigurePinInput(busyPin)
|
legacy.ConfigurePinInput(busyPin)
|
||||||
return Device{
|
return Device{
|
||||||
bus: bus,
|
bus: bus,
|
||||||
cs: csPin.Set,
|
cs: csPin.Set,
|
||||||
dc: dcPin.Set,
|
dc: dcPin.Set,
|
||||||
rst: rstPin.Set,
|
rst: rstPin.Set,
|
||||||
busy: busyPin.Get,
|
isBusy: busyPin.Get,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -311,14 +311,14 @@ func (d *Device) ClearDisplay() {
|
|||||||
|
|
||||||
// WaitUntilIdle waits until the display is ready
|
// WaitUntilIdle waits until the display is ready
|
||||||
func (d *Device) WaitUntilIdle() {
|
func (d *Device) WaitUntilIdle() {
|
||||||
for d.busy() {
|
for d.isBusy() {
|
||||||
time.Sleep(100 * time.Millisecond)
|
time.Sleep(100 * time.Millisecond)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsBusy returns the busy status of the display
|
// IsBusy returns the busy status of the display
|
||||||
func (d *Device) IsBusy() bool {
|
func (d *Device) IsBusy() bool {
|
||||||
return d.busy()
|
return d.isBusy()
|
||||||
}
|
}
|
||||||
|
|
||||||
// ClearBuffer sets the buffer to 0xFF (white)
|
// ClearBuffer sets the buffer to 0xFF (white)
|
||||||
|
|||||||
Reference in New Issue
Block a user