Dallas Semiconductor 1-Wire API 1.00 Alpha: Interface PotentiometerContainer

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.dalsemi.onewire.container
Interface PotentiometerContainer

All Superinterfaces:
  OneWireSensor

All Known Implementing Classes:
  OneWireContainer2C

public interface PotentiometerContainer
extends OneWireSensor

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:

- Information
  - `isLinear`
  - `wiperSettingsAreVolatile`
  - `numberOfPotentiometers`
  - `numberOfWiperSettings`
  - `potentiometerResistance`
  - `getCurrentWiperNumber`
  - `getWiperPosition`
  - `isChargePumpOn`
- Options
  - `setCurrentWiperNumber`
  - `setChargePump`
  - `setWiperPosition`
  - `increment`, `increment`
  - `decrement`, `decrement`
- I/O
  - `readDevice`
  - `writeDevice`

### Usage

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();

Version:
  0.00, 31 August 2000
See Also:
  `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

### isLinear

    public boolean isLinear(byte[] state)

  Querys to see if this Potentiometer 1-Wire Device has linear potentiometer element(s) or logarithmic potentiometer element(s).
  Parameters:
    `state` - state buffer of the Potentiometer 1-Wire Device (returned by `readDevice()`)
  Returns:
    `true` if this device has linear potentiometer element(s), `false` if this device has logarithmic potentiometer element(s)

### wiperSettingsAreVolatile

    public boolean wiperSettingsAreVolatile(byte[] state)

  Querys to see if this Potentiometer 1-Wire Device's wiper settings are volatile or non-volatile.
  Parameters:
    `state` - state buffer of the Potentiometer 1-Wire Device (returned by `readDevice()`)
  Returns:
    `true` if the wiper settings are volatile, `false` if the wiper settings are non-volatile.

### numberOfPotentiometers

    public int numberOfPotentiometers(byte[] state)

  Querys to see how many potentiometers this Potentiometer 1-Wire Device has.
  Parameters:
    `state` - state buffer of the Potentiometer 1-Wire Device (returned by `readDevice()`)
  Returns:
    number of potentiometers on this device

### numberOfWiperSettings

    public int numberOfWiperSettings(byte[] state)

  Querys to find the number of wiper settings that any wiper on this Potentiometer 1-Wire Device can have.
  Parameters:
    `state` - state buffer of the Potentiometer 1-Wire Device (returned by `readDevice()`)
  Returns:
    number of wiper positions available

### potentiometerResistance

    public int potentiometerResistance(byte[] state)

  Querys to find the resistance value of the potentiometer.
  Parameters:
    `state` - state buffer of the Potentiometer 1-Wire Device (returned by `readDevice()`)
  Returns:
    resistance value in k-Ohms

### getCurrentWiperNumber

    public 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()`.
  Parameters:
    `state` - state buffer of the Potentiometer 1-Wire Device (returned by `readDevice()`)
  Returns:
    current wiper number

### setCurrentWiperNumber

    public 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()`.
  Parameters:
    `wiper_number` - wiper number to select for communication
    `state` - state buffer of the Potentiometer 1-Wire Device (returned by `readDevice()`)

### isChargePumpOn

    public boolean isChargePumpOn(byte[] state)

  Determines if the Potentiometer's charge pump is enabled.
  Parameters:
    `state` - state buffer of the Potentiometer 1-Wire Device (returned by `readDevice()`)
  Returns:
    `true` if enabled, `false` if not

### setChargePump

    public 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.
  Parameters:
    `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()`)
  Returns:
    `true` if the operation was successful, `false` if there was an error

### getWiperPosition

    public 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.
  Returns:
    wiper position between 0 and `numberOfWiperPositions()`
  Throws:
    `OneWireIOException` - Data was not read correctly
    `OneWireException` - Could not find device

### setWiperPosition

    public boolean setWiperPosition(int position)
                             throws OneWireIOException,
                                    OneWireException

  Sets the wiper position of the potentiometer.
  Parameters:
    `position` - position to set the wiper to
  Returns:
    `true` if the operation was successful, `false` otherwise
  Throws:
    `OneWireIOException` - Data was not written correctly
    `OneWireException` - Could not find device

### increment

    public int increment(boolean reselect)
                  throws OneWireIOException,
                         OneWireException

  Increments the wiper position by one.
  Parameters:
    `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)
  Returns:
    new position of wiper (0 to `numberOfWiperPositions()`)
  Throws:
    `OneWireIOException` - Data was not written correctly
    `OneWireException` - Could not find device

### decrement

    public int decrement(boolean reselect)
                  throws OneWireIOException,
                         OneWireException

  Decrements the wiper position.
  Parameters:
    `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)
  Returns:
    new position of wiper (0 to `numberOfWiperPositions()`).
  Throws:
    `OneWireIOException` - Data was not written correctly
    `OneWireException` - Could not find device

### increment

    public int increment()
                  throws OneWireIOException,
                         OneWireException

  Increments the wiper position after selecting the part.
  Returns:
    new position of wiper (0 to `numberOfWiperPositions()`)
  Throws:
    `OneWireIOException` - Data was not written correctly
    `OneWireException` - Could not find device

### decrement

    public int decrement()
                  throws OneWireIOException,
                         OneWireException

  Decrements the wiper position after selecting the part.
  Returns:
    new position of wiper (0 to `numberOfWiperPositions()`)
  Throws:
    `OneWireIOException` - Data was not written correctly
    `OneWireException` - Could not find device

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD