Skip to content

Commit 189b1ef

Browse files
authored
Merge pull request #17 from 2bndy5/master
now renders API Reference page correctly
2 parents 403c063 + bf64800 commit 189b1ef

File tree

9 files changed

+39
-29
lines changed

9 files changed

+39
-29
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ bundles
99
*.DS_Store
1010
.eggs
1111
dist
12-
**/*.egg-info
12+
**/*.egg-info

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ MCP3004 Single-Ended
109109
mcp = MCP.MCP3004(spi, cs)
110110
111111
# create an analog input channel on pin 0
112-
chan = AnalogIn(mcp, MCP.P0, MCP.P1)
112+
chan = AnalogIn(mcp, MCP.P0)
113113
114114
print('Raw ADC Value: ', chan.value)
115115
print('ADC Voltage: ' + str(chan.voltage) + 'V')

adafruit_mcp3xxx/analog_in.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,27 +20,23 @@
2020
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2121
# THE SOFTWARE.
2222
"""
23-
`analog_in`
24-
==============================
23+
:py:class:`~adafruit_mcp3xxx.analog_in.AnalogIn`
24+
======================================================
2525
AnalogIn for single-ended and
2626
differential ADC readings.
2727
2828
* Author(s): Brent Rubell
2929
"""
3030

3131
class AnalogIn():
32-
"""AnalogIn Mock Implementation for ADC Reads."""
32+
"""AnalogIn Mock Implementation for ADC Reads.
3333
34-
def __getitem__(self, key):
35-
return self._channels[self._pins[key]]
34+
:param ~mcp3004.MCP3004,~mcp3008.MCP3008 mcp: The mcp object.
35+
:param int positive_pin: Required pin for single-ended.
36+
:param int negative_pin: Optional pin for differential reads.
3637
38+
"""
3739
def __init__(self, mcp, positive_pin, negative_pin=None):
38-
"""AnalogIn
39-
40-
:param mcp: The mcp object.
41-
:param ~digitalio.DigitalInOut positive_pin: Required pin for single-ended.
42-
:param ~digitalio.DigitalInOut negative_pin: Optional pin for differential reads.
43-
"""
4440
self._mcp = mcp
4541
self._pin_setting = positive_pin
4642
self._negative_pin = negative_pin
@@ -55,6 +51,9 @@ def __init__(self, mcp, positive_pin, negative_pin=None):
5551
self._pin_setting = self._pins.get((self._pin_setting, self._negative_pin),
5652
"Difference pin not found.")
5753

54+
def __getitem__(self, key):
55+
return self._channels[self._pins[key]]
56+
5857
@property
5958
def value(self):
6059
"""Returns the value of an ADC pin as an integer."""

adafruit_mcp3xxx/mcp3004.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2121
# THE SOFTWARE.
2222
"""
23-
`mcp3004.py`
23+
:py:class:`~adafruit_mcp3xxx.mcp3004.MCP3004`
2424
================================================
2525
MCP3004 4-channel, 10-bit, analog-to-digital
2626
converter instance.

adafruit_mcp3xxx/mcp3008.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2121
# THE SOFTWARE.
2222
"""
23-
`mcp3008.py`
24-
=============================================
23+
:py:class:`~adafruit_mcp3xxx.mcp3008.MCP3008`
24+
=============================================================
2525
MCP3008 8-channel, 10-bit, analog-to-digital
2626
converter instance.
2727

adafruit_mcp3xxx/mcp3xxx.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2121
# THE SOFTWARE.
2222
"""
23-
`adafruit_mcp3xxx.py`
24-
================================================
23+
:py:class:`~adafruit_mcp3xxx.adafruit_mcp3xxx.MCP3xxx`
24+
============================================================
2525
2626
CircuitPython Library for MCP3xxx ADCs with SPI
2727
@@ -59,10 +59,10 @@ class MCP3xxx:
5959
"""
6060
MCP3xxx Interface.
6161
62-
params:
63-
:param ~busdevice.SPIDevice spi_bus: SPI bus the ADC is connected to.
64-
:param ~digitalio.DigitalInOut cs: Chip Select Pin.
65-
:param float ref_voltage: Voltage into (Vin) the ADC.
62+
:param ~adafruit_bus_device.spi_device.SPIDevice spi_bus: SPI bus the ADC is connected to.
63+
:param ~digitalio.DigitalInOut cs: Chip Select Pin.
64+
:param float ref_voltage: Voltage into (Vin) the ADC.
65+
6666
"""
6767
def __init__(self, spi_bus, cs, ref_voltage=3.3):
6868
self._spi_device = SPIDevice(spi_bus, cs)
@@ -78,9 +78,9 @@ def reference_voltage(self):
7878
def read(self, pin, is_differential=False):
7979
"""SPI Interface for MCP3xxx-based ADCs reads.
8080
81-
params:
82-
:param pin: individual or differential pin.
83-
:param bool is_differential: single-ended or differential read.
81+
:param int pin: individual or differential pin.
82+
:param bool is_differential: single-ended or differential read.
83+
8484
"""
8585
command = (_MCP30084_DIFF_READ if is_differential else _MCP30084_SINGLE_READ) << 6
8686
command |= pin << 3

docs/api.rst

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
API
22
------------
33

4-
.. automodule:: adafruit_mcp3xxx
5-
:members:
4+
.. automodule:: adafruit_mcp3xxx.mcp3xxx
5+
:members:
6+
7+
.. automodule:: adafruit_mcp3xxx.mcp3004
8+
:members:
9+
:show-inheritance:
10+
11+
.. automodule:: adafruit_mcp3xxx.mcp3008
12+
:members:
13+
:show-inheritance:
14+
15+
.. automodule:: adafruit_mcp3xxx.analog_in
16+
:members:

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
# Uncomment the below if you use native CircuitPython modules such as
2121
# digitalio, micropython and busio. List the modules you use. Without it, the
2222
# autodoc module docs will fail to generate with a warning.
23-
# autodoc_mock_imports = ["digitalio", "busio"]
23+
autodoc_mock_imports = ["busio"]
2424

2525

2626
intersphinx_mapping = {'python': ('https://docs.python.org/3.4', None),'BusDevice': ('https://circuitpython.readthedocs.io/projects/busdevice/en/latest/', None),'CircuitPython': ('https://circuitpython.readthedocs.io/en/latest/', None)}

examples/mcp3xxx_mcp3004_single_ended_simpletest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
mcp = MCP.MCP3004(spi, cs)
1515

1616
# create an analog input channel on pin 0
17-
chan = AnalogIn(mcp, MCP.P0, MCP.P1)
17+
chan = AnalogIn(mcp, MCP.P0)
1818

1919
print('Raw ADC Value: ', chan.value)
2020
print('ADC Voltage: ' + str(chan.voltage) + 'V')

0 commit comments

Comments
 (0)