public class MCP3204GpioProvider extends MCP3x0xGpioProvider implements AdcGpioProvider
This GPIO provider implements the MCP3204 SPI GPIO expansion board as native Pi4J GPIO pins. It is a 12-bit ADC providing 4 input channels.
The MCP3204 is connected via SPI connection to the Raspberry Pi and provides 4 GPIO pins that can be used for analog input pins. The values returned are in the range 0-4095 (12 bit value). Note: This implementation currently only supports single-ended inputs.
| Modifier and Type | Field and Description |
|---|---|
static String |
DESCRIPTION |
static int |
INPUT_COUNT |
static String |
NAME |
static int |
RESOLUTION |
MAX_VALUE, MIN_VALUEallPins, conversionDelay, monitor, monitorInterval, thresholdcache, DEFAULT_CACHE_SIZE, isshutdown, listenersDEFAULT_MONITOR_INTERVAL, DEFAULT_THRESHOLD, INVALID_VALUE, MIN_MONITOR_INTERVAL| Constructor and Description |
|---|
MCP3204GpioProvider(SpiChannel channel)
Create new instance of this MCP3204 provider with background monitoring and pin notification events enabled.
|
MCP3204GpioProvider(SpiChannel channel,
int speed)
Create new instance of this MCP3204 provider with background monitoring and pin notification events enabled.
|
MCP3204GpioProvider(SpiChannel channel,
int speed,
SpiMode mode)
Create new instance of this MCP3204 provider with background monitoring and pin notification events enabled.
|
MCP3204GpioProvider(SpiChannel channel,
int speed,
SpiMode mode,
boolean enableBackgroundMonitoring)
Create new instance of this MCP3204 provider.
|
MCP3204GpioProvider(SpiChannel channel,
SpiMode mode)
Create new instance of this MCP3204 provider with background monitoring and pin notification events enabled.
|
| Modifier and Type | Method and Description |
|---|---|
String |
getName() |
getImmediateValue, getMaxSupportedValue, getMinSupportedValuegetEventThreshold, getEventThreshold, getImmediateValue, getMonitorEnabled, getMonitorInterval, getPercentValue, getPercentValue, getValue, setEventThreshold, setEventThreshold, setMonitorEnabled, setMonitorInterval, shutdownaddListener, dispatchPinAnalogValueChangeEvent, dispatchPinDigitalStateChangeEvent, export, export, getMode, getPinCache, getPullResistance, getPwm, getState, hasPin, isExported, isShutdown, removeAllListeners, removeListener, setMode, setPullResistance, setPwm, setPwmRange, setState, setValue, unexportclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetEventThreshold, getEventThreshold, getImmediateValue, getImmediateValue, getMaxSupportedValue, getMinSupportedValue, getMonitorEnabled, getMonitorInterval, getPercentValue, getPercentValue, setEventThreshold, setEventThreshold, setMonitorEnabled, setMonitorIntervaladdListener, export, export, getMode, getPullResistance, getPwm, getState, getValue, hasPin, isExported, isShutdown, removeAllListeners, removeListener, setMode, setPullResistance, setPwm, setPwmRange, setState, setValue, shutdown, unexportpublic static final String NAME
public static final String DESCRIPTION
public static final int INPUT_COUNT
public static final int RESOLUTION
public MCP3204GpioProvider(SpiChannel channel) throws IOException
channel - spi channel the MCP3204 is connected toIOException - if an error occurs during initialization of the SpiDevicepublic MCP3204GpioProvider(SpiChannel channel, int speed) throws IOException
channel - spi channel the MCP3204 is connected tospeed - spi speed to communicate with MCP3204IOException - if an error occurs during initialization of the SpiDevicepublic MCP3204GpioProvider(SpiChannel channel, SpiMode mode) throws IOException
channel - spi channel the MCP3204 is connected tomode - spi mode to communicate with MCP3204IOException - if an error occurs during initialization of the SpiDevicepublic MCP3204GpioProvider(SpiChannel channel, int speed, SpiMode mode) throws IOException
channel - spi channel the MCP3204 is connected tospeed - spi speed to communicate with MCP3204mode - spi mode to communicate with MCP3204IOException - if an error occurs during initialization of the SpiDevicepublic MCP3204GpioProvider(SpiChannel channel, int speed, SpiMode mode, boolean enableBackgroundMonitoring) throws IOException
channel - spi channel the MCP3204 is connected tospeed - spi speed to communicate with MCP3204mode - spi mode to communicate with MCP3204enableBackgroundMonitoring - if enabled, then a background thread will be created to constantly acquire the ADC input values and
publish pin change listeners if the value change is beyond the configured threshold.IOException - if an error occurs during initialization of the SpiDevicepublic String getName()
getName in interface GpioProvidergetName in class GpioProviderBaseCopyright © 2012–2018 Pi4J. All rights reserved.