public class BrickletIO16 extends Device
Modifier and Type | Class and Description |
---|---|
class |
BrickletIO16.EdgeCountConfig |
static interface |
BrickletIO16.InterruptListener
This listener is triggered whenever a change of the voltage level is detected
on pins where the interrupt was activated with
setPortInterrupt(char, short) . |
static interface |
BrickletIO16.MonoflopDoneListener
This listener is triggered whenever a monoflop timer reaches 0.
|
class |
BrickletIO16.PortConfiguration |
class |
BrickletIO16.PortMonoflop |
Device.Identity
Modifier and Type | Field and Description |
---|---|
static String |
DEVICE_DISPLAY_NAME |
static int |
DEVICE_IDENTIFIER |
static char |
DIRECTION_IN |
static char |
DIRECTION_OUT |
static short |
EDGE_TYPE_BOTH |
static short |
EDGE_TYPE_FALLING |
static short |
EDGE_TYPE_RISING |
static byte |
FUNCTION_GET_DEBOUNCE_PERIOD |
static byte |
FUNCTION_GET_EDGE_COUNT |
static byte |
FUNCTION_GET_EDGE_COUNT_CONFIG |
static byte |
FUNCTION_GET_IDENTITY |
static byte |
FUNCTION_GET_PORT |
static byte |
FUNCTION_GET_PORT_CONFIGURATION |
static byte |
FUNCTION_GET_PORT_INTERRUPT |
static byte |
FUNCTION_GET_PORT_MONOFLOP |
static byte |
FUNCTION_SET_DEBOUNCE_PERIOD |
static byte |
FUNCTION_SET_EDGE_COUNT_CONFIG |
static byte |
FUNCTION_SET_PORT |
static byte |
FUNCTION_SET_PORT_CONFIGURATION |
static byte |
FUNCTION_SET_PORT_INTERRUPT |
static byte |
FUNCTION_SET_PORT_MONOFLOP |
static byte |
FUNCTION_SET_SELECTED_VALUES |
Constructor and Description |
---|
BrickletIO16(String uid,
IPConnection ipcon)
Creates an object with the unique device ID \c uid.
|
Modifier and Type | Method and Description |
---|---|
void |
addInterruptListener(BrickletIO16.InterruptListener listener)
Adds a Interrupt listener.
|
void |
addMonoflopDoneListener(BrickletIO16.MonoflopDoneListener listener)
Adds a MonoflopDone listener.
|
long |
getDebouncePeriod()
Returns the debounce period as set by
setDebouncePeriod(long) . |
long |
getEdgeCount(short pin,
boolean resetCounter)
Returns the current value of the edge counter for the selected pin on port A.
|
BrickletIO16.EdgeCountConfig |
getEdgeCountConfig(short pin)
Returns the edge type and debounce time for the selected pin of port A as set by
setEdgeCountConfig(short, short, short) . |
Device.Identity |
getIdentity()
Returns the UID, the UID where the Bricklet is connected to,
the position, the hardware and firmware version as well as the
device identifier.
|
short |
getPort(char port)
Returns a bitmask of the values that are currently measured on the
specified port.
|
BrickletIO16.PortConfiguration |
getPortConfiguration(char port)
Returns a direction bitmask and a value bitmask for the specified port.
|
short |
getPortInterrupt(char port)
Returns the interrupt bitmask for the specified port as set by
setPortInterrupt(char, short) . |
BrickletIO16.PortMonoflop |
getPortMonoflop(char port,
short pin)
Returns (for the given pin) the current value and the time as set by
setPortMonoflop(char, short, short, long) as well as the remaining time until the value flips. |
void |
removeInterruptListener(BrickletIO16.InterruptListener listener)
Removes a Interrupt listener.
|
void |
removeMonoflopDoneListener(BrickletIO16.MonoflopDoneListener listener)
Removes a MonoflopDone listener.
|
void |
setDebouncePeriod(long debounce)
Sets the debounce period of the
BrickletIO16.InterruptListener listener. |
void |
setEdgeCountConfig(short pin,
short edgeType,
short debounce)
Configures the edge counter for the selected pin of port A.
|
void |
setPort(char port,
short valueMask)
Sets the output value (high or low) for a port ("a" or "b") with a bitmask
(8bit).
|
void |
setPortConfiguration(char port,
short selectionMask,
char direction,
boolean value)
Configures the value and direction of a specified port.
|
void |
setPortInterrupt(char port,
short interruptMask)
Sets the pins on which an interrupt is activated with a bitmask.
|
void |
setPortMonoflop(char port,
short selectionMask,
short valueMask,
long time)
Configures a monoflop of the pins specified by the second parameter as 8 bit
long bitmask.
|
void |
setSelectedValues(char port,
short selectionMask,
short valueMask)
Sets the output value (high or low) for a port ("a" or "b" with a bitmask,
according to the selection mask.
|
getAPIVersion, getResponseExpected, setResponseExpected, setResponseExpectedAll
public static final int DEVICE_IDENTIFIER
public static final String DEVICE_DISPLAY_NAME
public static final byte FUNCTION_SET_PORT
public static final byte FUNCTION_GET_PORT
public static final byte FUNCTION_SET_PORT_CONFIGURATION
public static final byte FUNCTION_GET_PORT_CONFIGURATION
public static final byte FUNCTION_SET_DEBOUNCE_PERIOD
public static final byte FUNCTION_GET_DEBOUNCE_PERIOD
public static final byte FUNCTION_SET_PORT_INTERRUPT
public static final byte FUNCTION_GET_PORT_INTERRUPT
public static final byte FUNCTION_SET_PORT_MONOFLOP
public static final byte FUNCTION_GET_PORT_MONOFLOP
public static final byte FUNCTION_SET_SELECTED_VALUES
public static final byte FUNCTION_GET_EDGE_COUNT
public static final byte FUNCTION_SET_EDGE_COUNT_CONFIG
public static final byte FUNCTION_GET_EDGE_COUNT_CONFIG
public static final byte FUNCTION_GET_IDENTITY
public static final char DIRECTION_IN
public static final char DIRECTION_OUT
public static final short EDGE_TYPE_RISING
public static final short EDGE_TYPE_FALLING
public static final short EDGE_TYPE_BOTH
public BrickletIO16(String uid, IPConnection ipcon)
public void setPort(char port, short valueMask) throws TinkerforgeException
setPortConfiguration(char, short, char, boolean)
.TinkerforgeException
public short getPort(char port) throws TinkerforgeException
TinkerforgeException
public void setPortConfiguration(char port, short selectionMask, char direction, boolean value) throws TinkerforgeException
TinkerforgeException
public BrickletIO16.PortConfiguration getPortConfiguration(char port) throws TinkerforgeException
TinkerforgeException
public void setDebouncePeriod(long debounce) throws TinkerforgeException
BrickletIO16.InterruptListener
listener.
For example: If you set this value to 100, you will get the interrupt
maximal every 100ms. This is necessary if something that bounces is
connected to the IO-16 Bricklet, such as a button.TinkerforgeException
public long getDebouncePeriod() throws TinkerforgeException
setDebouncePeriod(long)
.TinkerforgeException
public void setPortInterrupt(char port, short interruptMask) throws TinkerforgeException
BrickletIO16.InterruptListener
listener.TinkerforgeException
public short getPortInterrupt(char port) throws TinkerforgeException
setPortInterrupt(char, short)
.TinkerforgeException
public void setPortMonoflop(char port, short selectionMask, short valueMask, long time) throws TinkerforgeException
TinkerforgeException
public BrickletIO16.PortMonoflop getPortMonoflop(char port, short pin) throws TinkerforgeException
setPortMonoflop(char, short, short, long)
as well as the remaining time until the value flips.
If the timer is not running currently, the remaining time will be returned
as 0.TinkerforgeException
public void setSelectedValues(char port, short selectionMask, short valueMask) throws TinkerforgeException
setPortConfiguration(char, short, char, boolean)
.TinkerforgeException
public long getEdgeCount(short pin, boolean resetCounter) throws TinkerforgeException
setEdgeCountConfig(short, short, short)
.
If you set the reset counter to *true*, the count is set back to 0
directly after it is read.
.. versionadded:: 2.0.3$nbsp;(Plugin)TinkerforgeException
public void setEdgeCountConfig(short pin, short edgeType, short debounce) throws TinkerforgeException
TinkerforgeException
public BrickletIO16.EdgeCountConfig getEdgeCountConfig(short pin) throws TinkerforgeException
setEdgeCountConfig(short, short, short)
.
.. versionadded:: 2.0.3$nbsp;(Plugin)TinkerforgeException
public Device.Identity getIdentity() throws TinkerforgeException
getIdentity
in class Device
TinkerforgeException
public void addInterruptListener(BrickletIO16.InterruptListener listener)
public void removeInterruptListener(BrickletIO16.InterruptListener listener)
public void addMonoflopDoneListener(BrickletIO16.MonoflopDoneListener listener)
public void removeMonoflopDoneListener(BrickletIO16.MonoflopDoneListener listener)
Copyright © 2021 Tinkerforge GmbH. All rights reserved.