Skip to content
Merged
Prev Previous commit
Next Next commit
documenting base class again
  • Loading branch information
2bndy5 committed Oct 9, 2019
commit bee5f0721669670b93c7c43ea25e804cf62f1fa0
2 changes: 1 addition & 1 deletion adafruit_mcp3xxx/analog_in.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class AnalogIn():

:param ~mcp3004.MCP3004,~mcp3008.MCP3008 mcp: The mcp object.
:param ~digitalio.DigitalInOut positive_pin: Required pin for single-ended.
:param ~digitalio.DigitalInOut negative_pin: Optional pin for differential reads.
:param ~mcp3xxx.MCP3xxx.DIFF_PINS negative_pin: Optional pin for differential reads.

"""
def __init__(self, mcp, positive_pin, negative_pin=None):
Expand Down
8 changes: 1 addition & 7 deletions adafruit_mcp3xxx/mcp3002.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,12 @@ class MCP3002(MCP3xxx):
- 0: CH0 = IN+, CH1 = IN-
- 1: CH1 = IN+, CH0 = IN-
"""
MCP3002_DIFF_PINS = {
DIFF_PINS = {
(0, 1) : P0,
(1, 0) : P1
}

def read(self, pin, is_differential=False):
"""SPI Interface for MCP3xxx-based ADCs reads.

:param int pin: individual or differential pin.
:param bool is_differential: single-ended or differential read.

"""
command = (_MCP3002_DIFF_READ if is_differential else _MCP3002_SINGLE_READ) << 6
command |= pin << 3
self._out_buf[0] = command
Expand Down
2 changes: 1 addition & 1 deletion adafruit_mcp3xxx/mcp3004.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class MCP3004(MCP3xxx):
- 2: CH2 = IN+, CH3 = IN-
- 3: CH3 = IN+, CH2 = IN-
"""
MCP3004_DIFF_PINS = {
DIFF_PINS = {
(0, 1) : P0,
(1, 0) : P1,
(2, 3) : P2,
Expand Down
2 changes: 1 addition & 1 deletion adafruit_mcp3xxx/mcp3008.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class MCP3008(MCP3xxx):
- 6: CH6 = IN+, CH7 = IN-
- 7: CH7 = IN+, CH6 = IN-
"""
MCP3008_DIFF_PINS = {
DIFF_PINS = {
(0, 1) : P0,
(1, 0) : P1,
(2, 3) : P2,
Expand Down
2 changes: 2 additions & 0 deletions adafruit_mcp3xxx/mcp3xxx.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ def __init__(self, spi_bus, cs, ref_voltage=3.3):
self._in_buf = bytearray(3)
self._ref_voltage = ref_voltage

DIFF_PINS = {}

@property
def reference_voltage(self):
"""Returns the MCP3xxx's reference voltage."""
Expand Down
12 changes: 10 additions & 2 deletions docs/api.rst
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
API
------------

.. automodule:: adafruit_mcp3xxx.mcp3xxx
:members:

.. automodule:: adafruit_mcp3xxx.analog_in
:members:

.. automodule:: adafruit_mcp3xxx.mcp3002
:members:
:show-inheritance:
:exclude-members: read

.. automodule:: adafruit_mcp3xxx.mcp3004
:members:
:inherited-members:
:show-inheritance:

.. automodule:: adafruit_mcp3xxx.mcp3008
:members:
:inherited-members:
:show-inheritance: