public class MCP4725GpioProvider extends DacGpioProviderBase implements DacGpioProvider
This GPIO provider implements the MCP4725 12-Bit Digital-to-Analog Converter as native Pi4J GPIO pins. More information about the board can be found here: http://www.adafruit.com/product/935 Data Sheet: http://www.adafruit.com/datasheets/mcp4725.pdf
The MCP4725 is connected via SPI connection to the Raspberry Pi and provides 1 GPIO analog output pin.
| Modifier and Type | Field and Description |
|---|---|
static String |
DESCRIPTION |
static int |
MAX_VALUE |
static int |
MCP4725_ADDRESS_1 |
static int |
MCP4725_ADDRESS_2 |
static int |
MIN_VALUE |
static String |
NAME |
allPins, shutdownValuescache, DEFAULT_CACHE_SIZE, isshutdown, listeners| Constructor and Description |
|---|
MCP4725GpioProvider(I2CBus bus,
int address)
This is an alternate constructor that can be used to create the
MCP4725 instance but not be considered the I2C bus owner and the
class will not close the bus communication when the class is destroyed
or on program shutdown.
|
MCP4725GpioProvider(int busNumber,
int address)
This is the default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
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()
Gets the name of the DAC provider instance.
|
void |
setValue(Pin pin,
double value)
Set the analog output value to an output pin on the DAC immediately.
|
void |
shutdown()
This method is used by the framework to shutdown the
DAC instance and apply any configured shutdown values to the DAC pins.
|
getShutdownValue, getShutdownValue, setPercentValue, setPercentValue, setShutdownValue, setShutdownValue, setValueaddListener, dispatchPinAnalogValueChangeEvent, dispatchPinDigitalStateChangeEvent, export, export, getMode, getPinCache, getPullResistance, getPwm, getState, getValue, hasPin, isExported, isShutdown, removeAllListeners, removeListener, setMode, setPullResistance, setPwm, setPwmRange, setState, unexportclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetShutdownValue, getShutdownValue, setPercentValue, setPercentValue, setShutdownValue, setShutdownValue, setValueaddListener, export, export, getMode, getPullResistance, getPwm, getState, getValue, hasPin, isExported, isShutdown, removeAllListeners, removeListener, setMode, setPullResistance, setPwm, setPwmRange, setState, unexportpublic static final String NAME
public static final String DESCRIPTION
public static final int MAX_VALUE
public static final int MIN_VALUE
public static final int MCP4725_ADDRESS_1
public static final int MCP4725_ADDRESS_2
public MCP4725GpioProvider(int busNumber,
int address)
throws I2CFactory.UnsupportedBusNumberException,
IOException
busNumber - the I2C bus number used to communicate with the MCP4725address - the address of the MCP4725 on the I2C bus.IOExceptionI2CFactory.UnsupportedBusNumberExceptionpublic MCP4725GpioProvider(I2CBus bus, int address) throws IOException
bus - an existing I2C bus instance defined in the user's code to communicate with the MCP4725address - the address of the MCP4725 on the I2C bus.IOExceptionpublic void setValue(Pin pin, double value)
setValue in interface GpioProvidersetValue in class GpioProviderBasepin - analog output pinvalue - raw value to send to the DAC. (Between: 0..4095)public String getName()
getName in interface GpioProvidergetName in class GpioProviderBasepublic void shutdown()
shutdown in interface GpioProvidershutdown in class DacGpioProviderBasepublic double getMinSupportedValue()
getMinSupportedValue in interface DacGpioProviderpublic double getMaxSupportedValue()
getMaxSupportedValue in interface DacGpioProviderCopyright © 2012–2018 Pi4J. All rights reserved.