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, shutdownValues
cache, 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, setValue
addListener, dispatchPinAnalogValueChangeEvent, dispatchPinDigitalStateChangeEvent, export, export, getMode, getPinCache, getPullResistance, getPwm, getState, getValue, hasPin, isExported, isShutdown, removeAllListeners, removeListener, setMode, setPullResistance, setPwm, setPwmRange, setState, unexport
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getShutdownValue, getShutdownValue, setPercentValue, setPercentValue, setShutdownValue, setShutdownValue, setValue
addListener, export, export, getMode, getPullResistance, getPwm, getState, getValue, hasPin, isExported, isShutdown, removeAllListeners, removeListener, setMode, setPullResistance, setPwm, setPwmRange, setState, unexport
public 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.IOException
I2CFactory.UnsupportedBusNumberException
public 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.IOException
public void setValue(Pin pin, double value)
setValue
in interface GpioProvider
setValue
in class GpioProviderBase
pin
- analog output pinvalue
- raw value to send to the DAC. (Between: 0..4095)public String getName()
getName
in interface GpioProvider
getName
in class GpioProviderBase
public void shutdown()
shutdown
in interface GpioProvider
shutdown
in class DacGpioProviderBase
public double getMinSupportedValue()
getMinSupportedValue
in interface DacGpioProvider
public double getMaxSupportedValue()
getMaxSupportedValue
in interface DacGpioProvider
Copyright © 2012–2016 Pi4J. All rights reserved.