jcontrol.io
Class GPIO

java.lang.Object
  extended by 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 descriptionspecial use
-12GND
-11V_BATTconnected to battery
-10I2C_SDAcontrolled by I2C
-9I2C_SCLcontrolled by I2C
08PWM0also controlled by PWM, channel 0
17PWM1also controlled by PWM, channel 1
26ADC0also controlled by ADC, channel 0
35ADC1also controlled by ADC, channel 1
44ADC2also controlled by ADC, channel 2
53ADC3also controlled by ADC, channel 3
-2/PWR_ONpower on trigger
-1VCC3.3V

JControl/PLUI (internal)

GPIO #connector pin #pin descriptionspecial use
-1VCC3.3V
02PWM0also controlled by PWM, channel 0
13PWM1also controlled by PWM, channel 1
24ADC0also controlled by ADC, channel 0
35ADC1also controlled by ADC, channel 1
46ADC2also controlled by ADC, channel 2
57ADC3also controlled by ADC, channel 3
-8GND

JControl/SmartDiplay

GPIO #connector pin #pin descriptionspecial use
-1PE0/RS232_TXDcontrolled by RS232
-2PE1/RS232_RXDcontrolled by RS232
-3PE2/RS232_RTScontrolled by RS232Flow
-4PE3/RS232_CTScontrolled by RS232Flow
-5PB4/I2C_SDAcontrolled by I2C
-6PB5/I2C_SCLcontrolled by I2C
07PB0also controlled by PWM, channel 0
18PB1also controlled by PWM, channel 1
-9PB2/BACKLIGHTcontrolled by Backlight
-10PB3/BUZZERcontrolled by Buzzer
-11N.C.not connected
-12GND
 
-24VCC5V
-23KEYno pin
-22/RESETReset input
-21N.C.not connected
220PD0also controlled by ADC, channel 0
319PD1also controlled by ADC, channel 1
418PD2also controlled by ADC, channel 2
517PD3also controlled by ADC, channel 3
616PD4also controlled by ADC, channel 4
715PD5also controlled by ADC, channel 5
814PD6also controlled by ADC, channel 6
913PD7also controlled by ADC, channel 7

JControl/Stamp

GPIO #connector pin #pin descriptionspecial use
-1CANHCAN bus (if Board has tranceiver)
-2CANLCAN bus (if Board has tranceiver)
03PB0also controlled by PWM, channel 0
14PB1also controlled by PWM, channel 1
25PB2also controlled by PWM, channel 2
36PB3also controlled by PWM, channel 3
47PB4/I2C_SDAalso controlled by I2C
58PB5/I2C_SCLalso controlled by I2C
69PB6
710PB7
-17/RESETalso connected to reset button
-18/NMI
2019PE7/CONFIGalso connected to config LED and switch
-20GND
 
-40VCC5V
-39KEYno pin
838PD0also controlled by ADC, channel 0
937PD1also controlled by ADC, channel 1
1036PD2also controlled by ADC, channel 2
1135PD3also controlled by ADC, channel 3
1234PD4also controlled by ADC, channel 4
1333PD5also controlled by ADC, channel 5
1432PD6also controlled by ADC, channel 6
1531PD7also controlled by ADC, channel 7
1624PE0/TDOalso controlled by RS232
1723PE1/RDIalso controlled by RS232
1822PE2/CAN_TXCAN bus, also controlled by CAN
1921PE3/CAN_RXCAN 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)