Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Replaced DummyPin methods and properties #26

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Port of display drivers from https://github.com/adafruit/micropython-adafruit-rg

.. note:: This driver currently won't work on micropython.org firmware, instead you want the micropython-adafruit-rgb-display driver linked above!

This CircuitPython driver currently supports displays that use the following display-driver chips: HX8353, ILI9341, S6D02A1, SSD1331, SSD1351, and ST7735.
This CircuitPython driver currently supports displays that use the following display-driver chips: HX8353, HX8357, ILI9341, S6D02A1, ST7789, SSD1331, SSD1351, and ST7735.

Dependencies
=============
Expand Down Expand Up @@ -119,4 +119,4 @@ Now, once you have the virtual environment activated:

This will output the documentation to ``docs/_build/html``. Open the index.html in your browser to
view them. It will also (due to -W) error out on any warning like Travis will. This is a good way to
locally verify it will pass.
locally verify it will pass.
40 changes: 33 additions & 7 deletions adafruit_rgb_display/rgb.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,45 @@ def color565(r, g=0, b=0):


class DummyPin:
"""Can be used in place of a ``Pin()`` when you don't want to skip it."""
def init(self, *args, **kwargs):
"""Dummy Pin init"""
"""Can be used in place of a ``DigitalInOut()`` when you don't want to skip it."""
def deinit(self):
"""Dummy DigitalInOut deinit"""
pass

def low(self):
"""Dummy low Pin method"""
def switch_to_output(self, *args, **kwargs):
"""Dummy switch_to_output method"""
pass

def high(self):
"""Dummy high Pin method"""
def switch_to_input(self, *args, **kwargs):
"""Dummy switch_to_input method"""
pass

@property
def value(self):
"""Dummy value DigitalInOut property"""
pass

@value.setter
def value(self, val):
pass

@property
def direction(self):
"""Dummy direction DigitalInOut property"""
pass

@direction.setter
def direction(self, val):
pass

@property
def pull(self):
"""Dummy pull DigitalInOut property"""
pass

@pull.setter
def pull(self, val):
pass
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we could simply have those as class attributes, instead of properties — I suppose not worth the micro-optimization. Something like:

class DummyPin:
    value = None
    direction = None
    pull = None

    def deinit(...


class Display: #pylint: disable-msg=no-member
"""Base class for all RGB display devices
Expand Down