1-Wire API for .NET Version 4.00
|
1-Wire® Potentiometer interface class for basic potentiometer operations. More...
Inherits com::dalsemi::onewire::container::OneWireSensor.
Inherited by OneWireContainer2C.
Public Member Functions | |
boolean | isLinear (byte[] state) |
Querys to see if this Potentiometer 1-Wire Device has linear potentiometer element(s) or logarithmic potentiometer element(s). | |
boolean | wiperSettingsAreVolatile (byte[] state) |
Querys to see if this Potentiometer 1-Wire Device's wiper settings are volatile or non-volatile. | |
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. | |
int | getCurrentWiperNumber (byte[] state) |
Gets the currently selected wiper number. | |
void | setCurrentWiperNumber (int wiper_number, byte[] state) |
Sets the currently selected wiper number. | |
boolean | isChargePumpOn (byte[] state) |
Determines if the Potentiometer's charge pump is enabled. | |
void | setChargePump (boolean charge_pump_on, byte[] state) |
Sets the state of the Potentiometer's charge pump. | |
int | getWiperPosition () throws OneWireIOException, OneWireException |
Gets the current wiper position of the Potentiometer. | |
boolean | setWiperPosition (int position) throws OneWireIOException, OneWireException |
Sets the wiper position of the potentiometer. | |
int | increment (boolean reselect) throws OneWireIOException, OneWireException |
Increments the wiper position by one. | |
int | decrement (boolean reselect) throws OneWireIOException, OneWireException |
Decrements the wiper position. | |
int | increment () throws OneWireIOException, OneWireException |
Increments the wiper position after selecting the part. | |
int | decrement () throws OneWireIOException, OneWireException |
Decrements the wiper position after selecting the part. |
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:
Display some features of PotentiometerContainer instance 'pc
':
byte[] state = pc.readDevice();
if (!(pc.isChargePumpOn()))
pc.setChargePump(true, state);
pc.writeDevice(state);
pc.setWiperPosition(127);
pc.increment();
pc.decrement();
int decrement | ( | boolean | reselect | ) | throws OneWireIOException, OneWireException |
Decrements the wiper position.
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()
).com.dalsemi.onewire.adapter.OneWireIOException | Data was not written correctly |
com.dalsemi.onewire.OneWireException | Could not find device |
Implemented in OneWireContainer2C.
int decrement | ( | ) | throws OneWireIOException, OneWireException |
Decrements the wiper position after selecting the part.
numberOfWiperPositions()
)com.dalsemi.onewire.adapter.OneWireIOException | Data was not written correctly |
com.dalsemi.onewire.OneWireException | Could not find device |
Implemented in OneWireContainer2C.
int getCurrentWiperNumber | ( | byte[] | state | ) |
Gets the currently selected wiper number.
All wiper actions affect this wiper. The number of wipers is the same as numberOfPotentiometers()
.
state | state buffer of the Potentiometer 1-Wire Device (returned by readDevice() ) |
Implemented in OneWireContainer2C.
int getWiperPosition | ( | ) | throws OneWireIOException, OneWireException |
Gets the current wiper position of the Potentiometer.
The wiper position is between 0 and numberOfWiperPositions()
, and describes the voltage output.
numberOfWiperPositions()
com.dalsemi.onewire.adapter.OneWireIOException | Data was not read correctly |
com.dalsemi.onewire.OneWireException | Could not find device |
Implemented in OneWireContainer2C.
int increment | ( | boolean | reselect | ) | throws OneWireIOException, OneWireException |
Increments the wiper position by one.
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()
)com.dalsemi.onewire.adapter.OneWireIOException | Data was not written correctly |
com.dalsemi.onewire.OneWireException | Could not find device |
Implemented in OneWireContainer2C.
int increment | ( | ) | throws OneWireIOException, OneWireException |
Increments the wiper position after selecting the part.
numberOfWiperPositions()
)com.dalsemi.onewire.adapter.OneWireIOException | Data was not written correctly |
com.dalsemi.onewire.OneWireException | Could not find device |
Implemented in OneWireContainer2C.
boolean isChargePumpOn | ( | byte[] | state | ) |
Determines if the Potentiometer's charge pump is enabled.
state | state buffer of the Potentiometer 1-Wire Device (returned by readDevice() ) |
true
if enabled, false
if not Implemented in OneWireContainer2C.
boolean isLinear | ( | byte[] | state | ) |
Querys to see if this Potentiometer 1-Wire Device has linear potentiometer element(s) or logarithmic potentiometer element(s).
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) Implemented in OneWireContainer2C.
int numberOfPotentiometers | ( | byte[] | state | ) |
Querys to see how many potentiometers this Potentiometer 1-Wire Device has.
state | state buffer of the Potentiometer 1-Wire Device (returned by readDevice() ) |
Implemented in OneWireContainer2C.
int numberOfWiperSettings | ( | byte[] | state | ) |
Querys to find the number of wiper settings that any wiper on this Potentiometer 1-Wire Device can have.
state | state buffer of the Potentiometer 1-Wire Device (returned by readDevice() ) |
Implemented in OneWireContainer2C.
int potentiometerResistance | ( | byte[] | state | ) |
Querys to find the resistance value of the potentiometer.
state | state buffer of the Potentiometer 1-Wire Device (returned by readDevice() ) |
Implemented in OneWireContainer2C.
void setChargePump | ( | boolean | charge_pump_on, |
byte[] | state | ||
) |
Sets the state of the Potentiometer's charge pump.
This decreases the wiper's resistance, but increases the power consumption by the part. Vdd must be connected to use the charge pump.
charge_pump_on | true to enable the charge pump, false to disable charge pump |
state | state buffer of the Potentiometer 1-Wire Device (returned by readDevice() ) |
true
if the operation was successful, false
if there was an error Implemented in OneWireContainer2C.
void setCurrentWiperNumber | ( | int | wiper_number, |
byte[] | state | ||
) |
Sets the currently selected wiper number.
All wiper actions will then affect this wiper. The number of wipers is the same as numberOfPotentiometers()
.
wiper_number | wiper number to select for communication |
state | state buffer of the Potentiometer 1-Wire Device (returned by readDevice() ) |
Implemented in OneWireContainer2C.
boolean setWiperPosition | ( | int | position | ) | throws OneWireIOException, OneWireException |
Sets the wiper position of the potentiometer.
position | position to set the wiper to |
true
if the operation was successful, false
otherwisecom.dalsemi.onewire.adapter.OneWireIOException | Data was not written correctly |
com.dalsemi.onewire.OneWireException | Could not find device |
Implemented in OneWireContainer2C.
boolean wiperSettingsAreVolatile | ( | byte[] | state | ) |
Querys to see if this Potentiometer 1-Wire Device's wiper settings are volatile or non-volatile.
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. Implemented in OneWireContainer2C.