mirror of
https://github.com/wahyd4/Adafruit_Python_SSD1306.git
synced 2026-08-09 04:46:43 +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()
|
self._gpio = GPIO.get_platform_gpio()
|
||||||
# Setup reset pin.
|
# Setup reset pin.
|
||||||
self._rst = rst
|
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
|
# Handle hardware SPI
|
||||||
if spi is not None:
|
if spi is not None:
|
||||||
self._log.debug('Using hardware SPI')
|
self._log.debug('Using hardware SPI')
|
||||||
@@ -150,6 +151,8 @@ class SSD1306Base(object):
|
|||||||
|
|
||||||
def reset(self):
|
def reset(self):
|
||||||
"""Reset the display."""
|
"""Reset the display."""
|
||||||
|
if self._rst is None:
|
||||||
|
return
|
||||||
# Set reset high for a millisecond.
|
# Set reset high for a millisecond.
|
||||||
self._gpio.set_high(self._rst)
|
self._gpio.set_high(self._rst)
|
||||||
time.sleep(0.001)
|
time.sleep(0.001)
|
||||||
|
|||||||
Reference in New Issue
Block a user