From 8b6e8c81e3945344fa60a159c1de16732204c593 Mon Sep 17 00:00:00 2001 From: Patricio Whittingslow Date: Tue, 16 Sep 2025 09:49:45 -0300 Subject: [PATCH] rename busy fields to isBusy --- hd44780/hd44780.go | 10 +++++----- uc8151/uc8151.go | 16 ++++++++-------- waveshare-epd/epd1in54/epd1in54.go | 8 ++++---- waveshare-epd/epd2in13/epd2in13.go | 16 ++++++++-------- waveshare-epd/epd2in13x/epd2in13x.go | 16 ++++++++-------- waveshare-epd/epd2in66b/dev.go | 12 ++++++------ waveshare-epd/epd2in66b/dev_baremetal.go | 2 +- waveshare-epd/epd2in9/epd2in9.go | 16 ++++++++-------- waveshare-epd/epd4in2/epd4in2.go | 16 ++++++++-------- 9 files changed, 56 insertions(+), 56 deletions(-) diff --git a/hd44780/hd44780.go b/hd44780/hd44780.go index 111f70d..2cf2c0a 100644 --- a/hd44780/hd44780.go +++ b/hd44780/hd44780.go @@ -210,7 +210,7 @@ func (d *Device) SendCommand(command byte) { d.bus.SetCommandMode(true) 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.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 -func (d *Device) busy(longDelay bool) bool { +func (d *Device) isBusy(longDelay bool) bool { if d.bus.WriteOnly() { // Can't read busy flag if write only, so sleep a bit then return if longDelay { @@ -261,7 +261,7 @@ func (d *Device) busy(longDelay bool) bool { // Busy returns true when hd447890 is busy func (d *Device) Busy() bool { - return d.busy(false) + return d.isBusy(false) } // Size returns the current size of the display. diff --git a/uc8151/uc8151.go b/uc8151/uc8151.go index bee7c56..bf6f4ce 100644 --- a/uc8151/uc8151.go +++ b/uc8151/uc8151.go @@ -34,7 +34,7 @@ type Device struct { cs drivers.PinOutput dc drivers.PinOutput rst drivers.PinOutput - busy drivers.PinInput + isBusy drivers.PinInput width int16 height int16 buffer []uint8 @@ -55,11 +55,11 @@ func New(bus drivers.SPI, csPin, dcPin, rstPin legacy.PinOutput, busyPin legacy. legacy.ConfigurePinOut(rstPin) legacy.ConfigurePinInput(busyPin) return Device{ - bus: bus, - cs: csPin.Set, - dc: dcPin.Set, - rst: rstPin.Set, - busy: busyPin.Get, + bus: bus, + cs: csPin.Set, + dc: dcPin.Set, + rst: rstPin.Set, + isBusy: busyPin.Get, } } @@ -313,14 +313,14 @@ func (d *Device) ClearDisplay() { // WaitUntilIdle waits until the display is ready func (d *Device) WaitUntilIdle() { - for !d.busy() { + for !d.isBusy() { time.Sleep(10 * time.Millisecond) } } // IsBusy returns the busy status of the display func (d *Device) IsBusy() bool { - return d.busy() + return d.isBusy() } // ClearBuffer sets the buffer to 0xFF (white) diff --git a/waveshare-epd/epd1in54/epd1in54.go b/waveshare-epd/epd1in54/epd1in54.go index 38e4702..b228c6b 100644 --- a/waveshare-epd/epd1in54/epd1in54.go +++ b/waveshare-epd/epd1in54/epd1in54.go @@ -29,7 +29,7 @@ type Device struct { cs drivers.PinOutput dc drivers.PinOutput rst drivers.PinOutput - busy drivers.PinInput + isBusy drivers.PinInput configurePins func() buffer []uint8 rotation Rotation @@ -89,7 +89,7 @@ func New(bus *machine.SPI, csPin, dcPin, rstPin legacy.PinOutput, busyPin legacy cs: csPin.Set, dc: dcPin.Set, rst: rstPin.Set, - busy: busyPin.Get, + isBusy: busyPin.Get, configurePins: func() { legacy.ConfigurePinOut(csPin) legacy.ConfigurePinOut(dcPin) @@ -378,7 +378,7 @@ func (d *Device) Clear() { // WaitUntilIdle waits until the display is ready func (d *Device) WaitUntilIdle() { - for d.busy() { + for d.isBusy() { time.Sleep(100 * time.Millisecond) } time.Sleep(200 * time.Millisecond) @@ -386,7 +386,7 @@ func (d *Device) WaitUntilIdle() { // IsBusy returns the busy status of the display func (d *Device) IsBusy() bool { - return d.busy() + return d.isBusy() } // ClearBuffer sets the buffer to 0xFF (white) diff --git a/waveshare-epd/epd2in13/epd2in13.go b/waveshare-epd/epd2in13/epd2in13.go index 6fd089a..23873d9 100644 --- a/waveshare-epd/epd2in13/epd2in13.go +++ b/waveshare-epd/epd2in13/epd2in13.go @@ -24,7 +24,7 @@ type Device struct { cs drivers.PinOutput dc drivers.PinOutput rst drivers.PinOutput - busy drivers.PinInput + isBusy drivers.PinInput logicalWidth int16 width int16 height int16 @@ -59,11 +59,11 @@ func New(bus drivers.SPI, csPin, dcPin, rstPin legacy.PinOutput, busyPin legacy. legacy.ConfigurePinOut(rstPin) legacy.ConfigurePinInput(busyPin) return Device{ - bus: bus, - cs: csPin.Set, - dc: dcPin.Set, - rst: rstPin.Set, - busy: busyPin.Get, + bus: bus, + cs: csPin.Set, + dc: dcPin.Set, + rst: rstPin.Set, + isBusy: busyPin.Get, } } @@ -298,14 +298,14 @@ func (d *Device) setMemoryPointer(x int16, y int16) { // WaitUntilIdle waits until the display is ready func (d *Device) WaitUntilIdle() { - for d.busy() { + for d.isBusy() { time.Sleep(100 * time.Millisecond) } } // IsBusy returns the busy status of the display func (d *Device) IsBusy() bool { - return d.busy() + return d.isBusy() } // ClearBuffer sets the buffer to 0xFF (white) diff --git a/waveshare-epd/epd2in13x/epd2in13x.go b/waveshare-epd/epd2in13x/epd2in13x.go index ee3fc61..a5f0836 100644 --- a/waveshare-epd/epd2in13x/epd2in13x.go +++ b/waveshare-epd/epd2in13x/epd2in13x.go @@ -23,7 +23,7 @@ type Device struct { cs drivers.PinOutput dc drivers.PinOutput rst drivers.PinOutput - busy drivers.PinInput + isBusy drivers.PinInput width int16 height int16 buffer [][]uint8 @@ -39,11 +39,11 @@ func New(bus drivers.SPI, csPin, dcPin, rstPin legacy.PinOutput, busyPin legacy. legacy.ConfigurePinOut(rstPin) legacy.ConfigurePinInput(busyPin) return Device{ - bus: bus, - cs: csPin.Set, - dc: dcPin.Set, - rst: rstPin.Set, - busy: busyPin.Get, + bus: bus, + cs: csPin.Set, + dc: dcPin.Set, + rst: rstPin.Set, + isBusy: busyPin.Get, } } @@ -277,14 +277,14 @@ func (d *Device) ClearDisplay() { // WaitUntilIdle waits until the display is ready func (d *Device) WaitUntilIdle() { - for !d.busy() { + for !d.isBusy() { time.Sleep(100 * time.Millisecond) } } // IsBusy returns the busy status of the display func (d *Device) IsBusy() bool { - return d.busy() + return d.isBusy() } // ClearBuffer sets the buffer to 0xFF (white) diff --git a/waveshare-epd/epd2in66b/dev.go b/waveshare-epd/epd2in66b/dev.go index 86b93ae..64c1b38 100644 --- a/waveshare-epd/epd2in66b/dev.go +++ b/waveshare-epd/epd2in66b/dev.go @@ -18,11 +18,11 @@ const ( const Baudrate = 4_000_000 // 4 MHz type Device struct { - bus drivers.SPI - cs drivers.PinOutput - dc drivers.PinOutput - rst drivers.PinOutput - busy drivers.PinInput + bus drivers.SPI + cs drivers.PinOutput + dc drivers.PinOutput + rst drivers.PinOutput + isBusy drivers.PinInput blackBuffer []byte redBuffer []byte @@ -206,7 +206,7 @@ func (d *Device) WaitUntilIdle() { // give it some time to get busy time.Sleep(50 * time.Millisecond) - for d.busy() { // high = busy + for d.isBusy() { // high = busy time.Sleep(10 * time.Millisecond) } diff --git a/waveshare-epd/epd2in66b/dev_baremetal.go b/waveshare-epd/epd2in66b/dev_baremetal.go index 7fa4a56..cb8356e 100644 --- a/waveshare-epd/epd2in66b/dev_baremetal.go +++ b/waveshare-epd/epd2in66b/dev_baremetal.go @@ -25,6 +25,6 @@ func (d *Device) Configure(c Config) error { d.cs = cs.Set d.dc = dc.Set d.rst = rst.Set - d.busy = busy.Get + d.isBusy = busy.Get return nil } diff --git a/waveshare-epd/epd2in9/epd2in9.go b/waveshare-epd/epd2in9/epd2in9.go index 9abdb77..4b5f9a7 100644 --- a/waveshare-epd/epd2in9/epd2in9.go +++ b/waveshare-epd/epd2in9/epd2in9.go @@ -31,7 +31,7 @@ type Device struct { cs drivers.PinOutput dc drivers.PinOutput rst drivers.PinOutput - busy drivers.PinInput + isBusy drivers.PinInput logicalWidth int16 width int16 height int16 @@ -67,11 +67,11 @@ func New(bus drivers.SPI, csPin, dcPin, rstPin legacy.PinOutput, busyPin legacy. legacy.ConfigurePinOut(rstPin) legacy.ConfigurePinInput(busyPin) return Device{ - bus: bus, - cs: csPin.Set, - dc: dcPin.Set, - rst: rstPin.Set, - busy: busyPin.Get, + bus: bus, + cs: csPin.Set, + dc: dcPin.Set, + rst: rstPin.Set, + isBusy: busyPin.Get, } } @@ -245,14 +245,14 @@ func (d *Device) setMemoryPointer(x int16, y int16) { // WaitUntilIdle waits until the display is ready func (d *Device) WaitUntilIdle() { - for d.busy() { + for d.isBusy() { time.Sleep(100 * time.Millisecond) } } // IsBusy returns the busy status of the display func (d *Device) IsBusy() bool { - return d.busy() + return d.isBusy() } // ClearBuffer sets the buffer to 0xFF (white) diff --git a/waveshare-epd/epd4in2/epd4in2.go b/waveshare-epd/epd4in2/epd4in2.go index a731545..24ee273 100644 --- a/waveshare-epd/epd4in2/epd4in2.go +++ b/waveshare-epd/epd4in2/epd4in2.go @@ -28,7 +28,7 @@ type Device struct { cs drivers.PinOutput dc drivers.PinOutput rst drivers.PinOutput - busy drivers.PinInput + isBusy drivers.PinInput logicalWidth int16 width int16 height int16 @@ -46,11 +46,11 @@ func New(bus drivers.SPI, csPin, dcPin, rstPin legacy.PinOutput, busyPin legacy. legacy.ConfigurePinOut(rstPin) legacy.ConfigurePinInput(busyPin) return Device{ - bus: bus, - cs: csPin.Set, - dc: dcPin.Set, - rst: rstPin.Set, - busy: busyPin.Get, + bus: bus, + cs: csPin.Set, + dc: dcPin.Set, + rst: rstPin.Set, + isBusy: busyPin.Get, } } @@ -311,14 +311,14 @@ func (d *Device) ClearDisplay() { // WaitUntilIdle waits until the display is ready func (d *Device) WaitUntilIdle() { - for d.busy() { + for d.isBusy() { time.Sleep(100 * time.Millisecond) } } // IsBusy returns the busy status of the display func (d *Device) IsBusy() bool { - return d.busy() + return d.isBusy() } // ClearBuffer sets the buffer to 0xFF (white)