Skip to content

Fix documentation #79

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
Mar 29, 2022
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
4 changes: 4 additions & 0 deletions adafruit_ads1x15/ads1015.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,13 @@

# Pins
P0 = 0
"""Analog Pin 0"""
P1 = 1
"""Analog Pin 1"""
P2 = 2
"""Analog Pin 2"""
P3 = 3
"""Analog Pin 3"""


class ADS1015(ADS1x15):
Expand Down
4 changes: 4 additions & 0 deletions adafruit_ads1x15/ads1115.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,13 @@

# Pins
P0 = 0
"""Analog Pin 0"""
P1 = 1
"""Analog Pin 1"""
P2 = 2
"""Analog Pin 2"""
P3 = 3
"""Analog Pin 3"""


class ADS1115(ADS1x15):
Expand Down
17 changes: 13 additions & 4 deletions adafruit_ads1x15/ads1x15.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,21 @@ class Mode:
# values here are masks for setting MODE bit in Config Register
# pylint: disable=too-few-public-methods
CONTINUOUS = 0x0000
"""Continuous Mode"""
SINGLE = 0x0100
"""Single-Shot Mode"""


class ADS1x15:
"""Base functionality for ADS1x15 analog to digital converters."""
"""Base functionality for ADS1x15 analog to digital converters.

:param ~busio.I2C i2c: The I2C bus the device is connected to.
:param float gain: The ADC gain.
:param int data_rate: The data rate for ADC conversion in samples per second.
Default value depends on the device.
:param Mode mode: The conversion mode, defaults to `Mode.SINGLE`.
:param int address: The I2C address of the device.
"""

def __init__(
self,
Expand Down Expand Up @@ -126,9 +136,8 @@ def mode(self, mode: Mode):
def read(self, pin: Pin, is_differential: bool = False) -> int:
"""I2C Interface for ADS1x15-based ADCs reads.

params:
:param pin: individual or differential pin.
:param bool is_differential: single-ended or differential read.
:param ~microcontroller.Pin pin: individual or differential pin.
:param bool is_differential: single-ended or differential read.
"""
pin = pin if is_differential else pin + 0x04
return self._read(pin)
Expand Down
13 changes: 6 additions & 7 deletions adafruit_ads1x15/analog_in.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,16 @@


class AnalogIn:
"""AnalogIn Mock Implementation for ADC Reads."""
"""AnalogIn Mock Implementation for ADC Reads.

:param ADS1x15 ads: The ads object.
:param int positive_pin: Required pin for single-ended.
:param int negative_pin: Optional pin for differential reads.
"""

def __init__(
self, ads: ADS1x15, positive_pin: int, negative_pin: Optional[int] = None
):
"""AnalogIn

:param ads: The ads object.
:param ~digitalio.DigitalInOut positive_pin: Required pin for single-ended.
:param ~digitalio.DigitalInOut negative_pin: Optional pin for differential reads.
"""
self._ads = ads
self._pin_setting = positive_pin
self._negative_pin = negative_pin
Expand Down