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

## jcontrol.io
Class GPIO

    java.lang.Object
      jcontrol.io.GPIO

    public class GPIO

extends Object

Controls JControls available portpins.

The number of ports varies at JControl Modules, for details refer to the tables below.

### JControl/Sticker

`GPIO` # | connector pin # | pin description | special use
--- | --- | --- | ---
- | 12 | `GND`
- | 11 | `V_BATT` | connected to battery
- | 10 | `I2C_SDA` | controlled by `I2C`
- | 9 | `I2C_SCL` | controlled by `I2C`
0 | 8 | `PWM0` | also controlled by `PWM`, channel 0
1 | 7 | `PWM1` | also controlled by `PWM`, channel 1
2 | 6 | `ADC0` | also controlled by `ADC`, channel 0
3 | 5 | `ADC1` | also controlled by `ADC`, channel 1
4 | 4 | `ADC2` | also controlled by `ADC`, channel 2
5 | 3 | `ADC3` | also controlled by `ADC`, channel 3
- | 2 | `/PWR_ON` | power on trigger
- | 1 | `VCC` | 3.3V

### JControl/PLUI (internal)

`GPIO` # | connector pin # | pin description | special use
--- | --- | --- | ---
- | 1 | `VCC` | 3.3V
0 | 2 | `PWM0` | also controlled by `PWM`, channel 0
1 | 3 | `PWM1` | also controlled by `PWM`, channel 1
2 | 4 | `ADC0` | also controlled by `ADC`, channel 0
3 | 5 | `ADC1` | also controlled by `ADC`, channel 1
4 | 6 | `ADC2` | also controlled by `ADC`, channel 2
5 | 7 | `ADC3` | also controlled by `ADC`, channel 3
- | 8 | `GND`

### JControl/SmartDiplay

`GPIO` # | connector pin # | pin description | special use
--- | --- | --- | ---
- | 1 | `PE0/RS232_TXD` | controlled by `RS232`
- | 2 | `PE1/RS232_RXD` | controlled by `RS232`
- | 3 | `PE2/RS232_RTS` | controlled by `RS232Flow`
- | 4 | `PE3/RS232_CTS` | controlled by `RS232Flow`
- | 5 | `PB4/I2C_SDA` | controlled by `I2C`
- | 6 | `PB5/I2C_SCL` | controlled by `I2C`
0 | 7 | `PB0` | also controlled by `PWM`, channel 0
1 | 8 | `PB1` | also controlled by `PWM`, channel 1
- | 9 | `PB2/BACKLIGHT` | controlled by `Backlight`
- | 10 | `PB3/BUZZER` | controlled by `Buzzer`
- | 11 | `N.C.` | not connected
- | 12 | `GND`
- | 24 | `VCC` | 5V
- | 23 | `KEY` | no pin
- | 22 | `/RESET` | Reset input
- | 21 | `N.C.` | not connected
2 | 20 | `PD0` | also controlled by `ADC`, channel 0
3 | 19 | `PD1` | also controlled by `ADC`, channel 1
4 | 18 | `PD2` | also controlled by `ADC`, channel 2
5 | 17 | `PD3` | also controlled by `ADC`, channel 3
6 | 16 | `PD4` | also controlled by `ADC`, channel 4
7 | 15 | `PD5` | also controlled by `ADC`, channel 5
8 | 14 | `PD6` | also controlled by `ADC`, channel 6
9 | 13 | `PD7` | also controlled by `ADC`, channel 7

### JControl/Stamp

`GPIO` # | connector pin # | pin description | special use
--- | --- | --- | ---
- | 1 | `CANH` | CAN bus (if Board has tranceiver)
- | 2 | `CANL` | CAN bus (if Board has tranceiver)
0 | 3 | `PB0` | also controlled by `PWM`, channel 0
1 | 4 | `PB1` | also controlled by `PWM`, channel 1
2 | 5 | `PB2` | also controlled by `PWM`, channel 2
3 | 6 | `PB3` | also controlled by `PWM`, channel 3
4 | 7 | `PB4/I2C_SDA` | also controlled by `I2C`
5 | 8 | `PB5/I2C_SCL` | also controlled by `I2C`
6 | 9 | `PB6`
7 | 10 | `PB7`
- | 17 | `/RESET` | also connected to reset button
- | 18 | `/NMI`
20 | 19 | `PE7/CONFIG` | also connected to config LED and switch
- | 20 | `GND`
- | 40 | `VCC` | 5V
- | 39 | `KEY` | no pin
8 | 38 | `PD0` | also controlled by `ADC`, channel 0
9 | 37 | `PD1` | also controlled by `ADC`, channel 1
10 | 36 | `PD2` | also controlled by `ADC`, channel 2
11 | 35 | `PD3` | also controlled by `ADC`, channel 3
12 | 34 | `PD4` | also controlled by `ADC`, channel 4
13 | 33 | `PD5` | also controlled by `ADC`, channel 5
14 | 32 | `PD6` | also controlled by `ADC`, channel 6
15 | 31 | `PD7` | also controlled by `ADC`, channel 7
16 | 24 | `PE0/TDO` | also controlled by `RS232`
17 | 23 | `PE1/RDI` | also controlled by `RS232`
18 | 22 | `PE2/CAN_TX` | CAN bus, also controlled by `CAN`
19 | 21 | `PE3/CAN_RX` | CAN bus, also controlled by `CAN`

Author:
  Andreas Wesseler, Marcus Timmermann
Available on JControl Devices:

  all

