public abstract class MicrochipPotentiometerBase extends ComponentBase implements MicrochipPotentiometer
MCP4561,
MCP4651| Modifier and Type | Field and Description |
|---|---|
protected static int |
INITIALVALUE_LOADED_FROM_EEPROM
The value which is used for devices capable of non-volatile wipers.
|
protected MicrochipPotentiometerNonVolatileMode |
nonVolatileMode
Whether to use the volatile or the non-volatile wiper
|
protected static boolean |
PIN_NOT_AVAILABLE
The value which is used for address-bit if the device's package
does not provide a matching address-pin (see 6.2.4)
|
| Modifier | Constructor and Description |
|---|---|
protected |
MicrochipPotentiometerBase(I2CBus i2cBus,
boolean pinA0,
boolean pinA1,
boolean pinA2,
MicrochipPotentiometerChannel channel,
MicrochipPotentiometerNonVolatileMode nonVolatileMode,
int initialValueForVolatileWipers)
Builds an instance which is ready to use.
|
protected |
MicrochipPotentiometerBase(I2CBus i2cBus,
boolean pinA0,
boolean pinA1,
boolean pinA2,
MicrochipPotentiometerChannel channel,
MicrochipPotentiometerNonVolatileMode nonVolatileMode,
int initialValueForVolatileWipers,
MicrochipPotentiometerDeviceControllerFactory controllerFactory)
Builds an instance which is ready to use.
|
| Modifier and Type | Method and Description |
|---|---|
protected static int |
buildI2CAddress(boolean pinA0,
boolean pinA1,
boolean pinA2) |
void |
decrease()
Decreases the wiper's value for one step.
|
void |
decrease(int steps)
Decreases the wiper's value for n steps.
|
boolean |
equals(Object obj)
Tests whether a given object equals to this object.
|
MicrochipPotentiometerChannel |
getChannel() |
int |
getCurrentValue()
The wiper's value read from cache.
|
MicrochipPotentiometerDeviceStatus |
getDeviceStatus() |
MicrochipPotentiometerNonVolatileMode |
getNonVolatileMode() |
protected int |
getNonVolatileValue()
The visibility of this method is protected because not all
devices support non-volatile wipers.
|
abstract MicrochipPotentiometerChannel[] |
getSupportedChannelsByDevice() |
MicrochipPotentiometerTerminalConfiguration |
getTerminalConfiguration() |
void |
increase()
Increases the wiper's value for one step.
|
void |
increase(int steps)
Increases the wiper's value for n steps.
|
protected void |
initialize(int initialValueForVolatileWipers)
Initializes the wiper to a defined status.
|
abstract boolean |
isCapableOfNonVolatileWiper() |
boolean |
isChannelSupportedByDevice(MicrochipPotentiometerChannel channel) |
void |
setCurrentValue(int value)
Set wiper's value.
|
protected void |
setNonVolatileMode(MicrochipPotentiometerNonVolatileMode nonVolatileMode)
The visibility of this method is protected because not all
devices support non-volatile wipers.
|
void |
setTerminalConfiguration(MicrochipPotentiometerTerminalConfiguration terminalConfiguration) |
void |
setWiperLock(boolean enabled)
Enables or disables wiper-lock.
|
void |
setWriteProtection(boolean enabled)
Enables or disables write-protection for devices capable of non-volatile memory.
|
String |
toString() |
int |
updateCacheFromDevice()
Updates the cache to the wiper's value.
|
clearProperties, getName, getProperties, getProperty, getProperty, getTag, hasProperty, removeProperty, setName, setProperty, setTagclone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetMaxValue, isRheostatclearProperties, getName, getProperties, getProperty, getProperty, getTag, hasProperty, removeProperty, setName, setProperty, setTagprotected static final boolean PIN_NOT_AVAILABLE
protected static final int INITIALVALUE_LOADED_FROM_EEPROM
protected MicrochipPotentiometerNonVolatileMode nonVolatileMode
protected MicrochipPotentiometerBase(I2CBus i2cBus, boolean pinA0, boolean pinA1, boolean pinA2, MicrochipPotentiometerChannel channel, MicrochipPotentiometerNonVolatileMode nonVolatileMode, int initialValueForVolatileWipers) throws IOException
i2cBus - The Pi4J-I2CBus to which the device is connected topinA0 - Whether the device's address pin A0 is high (true) or low (false)pinA1 - Whether the device's address pin A1 (if available) is high (true) or low (false)pinA2 - Whether the device's address pin A2 (if available) is high (true) or low (false)channel - Which of the potentiometers provided by the device to controlnonVolatileMode - The way non-volatile reads or writes are doneinitialValueForVolatileWipers - The value for devices which are not capable of non-volatile wipersIOException - Thrown if communication fails or device returned a malformed resultprotected MicrochipPotentiometerBase(I2CBus i2cBus, boolean pinA0, boolean pinA1, boolean pinA2, MicrochipPotentiometerChannel channel, MicrochipPotentiometerNonVolatileMode nonVolatileMode, int initialValueForVolatileWipers, MicrochipPotentiometerDeviceControllerFactory controllerFactory) throws IOException
i2cBus - The Pi4J-I2CBus to which the device is connected topinA0 - Whether the device's address pin A0 is high (true) or low (false)pinA1 - Whether the device's address pin A1 (if available) is high (true) or low (false)pinA2 - Whether the device's address pin A2 (if available) is high (true) or low (false)channel - Which of the potentiometers provided by the device to controlnonVolatileMode - The way non-volatile reads or writes are doneinitialValueForVolatileWipers - The value for devices which are not capable of non-volatile wiperscontrollerFactory - builds new controllersIOException - Thrown if communication fails or device returned a malformed resultMicrochipPotentiometerDefaultDeviceControllerFactoryprotected void initialize(int initialValueForVolatileWipers)
throws IOException
initialValueForVolatileWipers - The initial value for devices not capableIOException - Thrown if communication fails or device returned a malformed resultpublic MicrochipPotentiometerChannel getChannel()
getChannel in interface MicrochipPotentiometerpublic abstract boolean isCapableOfNonVolatileWiper()
isCapableOfNonVolatileWiper in interface MicrochipPotentiometerpublic abstract MicrochipPotentiometerChannel[] getSupportedChannelsByDevice()
getSupportedChannelsByDevice in interface MicrochipPotentiometerprotected static int buildI2CAddress(boolean pinA0,
boolean pinA1,
boolean pinA2)
pinA0 - Whether the device's address pin A0 is high (true) or low (false)pinA1 - Whether the device's address pin A1 (if available) is high (true) or low (false)pinA2 - Whether the device's address pin A2 (if available) is high (true) or low (false)public MicrochipPotentiometerNonVolatileMode getNonVolatileMode()
getNonVolatileMode in interface MicrochipPotentiometerprotected void setNonVolatileMode(MicrochipPotentiometerNonVolatileMode nonVolatileMode)
nonVolatileMode - The way non-volatile reads or writes are donepublic int updateCacheFromDevice()
throws IOException
updateCacheFromDevice in interface MicrochipPotentiometerIOException - Thrown if communication fails or device returned a malformed resultprotected int getNonVolatileValue()
throws IOException
IOException - Thrown if communication fails or device returned a malformed resultpublic int getCurrentValue()
throws IOException
getCurrentValue in interface PotentiometerIOException - Thrown if communication fails or device returned a malformed resultupdateCacheFromDevice()public void setCurrentValue(int value)
throws IOException
PotentiometersetCurrentValue in interface Potentiometervalue - The wiper's value to be setIOException - Thrown if communication fails or device returned a malformed resultPotentiometer.getMaxValue()public void decrease()
throws IOException
decrease in interface PotentiometerIOException - Thrown if communication fails or device returned a malformed resultpublic void decrease(int steps)
throws IOException
decrease in interface Potentiometersteps - The number of steps to decreaseIOException - Thrown if communication fails or device returned a malformed resultpublic void increase()
throws IOException
increase in interface PotentiometerIOException - Thrown if communication fails or device returned a malformed resultPotentiometer.getMaxValue()public void increase(int steps)
throws IOException
increase in interface Potentiometersteps - The number of steps to increaseIOException - Thrown if communication fails or device returned a malformed resultpublic MicrochipPotentiometerDeviceStatus getDeviceStatus() throws IOException
getDeviceStatus in interface MicrochipPotentiometerIOException - Thrown if communication fails or device returned a malformed resultpublic MicrochipPotentiometerTerminalConfiguration getTerminalConfiguration() throws IOException
getTerminalConfiguration in interface MicrochipPotentiometerIOException - Thrown if communication fails or device returned a malformed resultpublic void setTerminalConfiguration(MicrochipPotentiometerTerminalConfiguration terminalConfiguration) throws IOException
setTerminalConfiguration in interface MicrochipPotentiometerterminalConfiguration - The new terminal-configurationIOException - Thrown if communication fails or device returned a malformed resultpublic void setWiperLock(boolean enabled)
throws IOException
setWiperLock in interface MicrochipPotentiometerenabled - wiper-lock for the poti's channel has to be enabledIOException - Thrown if communication fails or device returned a malformed resultpublic void setWriteProtection(boolean enabled)
throws IOException
setWriteProtection in interface MicrochipPotentiometerenabled - write-protection has to be enabledIOException - Thrown if communication fails or device returned a malformed resultpublic boolean equals(Object obj)
Especially to any class deriving PotentiometerImpl this test does not take properties into account which do not point to a specific device/channel.
public boolean isChannelSupportedByDevice(MicrochipPotentiometerChannel channel)
isChannelSupportedByDevice in interface MicrochipPotentiometerchannel - A certain channelCopyright © 2012–2019 Pi4J. All rights reserved.