public abstract class ADS1x15GpioProvider extends GpioProviderBase implements GpioProvider
This GPIO provider implements the TI ADS1x15 analog to digital converter chip as native Pi4J GPIO pins. More information about the board can be found here: * >> ADS1115 http://www.ti.com/lit/ds/symlink/ads1115.pdf http://adafruit.com/datasheets/ads1115.pdf >> ADS1015 http://www.ti.com/lit/ds/symlink/ads1015.pdf http://adafruit.com/datasheets/ads1015.pdf
The ADS1x15 is connected via I2C connection to the Raspberry Pi and provides 2 GPIO pins that can be used for analog input pins.
TODO: Add support for ALARM pin using a GPIO to notify for events. This would be more efficient than constantly polling each ADB pin in the monitoring thread.Modifier and Type | Class and Description |
---|---|
static class |
ADS1x15GpioProvider.ProgrammableGainAmplifierValue |
cache, DEFAULT_CACHE_SIZE, isshutdown, listeners
Constructor and Description |
---|
ADS1x15GpioProvider(I2CBus bus,
int address) |
ADS1x15GpioProvider(int busNumber,
int address) |
addListener, dispatchPinAnalogValueChangeEvent, dispatchPinDigitalStateChangeEvent, export, export, getMode, getPinCache, getPullResistance, getPwm, getState, getValue, hasPin, isExported, isShutdown, removeAllListeners, removeListener, setMode, setPullResistance, setPwm, setPwmRange, setState, setValue, unexport
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addListener, export, export, getMode, getPullResistance, getPwm, getState, getValue, hasPin, isExported, isShutdown, removeAllListeners, removeListener, setMode, setPullResistance, setPwm, setPwmRange, setState, setValue, unexport
public static final String NAME
public static final String DESCRIPTION
protected boolean i2cBusOwner
protected I2CBus bus
protected I2CDevice device
protected com.pi4j.gpio.extension.ads.ADS1x15GpioProvider.ADCMonitor monitor
protected Pin[] allPins
protected int conversionDelay
protected short bitShift
public static int MIN_MONITOR_INTERVAL
public static int DEFAULT_MONITOR_INTERVAL
protected static final int ADS1x15_REG_POINTER_MASK
protected static final int ADS1x15_REG_POINTER_CONVERT
protected static final int ADS1x15_REG_POINTER_CONFIG
protected static final int ADS1x15_REG_POINTER_LOWTHRESH
protected static final int ADS1x15_REG_POINTER_HITHRESH
protected static final int ADS1x15_REG_CONFIG_OS_MASK
protected static final int ADS1x15_REG_CONFIG_OS_SINGLE
protected static final int ADS1x15_REG_CONFIG_OS_BUSY
protected static final int ADS1x15_REG_CONFIG_OS_NOTBUSY
protected static final int ADS1x15_REG_CONFIG_MUX_MASK
protected static final int ADS1x15_REG_CONFIG_MUX_DIFF_0_1
protected static final int ADS1x15_REG_CONFIG_MUX_DIFF_0_3
protected static final int ADS1x15_REG_CONFIG_MUX_DIFF_1_3
protected static final int ADS1x15_REG_CONFIG_MUX_DIFF_2_3
protected static final int ADS1x15_REG_CONFIG_MUX_SINGLE_0
protected static final int ADS1x15_REG_CONFIG_MUX_SINGLE_1
protected static final int ADS1x15_REG_CONFIG_MUX_SINGLE_2
protected static final int ADS1x15_REG_CONFIG_MUX_SINGLE_3
protected static final int ADS1x15_REG_CONFIG_PGA_MASK
protected static final int ADS1x15_REG_CONFIG_PGA_6_144V
protected static final int ADS1x15_REG_CONFIG_PGA_4_096V
protected static final int ADS1x15_REG_CONFIG_PGA_2_048V
protected static final int ADS1x15_REG_CONFIG_PGA_1_024V
protected static final int ADS1x15_REG_CONFIG_PGA_0_512V
protected static final int ADS1x15_REG_CONFIG_PGA_0_256V
protected static final int ADS1x15_REG_CONFIG_MODE_MASK
protected static final int ADS1x15_REG_CONFIG_MODE_CONTIN
protected static final int ADS1x15_REG_CONFIG_MODE_SINGLE
protected static final int ADS1x15_REG_CONFIG_DR_MASK
protected static final int ADS1x15_REG_CONFIG_DR_128SPS
protected static final int ADS1x15_REG_CONFIG_DR_250SPS
protected static final int ADS1x15_REG_CONFIG_DR_490SPS
protected static final int ADS1x15_REG_CONFIG_DR_920SPS
protected static final int ADS1x15_REG_CONFIG_DR_1600SPS
protected static final int ADS1x15_REG_CONFIG_DR_2400SPS
protected static final int ADS1x15_REG_CONFIG_DR_3300SPS
protected static final int ADS1x15_REG_CONFIG_CMODE_MASK
protected static final int ADS1x15_REG_CONFIG_CMODE_TRAD
protected static final int ADS1x15_REG_CONFIG_CMODE_WINDOW
protected static final int ADS1x15_REG_CONFIG_CPOL_MASK
protected static final int ADS1x15_REG_CONFIG_CPOL_ACTVLOW
protected static final int ADS1x15_REG_CONFIG_CPOL_ACTVHI
protected static final int ADS1x15_REG_CONFIG_CLAT_MASK
protected static final int ADS1x15_REG_CONFIG_CLAT_NONLAT
protected static final int ADS1x15_REG_CONFIG_CLAT_LATCH
protected static final int ADS1x15_REG_CONFIG_CQUE_MASK
protected static final int ADS1x15_REG_CONFIG_CQUE_1CONV
protected static final int ADS1x15_REG_CONFIG_CQUE_2CONV
protected static final int ADS1x15_REG_CONFIG_CQUE_4CONV
protected static final int ADS1x15_REG_CONFIG_CQUE_NONE
protected ADS1x15GpioProvider.ProgrammableGainAmplifierValue[] pga
protected double[] threshold
protected double[] cachedValue
protected int monitorInterval
public ADS1x15GpioProvider(int busNumber, int address) throws I2CFactory.UnsupportedBusNumberException, IOException
public ADS1x15GpioProvider(I2CBus bus, int address) throws IOException
IOException
public ADS1x15GpioProvider.ProgrammableGainAmplifierValue getProgrammableGainAmplifier(Pin pin)
public ADS1x15GpioProvider.ProgrammableGainAmplifierValue getProgrammableGainAmplifier(GpioPin pin)
public void setProgrammableGainAmplifier(ADS1x15GpioProvider.ProgrammableGainAmplifierValue pga, Pin... pin)
public void setProgrammableGainAmplifier(ADS1x15GpioProvider.ProgrammableGainAmplifierValue pga, GpioPin... pin)
public double getEventThreshold(Pin pin)
public double getEventThreshold(GpioPin pin)
public void setEventThreshold(double threshold, Pin... pin)
public void setEventThreshold(double threshold, GpioPin... pin)
public int getMonitorInterval()
public void setMonitorInterval(int monitorInterval)
public abstract String getName()
getName
in interface GpioProvider
getName
in class GpioProviderBase
public double getImmediateValue(Pin pin) throws IOException
IOException
protected void writeRegister(int register, int value) throws IOException
IOException
protected int readRegister(int register) throws IOException
IOException
protected static short getShort(byte[] arr, int off)
protected static String bytesToHex(byte[] bytes)
public void shutdown()
shutdown
in interface GpioProvider
shutdown
in class GpioProviderBase
Copyright © 2012–2016 Pi4J. All rights reserved.