mirror of
https://github.com/wahyd4/Adafruit_Python_SSD1306.git
synced 2026-08-08 20:37:34 +10:00
Make it optional to use the RST pin
Without RST can run without 'root' by adding the desired user to the I2C group (e.g.: adduser pi i2c)
This commit is contained in:
@@ -85,7 +85,8 @@ class SSD1306Base(object):
|
||||
self._gpio = GPIO.get_platform_gpio()
|
||||
# Setup reset pin.
|
||||
self._rst = rst
|
||||
self._gpio.setup(self._rst, GPIO.OUT)
|
||||
if not self._rst is None:
|
||||
self._gpio.setup(self._rst, GPIO.OUT)
|
||||
# Handle hardware SPI
|
||||
if spi is not None:
|
||||
self._log.debug('Using hardware SPI')
|
||||
@@ -150,6 +151,8 @@ class SSD1306Base(object):
|
||||
|
||||
def reset(self):
|
||||
"""Reset the display."""
|
||||
if self._rst is None:
|
||||
return
|
||||
# Set reset high for a millisecond.
|
||||
self._gpio.set_high(self._rst)
|
||||
time.sleep(0.001)
|
||||
|
||||
Reference in New Issue
Block a user