Select OLED settings based on platform

* Use platform name to determine if the platform is Mendel Linux.
  If so, use Coral Dev Board valeus and RPi.GPIO wrapper for
  periphery. Otherwise, assume Pi and use defaults for Luma.
* Run autopep8 on coral-enviro

Change-Id: I035d2a4bf17ebb79a4180f65d9c4f6791badba6e
diff --git a/python/coral-enviro/coral/enviro/__init__.py b/python/coral-enviro/coral/enviro/__init__.py
index e229742..1df472c 100644
--- a/python/coral-enviro/coral/enviro/__init__.py
+++ b/python/coral-enviro/coral/enviro/__init__.py
@@ -11,4 +11,3 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
-
diff --git a/python/coral-enviro/coral/enviro/board.py b/python/coral-enviro/coral/enviro/board.py
index e876b5c..abf71ba 100644
--- a/python/coral-enviro/coral/enviro/board.py
+++ b/python/coral-enviro/coral/enviro/board.py
@@ -15,6 +15,7 @@
 """Drivers for shared functionality provided by the Environment Bonnet."""
 
 import os
+import platform
 from luma.core.interface.serial import noop, spi
 from luma.oled.device import ssd1306
 
@@ -46,6 +47,7 @@
     except FileNotFoundError:
         return None
 
+
 class EnviroBoard():
     """
     An interface for all input and output modules on the Environmental Sensor Board.
@@ -57,8 +59,15 @@
         self._opt3002 = _get_path('opt3001')
         self._tla2021 = _get_path('ads1015')
         # Create SSD1306 OLED instance, with SPI as the interface.
-        self._display = ssd1306(serial_interface=spi(),
-                                gpio=noop(), height=32, rotate=2)
+        if 'mendel' in platform.platform():
+            from .rpi_gpio_periphery import pGPIO
+            # Values for the Coral Dev Board (running Mendel Linux).
+            self._display = ssd1306(serial_interface=spi(gpio=pGPIO(), port=32766, device=0, gpio_DC=138, gpio_RST=140),
+                                    gpio=pGPIO(), height=32, rotate=2)
+        else:
+            # Default to RPi.GPIO in luma and defaults GPIO.
+            self._display = ssd1306(serial_interface=spi(),
+                                    gpio=noop(), height=32, rotate=2)
 
     @property
     def temperature(self):
diff --git a/python/coral-enviro/coral/enviro/rpi_gpio_periphery.py b/python/coral-enviro/coral/enviro/rpi_gpio_periphery.py
index 28b884b..1666958 100644
--- a/python/coral-enviro/coral/enviro/rpi_gpio_periphery.py
+++ b/python/coral-enviro/coral/enviro/rpi_gpio_periphery.py
@@ -26,18 +26,18 @@
     _gpios = dict()
 
     def setup(self, channels, mode):
-       if isinstance(channels, (list,tuple)):
-           for i in channels:
-               self._gpios[i] = GPIO(i, mode)
-       else:
-           self._gpios[channels] = GPIO(channels, mode)
+        if isinstance(channels, (list, tuple)):
+            for i in channels:
+                self._gpios[i] = GPIO(i, mode)
+        else:
+            self._gpios[channels] = GPIO(channels, mode)
 
     def output(self, channels, level):
-       if isinstance(channels, (list, tuple)):
-           for i in channels:
-               self._gpios[i].write(level)
-       else:
-           self._gpios[channels].write(level)
+        if isinstance(channels, (list, tuple)):
+            for i in channels:
+                self._gpios[i].write(level)
+        else:
+            self._gpios[channels].write(level)
 
     def input(self, channel):
-       return self._gpios[channel].read()
+        return self._gpios[channel].read()