Skip to content

Commit d06971c

Browse files
Merge pull request #15 from jposada202020/improving_docs
improving_docs
2 parents 469940d + d27719e commit d06971c

File tree

5 files changed

+52
-20
lines changed

5 files changed

+52
-20
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ _build
77
*.pyc
88
.env
99
bundles
10+
.idea

README.rst

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -54,22 +54,21 @@ To install in a virtual environment in your current project:
5454
Usage Example
5555
=============
5656

57-
.. code-block:: python
57+
.. code-block:: python3
5858
59-
import time
60-
import board
61-
import busio
62-
import adafruit_mprls
59+
import time
60+
import board
61+
import adafruit_mprls
6362
64-
i2c = busio.I2C(board.SCL, board.SDA)
63+
i2c = board.I2C()
6564
66-
# Simplest use, connect to default over I2C
67-
mpr = adafruit_mprls.MPRLS(i2c, psi_min=0, psi_max=25)
65+
# Simplest use, connect to default over I2C
66+
mpr = adafruit_mprls.MPRLS(i2c, psi_min=0, psi_max=25)
6867
68+
while True:
69+
print((mpr.pressure,))
70+
time.sleep(1)
6971
70-
while True:
71-
print((mpr.pressure,))
72-
time.sleep(1)
7372
7473
Contributing
7574
============

adafruit_mprls.py

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,13 @@
1515
1616
**Hardware:**
1717
18+
* Adafruit `Adafruit MPRLS Ported Pressure Sensor Breakout
19+
<https://www.adafruit.com/product/3965>`_ (Product ID: 3965)
20+
1821
**Software and Dependencies:**
1922
2023
* Adafruit CircuitPython firmware for the supported boards:
21-
https://github.com/adafruit/circuitpython/releases
24+
https://circuitpython.org/downloads
2225
2326
* Adafruit's Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
2427
@@ -41,12 +44,38 @@
4144
class MPRLS:
4245
"""
4346
Driver base for the MPRLS pressure sensor
44-
:param i2c_bus: The `busio.I2C` object to use. This is the only required parameter.
45-
:param int addr: The optional I2C address, defaults to 0x18
46-
:param microcontroller.Pin reset_pin: Optional digitalio pin for hardware resetting
47-
:param microcontroller.Pin eoc_pin: Optional digitalio pin for getting End Of Conversion signal
48-
:param float psi_min: The minimum pressure in PSI, defaults to 0
49-
:param float psi_max: The maximum pressure in PSI, defaults to 25
47+
48+
:param ~busio.I2C i2c_bus: The I2C bus the MPRLS is connected to
49+
:param int addr: The I2C device address. Defaults to :const:`0x18`
50+
:param ~microcontroller.Pin reset_pin: Optional ``digitalio.pin`` for hardware resetting
51+
:param ~microcontroller.Pin eoc_pin: Optional ``digitalio pin``
52+
for getting End Of Conversion signal
53+
:param float psi_min: The minimum pressure in PSI, defaults to :const:`0`
54+
:param float psi_max: The maximum pressure in PSI, defaults to :const:`25`
55+
56+
**Quickstart: Importing and using the MPRLS**
57+
58+
Here is an example of using the :class:`MPRLS` class.
59+
First you will need to import the libraries to use the sensor
60+
61+
.. code-block:: python
62+
63+
import board
64+
import adafruit_mprls
65+
66+
Once this is done you can define your `board.I2C` object and define your sensor object
67+
68+
.. code-block:: python
69+
70+
i2c = board.I2C() # uses board.SCL and board.SDA
71+
mpr = adafruit_mprls.MPRLS(i2c, psi_min=0, psi_max=25)
72+
73+
Now you have access to the :attr:`pressure` attribute
74+
75+
.. code-block:: python
76+
77+
pressure = mpr.pressure
78+
5079
"""
5180

5281
def __init__(

docs/index.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,13 @@ Table of Contents
2323
.. toctree::
2424
:caption: Tutorials
2525

26+
Adafruit MPRLS Ported Pressure Sensor Breakout - 0 to 25 PSI Learning Guide <https://learn.adafruit.com/adafruit-mprls-ported-pressure-sensor-breakout>
27+
2628
.. toctree::
2729
:caption: Related Products
2830

31+
Adafruit MPRLS Ported Pressure Sensor Breakout - 0 to 25 PSI <https://www.adafruit.com/product/3965>
32+
2933
.. toctree::
3034
:caption: Other Links
3135

examples/mprls_simpletest.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@
33

44
import time
55
import board
6-
import busio
76
import adafruit_mprls
87

9-
i2c = busio.I2C(board.SCL, board.SDA)
8+
i2c = board.I2C()
109

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

0 commit comments

Comments
 (0)