API Reference
ADS7128
CircuitPython driver for the Adafruit ADS7128 8-Channel ADC and GPIO Expander
Author(s): Liz Clark
Implementation Notes
Hardware:
Software and Dependencies:
Adafruit CircuitPython firmware for the supported boards: https://circuitpython.org/downloads
Adafruit’s Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
- class adafruit_ads7128.ads7128.ADS7128(i2c: busio.I2C, address: int = _DEFAULT_ADDR)
Driver for the ADS7128 8-channel 12-bit ADC with GPIOs.
- Parameters:
- property alert_logic: int
0=active low, 1=active high, 2=pulsed low, 3=pulsed high.
- Type:
ALERT pin logic
- property event_flags: int
Combined high/low threshold event flags, one bit per channel. (read-only)
- property gpo_drive_cfg: int
Per-channel output drive bitmask (bit set = push-pull, clear = open-drain).
- property low_power_oscillator: bool
Use the low-power oscillator (
True) or high-speed oscillator (False).
- read_sequence_result() Tuple[int, int]
Read the next conversion result from the running sequence.
- Returns:
A
(value, channel)tuple wherevalueis the 12-bit conversion result andchannelis the channel it came from.- Return type:
- property rms_done: bool
Trueif the RMS computation is complete. Reading clears the flag. (read-only)
- property rms_enabled: bool
Whether the RMS computation module is enabled.
Setting this to
Trueclears any previous result and starts a new computation using samples from autonomous conversion mode.
- property zcd_blanking: int
Zero-crossing blanking count, 0-127 (conversions skipped after an event).
- adafruit_ads7128.ads7128.OSR_128 = 7
128x oversampling (16-bit result).
- adafruit_ads7128.ads7128.OSR_16 = 4
16x oversampling (16-bit result).
- adafruit_ads7128.ads7128.OSR_2 = 1
2x oversampling (13-bit result).
- adafruit_ads7128.ads7128.OSR_32 = 5
32x oversampling (16-bit result).
- adafruit_ads7128.ads7128.OSR_4 = 2
4x oversampling (14-bit result).
- adafruit_ads7128.ads7128.OSR_64 = 6
64x oversampling (16-bit result).
- adafruit_ads7128.ads7128.OSR_8 = 3
8x oversampling (15-bit result).
- adafruit_ads7128.ads7128.OSR_NONE = 0
No oversampling (12-bit result).
AnalogIn
AnalogIn for ADC readings.
Author(s): Liz Clark
- class adafruit_ads7128.analog_in.AnalogIn(adc: ADS7128, pin: int)
AnalogIn-compatible wrapper for ADS7128 single-ended readings.
Provides a
valueproperty scaled to a 16-bit unsigned range[0, 65535]and avoltageproperty in volts, matching the CircuitPythonanalogio.AnalogInAPI.- property event_count: int
Consecutive samples before an alert triggers, 0-15 (alert after count + 1).
- property event_region: bool
Truefor in-band,Falsefor out-of-window.- Type:
Comparator event region
- property high_threshold: int
Window-comparator high threshold for this channel, in 12-bit counts (0-4095).
- property low_threshold: int
Window-comparator low threshold for this channel, in 12-bit counts (0-4095).
- property max: int
Maximum value recorded on this channel, in 12-bit counts. (read-only)
Requires
ADS7128.statistics_enabledto beTrue.
- property min: int
Minimum value recorded on this channel, in 12-bit counts. (read-only)
Requires
ADS7128.statistics_enabledto beTrue.
- property recent: int
Most recent conversion recorded on this channel, in 12-bit counts. (read-only)
Requires
ADS7128.statistics_enabledto beTrue.
DigitalInOut
Digital input/output of the ADS7128.
Author(s): Liz Clark
- class adafruit_ads7128.digital_inout.DigitalInOut(adc: ADS7128, pin: int)
Digital input/output of the ADS7128. The interface is the same as the
digitalio.DigitalInOutclass, however:the ADS7128 does not support pull-up or pull-down resistors;
a channel used here is taken out of analog mode.
Open-drain outputs are supported through
drive_mode. AValueErroris raised when attempting to set an unsupported pull configuration.- property direction: digitalio.Direction
The direction of the pin, either
digitalio.Direction.INPUTordigitalio.Direction.OUTPUT.
- property drive_mode: digitalio.DriveMode
The output drive mode, either
digitalio.DriveMode.PUSH_PULLordigitalio.DriveMode.OPEN_DRAIN.
- switch_to_input(pull: digitalio.Pull = None, **kwargs) None
Switch the pin to a digital input.
- Parameters:
pull (Pull) – Must be
None; pull resistors are not supported and any other value raisesValueError.
- switch_to_output(value: bool = False, drive_mode: digitalio.DriveMode = digitalio.DriveMode.PUSH_PULL, **kwargs) None
Switch the pin to a digital output with the given starting value and drive mode (push-pull by default).
- property value: bool
The value of the pin, either
Truefor high orFalsefor low.Configure the pin as an output or input before writing or reading this.
- property zcd_output: int
Zero-crossing-detector output mode mapped onto this GPO pin.
0=low, 1=high, 2=ZCD signal, 3=inverted ZCD. Use with
zcd_output_enabled.