From f535f0f02675ba101eb5a0979186ecbd086b1503 Mon Sep 17 00:00:00 2001 From: Kattni Rembor Date: Thu, 19 Sep 2019 19:57:29 -0400 Subject: [PATCH] Update repo. Fixes #44. --- README.rst | 3 +-- simpleio.py | 12 +++++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/README.rst b/README.rst index 9031033..b80335c 100644 --- a/README.rst +++ b/README.rst @@ -26,7 +26,7 @@ This driver depends on: Please ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloading -`the Adafruit library and driver bundle `_. +`the Adafruit library and driver bundle `_. Usage Example ============= @@ -86,4 +86,3 @@ 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. - diff --git a/simpleio.py b/simpleio.py index 8437dd9..61d7c04 100644 --- a/simpleio.py +++ b/simpleio.py @@ -46,11 +46,15 @@ except ImportError: pass # not always supported by every board! +__version__ = "0.0.0-auto.0" +__repo__ = "https://github.com/adafruit/CircuitPython_SimpleIO.git" + + def tone(pin, frequency, duration=1, length=100): """ Generates a square wave of the specified frequency on a pin - :param ~microcontroller.Pin Pin: Pin on which to output the tone + :param ~microcontroller.Pin pin: Pin on which to output the tone :param float frequency: Frequency of tone in Hz :param int length: Variable size buffer (optional) :param int duration: Duration of tone in seconds (optional) @@ -79,7 +83,6 @@ def tone(pin, frequency, duration=1, length=100): dac.stop() - def bitWrite(x, n, b): #pylint: disable-msg=invalid-name """ Based on the Arduino bitWrite function, changes a specific bit of a value to 0 or 1. @@ -97,7 +100,6 @@ def bitWrite(x, n, b): #pylint: disable-msg=invalid-name return x - def shift_in(data_pin, clock, msb_first=True): """ Shifts in a byte of data one bit at a time. Starts from either the LSB or @@ -127,6 +129,7 @@ def shift_in(data_pin, clock, msb_first=True): i += 1 return value + def shift_out(data_pin, clock, value, msb_first=True, bitcount=8): """ Shifts out a byte of data one bit at a time. Data gets written to a data @@ -194,6 +197,7 @@ def shift_out(data_pin, clock, value, msb_first=True, bitcount=8): clock.value = True clock.value = False + class DigitalOut: """ Simple digital output that is valid until reload. @@ -215,6 +219,7 @@ def value(self): def value(self, value): self.iopin.value = value + class DigitalIn: """ Simple digital input that is valid until reload. @@ -235,6 +240,7 @@ def value(self): def value(self, value): #pylint: disable-msg=no-self-use, unused-argument raise AttributeError("Cannot set the value on a digital input.") + def map_range(x, in_min, in_max, out_min, out_max): """ Maps a number from one range to another.