|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
1-Wire® Potentiometer interface class for basic potentiometer operations. This class should be implemented for each potentiometer type 1-Wire device. Currently there is only the DS2890, but it appears that plans have been made for more complex parts with more wipers, different possible number of wiper positions, etc.
The PotentiometerContainer methods can be organized into the following categories:
pc
':
byte[] state = pc.readDevice();
if (!(pc.isChargePumpOn()))
pc.setChargePump(true, state);
pc.writeDevice(state);
pc.setWiperPosition(127);
pc.increment();
pc.decrement();
OneWireContainer2C
,
OneWireSensor
,
ClockContainer
,
TemperatureContainer
,
SwitchContainer
Method Summary | |
int |
decrement()
Decrements the wiper position after selecting the part. |
int |
decrement(boolean reselect)
Decrements the wiper position. |
int |
getCurrentWiperNumber(byte[] state)
Gets the currently selected wiper number. |
int |
getWiperPosition()
Gets the current wiper position of the Potentiometer. |
int |
increment()
Increments the wiper position after selecting the part. |
int |
increment(boolean reselect)
Increments the wiper position by one. |
boolean |
isChargePumpOn(byte[] state)
Determines if the Potentiometer's charge pump is enabled. |
boolean |
isLinear(byte[] state)
Querys to see if this Potentiometer 1-Wire Device has linear potentiometer element(s) or logarithmic potentiometer element(s). |
int |
numberOfPotentiometers(byte[] state)
Querys to see how many potentiometers this Potentiometer 1-Wire Device has. |
int |
numberOfWiperSettings(byte[] state)
Querys to find the number of wiper settings that any wiper on this Potentiometer 1-Wire Device can have. |
int |
potentiometerResistance(byte[] state)
Querys to find the resistance value of the potentiometer. |
void |
setChargePump(boolean charge_pump_on,
byte[] state)
Sets the state of the Potentiometer's charge pump. |
void |
setCurrentWiperNumber(int wiper_number,
byte[] state)
Sets the currently selected wiper number. |
boolean |
setWiperPosition(int position)
Sets the wiper position of the potentiometer. |
boolean |
wiperSettingsAreVolatile(byte[] state)
Querys to see if this Potentiometer 1-Wire Device's wiper settings are volatile or non-volatile. |
Methods inherited from interface com.dalsemi.onewire.container.OneWireSensor |
readDevice, writeDevice |
Method Detail |
public boolean isLinear(byte[] state)
state
- state buffer of the Potentiometer 1-Wire Device (returned by readDevice()
)true
if this device has linear potentiometer element(s),
false
if this device has logarithmic potentiometer element(s)public boolean wiperSettingsAreVolatile(byte[] state)
state
- state buffer of the Potentiometer 1-Wire Device (returned by readDevice()
)true
if the wiper settings are volatile,
false
if the wiper settings are non-volatile.public int numberOfPotentiometers(byte[] state)
state
- state buffer of the Potentiometer 1-Wire Device (returned by readDevice()
)public int numberOfWiperSettings(byte[] state)
state
- state buffer of the Potentiometer 1-Wire Device (returned by readDevice()
)public int potentiometerResistance(byte[] state)
state
- state buffer of the Potentiometer 1-Wire Device (returned by readDevice()
)public int getCurrentWiperNumber(byte[] state)
numberOfPotentiometers()
.state
- state buffer of the Potentiometer 1-Wire Device (returned by readDevice()
)public void setCurrentWiperNumber(int wiper_number, byte[] state)
numberOfPotentiometers()
.wiper_number
- wiper number to select for communicationstate
- state buffer of the Potentiometer 1-Wire Device (returned by readDevice()
)public boolean isChargePumpOn(byte[] state)
state
- state buffer of the Potentiometer 1-Wire Device (returned by readDevice()
)true
if enabled, false
if notpublic void setChargePump(boolean charge_pump_on, byte[] state)
charge_pump_on
- true
to enable the charge pump, false
to disable charge pumpstate
- state buffer of the Potentiometer 1-Wire Device (returned by readDevice()
)true
if the operation was successful, false
if there was an errorpublic int getWiperPosition() throws OneWireIOException, OneWireException
numberOfWiperPositions()
, and describes the voltage output.numberOfWiperPositions()
OneWireIOException
- Data was not read correctlyOneWireException
- Could not find devicepublic boolean setWiperPosition(int position) throws OneWireIOException, OneWireException
position
- position to set the wiper totrue
if the operation was successful, false
otherwiseOneWireIOException
- Data was not written correctlyOneWireException
- Could not find devicepublic int increment(boolean reselect) throws OneWireIOException, OneWireException
reselect
- increment()
can be called without resetting
the part if the last call was an increment()
or decrement()
.
true
if device is to be selected (must be called with true
after any other 1-wire method)numberOfWiperPositions()
)OneWireIOException
- Data was not written correctlyOneWireException
- Could not find devicepublic int decrement(boolean reselect) throws OneWireIOException, OneWireException
reselect
- decrement()
can be called without resetting
the part if the last call was an increment()
or decrement()
.
true
if device is to be selected (must be called with true
after any other 1-wire method)numberOfWiperPositions()
).OneWireIOException
- Data was not written correctlyOneWireException
- Could not find devicepublic int increment() throws OneWireIOException, OneWireException
numberOfWiperPositions()
)OneWireIOException
- Data was not written correctlyOneWireException
- Could not find devicepublic int decrement() throws OneWireIOException, OneWireException
numberOfWiperPositions()
)OneWireIOException
- Data was not written correctlyOneWireException
- Could not find device
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |