Skip to content

Update repo. #47

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
Sep 19, 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
3 changes: 1 addition & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://github.com/adafruit/Adafruit_CircuitPython_Bundle>`_.
`the Adafruit library and driver bundle <https://circuitpython.org/libraries>`_.

Usage Example
=============
Expand Down Expand Up @@ -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.

12 changes: 9 additions & 3 deletions simpleio.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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.
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand All @@ -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.
Expand All @@ -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.
Expand Down