Skip to content

improving_docs #15

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 2 commits into from
Apr 25, 2021
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ _build
*.pyc
.env
bundles
.idea
21 changes: 10 additions & 11 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,22 +54,21 @@ To install in a virtual environment in your current project:
Usage Example
=============

.. code-block:: python
.. code-block:: python3

import time
import board
import busio
import adafruit_mprls
import time
import board
import adafruit_mprls

i2c = busio.I2C(board.SCL, board.SDA)
i2c = board.I2C()

# Simplest use, connect to default over I2C
mpr = adafruit_mprls.MPRLS(i2c, psi_min=0, psi_max=25)
# Simplest use, connect to default over I2C
mpr = adafruit_mprls.MPRLS(i2c, psi_min=0, psi_max=25)

while True:
print((mpr.pressure,))
time.sleep(1)

while True:
print((mpr.pressure,))
time.sleep(1)

Contributing
============
Expand Down
43 changes: 36 additions & 7 deletions adafruit_mprls.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@

**Hardware:**

* Adafruit `Adafruit MPRLS Ported Pressure Sensor Breakout
<https://www.adafruit.com/product/3965>`_ (Product ID: 3965)

**Software and Dependencies:**

* Adafruit CircuitPython firmware for the supported boards:
https://github.com/adafruit/circuitpython/releases
https://circuitpython.org/downloads

* Adafruit's Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice

Expand All @@ -41,12 +44,38 @@
class MPRLS:
"""
Driver base for the MPRLS pressure sensor
:param i2c_bus: The `busio.I2C` object to use. This is the only required parameter.
:param int addr: The optional I2C address, defaults to 0x18
:param microcontroller.Pin reset_pin: Optional digitalio pin for hardware resetting
:param microcontroller.Pin eoc_pin: Optional digitalio pin for getting End Of Conversion signal
:param float psi_min: The minimum pressure in PSI, defaults to 0
:param float psi_max: The maximum pressure in PSI, defaults to 25

:param ~busio.I2C i2c_bus: The I2C bus the MPRLS is connected to
:param int addr: The I2C device address. Defaults to :const:`0x18`
:param ~microcontroller.Pin reset_pin: Optional ``digitalio.pin`` for hardware resetting
:param ~microcontroller.Pin eoc_pin: Optional ``digitalio pin``
for getting End Of Conversion signal
:param float psi_min: The minimum pressure in PSI, defaults to :const:`0`
:param float psi_max: The maximum pressure in PSI, defaults to :const:`25`

**Quickstart: Importing and using the MPRLS**

Here is an example of using the :class:`MPRLS` class.
First you will need to import the libraries to use the sensor

.. code-block:: python

import board
import adafruit_mprls

Once this is done you can define your `board.I2C` object and define your sensor object

.. code-block:: python

i2c = board.I2C() # uses board.SCL and board.SDA
mpr = adafruit_mprls.MPRLS(i2c, psi_min=0, psi_max=25)

Now you have access to the :attr:`pressure` attribute

.. code-block:: python

pressure = mpr.pressure

"""

def __init__(
Expand Down
4 changes: 4 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,13 @@ Table of Contents
.. toctree::
:caption: Tutorials

Adafruit MPRLS Ported Pressure Sensor Breakout - 0 to 25 PSI Learning Guide <https://learn.adafruit.com/adafruit-mprls-ported-pressure-sensor-breakout>

.. toctree::
:caption: Related Products

Adafruit MPRLS Ported Pressure Sensor Breakout - 0 to 25 PSI <https://www.adafruit.com/product/3965>

.. toctree::
:caption: Other Links

Expand Down
3 changes: 1 addition & 2 deletions examples/mprls_simpletest.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@

import time
import board
import busio
import adafruit_mprls

i2c = busio.I2C(board.SCL, board.SDA)
i2c = board.I2C()

# Simplest use, connect to default over I2C
mpr = adafruit_mprls.MPRLS(i2c, psi_min=0, psi_max=25)
Expand Down