Field Summary
`static int` | `FLOATING` Represents a floating GPIO input mode.
`static boolean` | `HIGH` Represents the GPIO state "HIGH".
`static boolean` | `LOW` Represents the GPIO state "LOW" Used for input and output channels.
`static int` | `OPENDRAIN` Represents an GPIO output mode with with integrated pullup resistor.
`static int` | `OPENDRAIN_HIGH` Represents a GPIO output mode with with integrated pullup resistor.
`static int` | `OPENDRAIN_LOW` Represents a GPIO output mode with with integrated pullup resistor.
`static int` | `PULLUP` Represents a GPIO input mode with integrated weak pullup resistor.
`static int` | `PUSHPULL` Represents a GPIO Push/Pull output mode.
`static int` | `PUSHPULL_HIGH` Represents a GPIO Push/Pull output mode.
`static int` | `PUSHPULL_LOW` Represents a GPIO Push/Pull output mode.

Method Summary
`static int` | `getMode(int channel)` Gets the mode of the given pin.
`static boolean` | `getState(int channel)` Gets the state of a single IO-Pin.
`static void` | `setMode(int channel, int mode)` Sets the mode of the given pin.
`static void` | `setState(int channel, boolean state)` Sets a single IO-Pin.

Methods inherited from class java.lang.Object
`clone, equals, notifyAll, wait`

Field Detail

### FLOATING

    public static final int FLOATING

  Represents a floating GPIO input mode.

  See Also:
    `setMode(int, int)`, `getMode(int)`, Constant Field Values

### HIGH

    public static final boolean HIGH

  Represents the GPIO state "HIGH". Used for input and output channels.

  See Also:
    `setState(int, boolean)`, `getState(int)`, Constant Field Values

### LOW

    public static final boolean LOW

  Represents the GPIO state "LOW" Used for input and output channels.

  See Also:
    `setState(int, boolean)`, `getState(int)`, Constant Field Values

### OPENDRAIN

    public static final int OPENDRAIN

  Represents an GPIO output mode with with integrated pullup resistor. The GPIO's output state is undefined.

  See Also:
    `setMode(int, int)`, `getMode(int)`, Constant Field Values

### OPENDRAIN_HIGH

    public static final int OPENDRAIN_HIGH

  Represents a GPIO output mode with with integrated pullup resistor. The GPIO's output state is "HIGH".

  See Also:
    `setMode(int, int)`, `getMode(int)`, Constant Field Values

### OPENDRAIN_LOW

    public static final int OPENDRAIN_LOW

  Represents a GPIO output mode with with integrated pullup resistor. The GPIO's output state is "LOW".

  See Also:
    `setMode(int, int)`, `getMode(int)`, Constant Field Values

### PULLUP

    public static final int PULLUP

  Represents a GPIO input mode with integrated weak pullup resistor.

  See Also:
    `setMode(int, int)`, `getMode(int)`, Constant Field Values

### PUSHPULL

    public static final int PUSHPULL

  Represents a GPIO Push/Pull output mode. The GPIO's output state is undefined.

  See Also:
    `setMode(int, int)`, `getMode(int)`, Constant Field Values

### PUSHPULL_HIGH

    public static final int PUSHPULL_HIGH

  Represents a GPIO Push/Pull output mode. The GPIO's output state is "LOW".

  See Also:
    `setMode(int, int)`, `getMode(int)`, Constant Field Values

### PUSHPULL_LOW

    public static final int PUSHPULL_LOW

  Represents a GPIO Push/Pull output mode. The GPIO's output state is "LOW".

  See Also:
    `setMode(int, int)`, `getMode(int)`, Constant Field Values

Method Detail

### getMode

    public static int getMode(int channel)

  Gets the mode of the given pin. The GPIO channel has to be chosen from the tables above. Returned `mode` is a combination of input or output mode identifier and a pin level representation.

  Parameters:
    `channel` - logical identification number of the pin
  Returns:
    the current mode
  See Also:
    `setMode(int channel, int mode)`, `FLOATING`, `PULLUP`, `OPENDRAIN`, `OPENDRAIN_LOW`, `OPENDRAIN_HIGH`, `PUSHPULL`, `PUSHPULL_LOW`, `PUSHPULL_HIGH`

### getState

    public static boolean getState(int channel)

  Gets the state of a single IO-Pin. The GPIO channel has to be chosen from the tables above.

  Parameters:
    `channel` - logical identification number of the pin
  Returns:
    the level of the selected pin, equals `HIGH` or `LOW`.
  See Also:
    `HIGH`, `LOW`

### setMode

    public static void setMode(int channel,
                               int mode)

  Sets the mode of the given pin. The GPIO channel has to be chosen from the tables above. `mode` is either an input mode identifier or a combination of output mode identifier and a pin level representation.

  Parameters:
    `channel` - logical identification number of the pin
    `mode` - a constant or combination of constants, defined in this class
  See Also:
    `getMode(int)`, `FLOATING`, `PULLUP`, `OPENDRAIN`, `OPENDRAIN_LOW`, `OPENDRAIN_HIGH`, `PUSHPULL`, `PUSHPULL_LOW`, `PUSHPULL_HIGH`

### setState

    public static void setState(int channel,
                                boolean state)

  Sets a single IO-Pin. The GPIO channel has to be chosen from the tables above. The channel has to be in output mode.

  Parameters:
    `channel` - logical identification number of the pin
    `state` - decides, if the Pin is to be turned `ON` or `OFF`
  See Also:
    `HIGH`, `LOW`, `setMode(int, int)`

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