Skip to content

Commit d0c8b52

Browse files
author
funnygeeker
committed
修复:无法正常初始化的BUG
1 parent 565ac63 commit d0c8b52

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

driver/sh1106_buf.mpy

-22 Bytes
Binary file not shown.

driver/sh1106_buf.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
import time
12
import math
23
import framebuf
3-
import utime as time
44
from machine import Pin
55
from micropython import const
66

@@ -251,12 +251,13 @@ def __init__(self, width, height, i2c, res=None, addr=0x3c,
251251
rotate=0, external_vcc=False, delay=0):
252252
self.i2c = i2c
253253
self.addr = addr
254-
if res is not None:
254+
if res is None:
255+
self.res = None
256+
else:
255257
self.res = Pin(res, Pin.OUT, Pin.PULL_DOWN)
258+
256259
self.temp = bytearray(2)
257260
self.delay = delay
258-
if res is not None:
259-
res.init(res.OUT, value=1)
260261
super().__init__(width, height, external_vcc, rotate)
261262

262263
def write_cmd(self, cmd):
@@ -275,7 +276,9 @@ class SH1106_SPI(SH1106):
275276
def __init__(self, width, height, spi, dc, res=None, cs=None,
276277
rotate=0, external_vcc=False, delay=0):
277278
self.spi = spi
278-
if res is not None:
279+
if res is None:
280+
self.res = res
281+
else:
279282
self.res = Pin(res, Pin.OUT, Pin.PULL_DOWN)
280283
self.dc = Pin(dc, Pin.OUT, Pin.PULL_DOWN)
281284
if cs is None:

0 commit comments

Comments
 (0)