Skip to content

Commit 3ae2878

Browse files
authored
将PWM.duty替换成了PWM.duty_u16 (#2)
* Update st7735_buf.py In pi pico , PWM.duty is not defined rather PWM.duty_u16 Thus if you use st7735 driver there will throw a error that AttributeError: type object 'PWM' has no attribute 'duty' fixed duty(1023) to duty_u16(1023) * Update st7735_spi.py * Update st7789_buf.py * Update st7789_spi.py
1 parent 88dca1e commit 3ae2878

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

driver/st7735_buf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ def __init__(self, width: int, height: int, spi, res: int, dc: int,
144144
self.cs = Pin(cs, Pin.OUT, Pin.PULL_DOWN)
145145
if bl is not None:
146146
self.bl = PWM(Pin(bl, Pin.OUT))
147-
self.bl.duty(1023)
147+
self.bl.duty_u16(1023)
148148
else:
149149
self.bl = None
150150
self._rotate = rotate

driver/st7735_spi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ def __init__(self, width: int, height: int, spi, res: int, dc: int,
142142
self.cs = Pin(cs, Pin.OUT, Pin.PULL_DOWN)
143143
if bl is not None:
144144
self.bl = PWM(Pin(bl, Pin.OUT))
145-
self.bl.duty(1023)
145+
self.bl.duty_u16(1023)
146146
else:
147147
self.bl = None
148148
self._rotate = rotate

driver/st7789_buf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ def __init__(self, width: int, height: int, spi, res: int, dc: int,
179179
self.cs = Pin(cs, Pin.OUT, Pin.PULL_DOWN)
180180
if bl is not None:
181181
self.bl = PWM(Pin(bl, Pin.OUT))
182-
self.bl.duty(1023)
182+
self.bl.duty_u16(1023)
183183
else:
184184
self.bl = None
185185
self._rotate = rotate

driver/st7789_spi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ def __init__(self, width: int, height: int, spi, res: int, dc: int,
177177
self.cs = Pin(cs, Pin.OUT, Pin.PULL_DOWN)
178178
if bl is not None:
179179
self.bl = PWM(Pin(bl, Pin.OUT))
180-
self.bl.duty(1023)
180+
self.bl.duty_u16(1023)
181181
else:
182182
self.bl = None
183183
self._rotate = rotate

0 commit comments

Comments
 (0)