public class MCP3424GpioProvider extends AdcGpioProviderBase implements AdcGpioProvider
This GPIO provider implements the MCP3424 I2C GPIO expansion board as native Pi4J GPIO pins. It is a 18-bit ADC providing 4 sigma/delta input channels. More information about the board can be found here: http://ww1.microchip.com/downloads/en/DeviceDoc/22088c.pdf
The MCP3424 is connected via I2C connection to the Raspberry Pi and provides 4 analog input channels. The values returned are in the range [-131072:131071] (max 18 bit value).
Modifier and Type | Field and Description |
---|---|
static String |
DESCRIPTION |
static String |
NAME |
allPins, conversionDelay, monitor, monitorInterval, threshold
cache, DEFAULT_CACHE_SIZE, isshutdown, listeners
DEFAULT_MONITOR_INTERVAL, DEFAULT_THRESHOLD, INVALID_VALUE, MIN_MONITOR_INTERVAL
Constructor and Description |
---|
MCP3424GpioProvider(I2CBus bus,
int address) |
MCP3424GpioProvider(I2CBus bus,
int address,
int resolution,
int gain) |
MCP3424GpioProvider(int busNumber,
int address) |
MCP3424GpioProvider(int busNumber,
int address,
int resolution,
int gain) |
Modifier and Type | Method and Description |
---|---|
double |
getAnalogValue(GpioPinAnalogInput pin)
Get the requested analog input pin's conversion value.
|
double |
getAnalogValue(Pin pin)
Get the requested analog input pin's conversion value.
|
double |
getImmediateValue(Pin pin)
This method will perform an immediate data acquisition directly to the ADC chip to get the requested pin's input
conversion value.
|
double |
getMaxSupportedValue()
Get the maximum supported analog value for the ADC implementation.
|
double |
getMinSupportedValue()
Get the minimum supported analog value for the ADC implementation.
|
String |
getName() |
void |
setGain(int gain) |
void |
setResolution(int resolution) |
void |
shutdown()
This method is used by the framework to shutdown the
background monitoring thread if needed when the program exits.
|
getEventThreshold, getEventThreshold, getImmediateValue, getMonitorEnabled, getMonitorInterval, getPercentValue, getPercentValue, getValue, setEventThreshold, setEventThreshold, setMonitorEnabled, setMonitorInterval
addListener, dispatchPinAnalogValueChangeEvent, dispatchPinDigitalStateChangeEvent, export, export, getMode, getPinCache, getPullResistance, getPwm, getState, hasPin, isExported, isShutdown, removeAllListeners, removeListener, setMode, setPullResistance, setPwm, setPwmRange, setState, setValue, unexport
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getEventThreshold, getEventThreshold, getImmediateValue, getMonitorEnabled, getMonitorInterval, getPercentValue, getPercentValue, setEventThreshold, setEventThreshold, setMonitorEnabled, setMonitorInterval
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
public MCP3424GpioProvider(int busNumber, int address) throws I2CFactory.UnsupportedBusNumberException, IOException
public MCP3424GpioProvider(int busNumber, int address, int resolution, int gain) throws I2CFactory.UnsupportedBusNumberException, IOException
public MCP3424GpioProvider(I2CBus bus, int address) throws I2CFactory.UnsupportedBusNumberException, IOException
public MCP3424GpioProvider(I2CBus bus, int address, int resolution, int gain) throws I2CFactory.UnsupportedBusNumberException, IOException
public void setGain(int gain) throws IllegalArgumentException
IllegalArgumentException
public void setResolution(int resolution) throws IllegalArgumentException
IllegalArgumentException
public void shutdown()
AdcGpioProviderBase
shutdown
in interface GpioProvider
shutdown
in class AdcGpioProviderBase
public String getName()
getName
in interface GpioProvider
getName
in class GpioProviderBase
public double getAnalogValue(Pin pin)
pin
- to get conversion values forpublic double getAnalogValue(GpioPinAnalogInput pin)
pin
- to get conversion values forpublic double getImmediateValue(Pin pin) throws IOException
getImmediateValue
in interface AdcGpioProvider
getImmediateValue
in class AdcGpioProviderBase
pin
- requested input pin to acquire conversion valueIOException
public double getMinSupportedValue()
getMinSupportedValue
in interface AdcGpioProvider
public double getMaxSupportedValue()
getMaxSupportedValue
in interface AdcGpioProvider
Copyright © 2012–2016 Pi4J. All rights reserved.