From 42e45c8d0d880b3a8a34127af63847dc355b3c03 Mon Sep 17 00:00:00 2001 From: Sylvan Butler Date: Tue, 2 Aug 2016 21:52:18 -0600 Subject: [PATCH] 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) --- Adafruit_SSD1306/SSD1306.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Adafruit_SSD1306/SSD1306.py b/Adafruit_SSD1306/SSD1306.py index f4ee132..c557956 100644 --- a/Adafruit_SSD1306/SSD1306.py +++ b/Adafruit_SSD1306/SSD1306.py @@ -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)