public class BrickletIO16V2 extends Device
Modifier and Type | Class and Description |
---|---|
class |
BrickletIO16V2.AllInputValueCallbackConfiguration |
static interface |
BrickletIO16V2.AllInputValueListener
This listener is triggered periodically according to the configuration set by
setAllInputValueCallbackConfiguration(long, boolean) . |
class |
BrickletIO16V2.Configuration |
class |
BrickletIO16V2.EdgeCountConfiguration |
class |
BrickletIO16V2.InputValueCallbackConfiguration |
static interface |
BrickletIO16V2.InputValueListener
This listener is triggered periodically according to the configuration set by
setInputValueCallbackConfiguration(int, long, boolean) . |
class |
BrickletIO16V2.Monoflop |
static interface |
BrickletIO16V2.MonoflopDoneListener
This listener is triggered whenever a monoflop timer reaches 0.
|
class |
BrickletIO16V2.SPITFPErrorCount |
Device.Identity
Constructor and Description |
---|
BrickletIO16V2(java.lang.String uid,
IPConnection ipcon)
Creates an object with the unique device ID \c uid.
|
Modifier and Type | Method and Description |
---|---|
void |
addAllInputValueListener(BrickletIO16V2.AllInputValueListener listener)
Adds a AllInputValue listener.
|
void |
addInputValueListener(BrickletIO16V2.InputValueListener listener)
Adds a InputValue listener.
|
void |
addMonoflopDoneListener(BrickletIO16V2.MonoflopDoneListener listener)
Adds a MonoflopDone listener.
|
BrickletIO16V2.AllInputValueCallbackConfiguration |
getAllInputValueCallbackConfiguration()
Returns the listener configuration as set by
setAllInputValueCallbackConfiguration(long, boolean) . |
int |
getBootloaderMode()
Returns the current bootloader mode, see
setBootloaderMode(int) . |
int |
getChipTemperature()
Returns the temperature as measured inside the microcontroller.
|
BrickletIO16V2.Configuration |
getConfiguration(int channel)
Returns the channel configuration as set by
setConfiguration(int, char, boolean) . |
long |
getEdgeCount(int channel,
boolean resetCounter)
Returns the current value of the edge counter for the selected channel.
|
BrickletIO16V2.EdgeCountConfiguration |
getEdgeCountConfiguration(int channel)
Returns the edge type and debounce time for the selected channel as set by
setEdgeCountConfiguration(int, int, int) . |
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.
|
BrickletIO16V2.InputValueCallbackConfiguration |
getInputValueCallbackConfiguration(int channel)
Returns the listener configuration as set by
setInputValueCallbackConfiguration(int, long, boolean) . |
BrickletIO16V2.Monoflop |
getMonoflop(int channel)
Returns (for the given channel) the current value and the time as set by
setMonoflop(int, boolean, long) as well as the remaining time until the value flips. |
BrickletIO16V2.SPITFPErrorCount |
getSPITFPErrorCount()
Returns the error count for the communication between Brick and Bricklet.
|
int |
getStatusLEDConfig()
Returns the configuration as set by
setStatusLEDConfig(int) |
boolean[] |
getValue()
Returns the logic levels that are currently measured on the channels.
|
long |
readUID()
Returns the current UID as an integer.
|
void |
removeAllInputValueListener(BrickletIO16V2.AllInputValueListener listener)
Removes a AllInputValue listener.
|
void |
removeInputValueListener(BrickletIO16V2.InputValueListener listener)
Removes a InputValue listener.
|
void |
removeMonoflopDoneListener(BrickletIO16V2.MonoflopDoneListener listener)
Removes a MonoflopDone listener.
|
void |
reset()
Calling this function will reset the Bricklet.
|
void |
setAllInputValueCallbackConfiguration(long period,
boolean valueHasToChange)
The period is the period with which the
BrickletIO16V2.AllInputValueListener
listener is triggered periodically. |
int |
setBootloaderMode(int mode)
Sets the bootloader mode and returns the status after the requested
mode change was instigated.
|
void |
setConfiguration(int channel,
char direction,
boolean value)
Configures the value and direction of a specific channel.
|
void |
setEdgeCountConfiguration(int channel,
int edgeType,
int debounce)
Configures the edge counter for a specific channel.
|
void |
setInputValueCallbackConfiguration(int channel,
long period,
boolean valueHasToChange)
This listener can be configured per channel.
|
void |
setMonoflop(int channel,
boolean value,
long time)
Configures a monoflop of the specified channel.
|
void |
setSelectedValue(int channel,
boolean value)
Sets the output value of a specific channel without affecting the other channels.
|
void |
setStatusLEDConfig(int config)
Sets the status LED configuration.
|
void |
setValue(boolean[] value)
Sets the output value of all sixteen channels.
|
void |
setWriteFirmwarePointer(long pointer)
Sets the firmware pointer for
writeFirmware(int[]) . |
int |
writeFirmware(int[] data)
Writes 64 Bytes of firmware at the position as written by
setWriteFirmwarePointer(long) before. |
void |
writeUID(long uid)
Writes a new UID into flash.
|
getAPIVersion, getResponseExpected, setResponseExpected, setResponseExpectedAll
public static final int DEVICE_IDENTIFIER
public static final java.lang.String DEVICE_DISPLAY_NAME
public static final byte FUNCTION_SET_VALUE
public static final byte FUNCTION_GET_VALUE
public static final byte FUNCTION_SET_SELECTED_VALUE
public static final byte FUNCTION_SET_CONFIGURATION
public static final byte FUNCTION_GET_CONFIGURATION
public static final byte FUNCTION_SET_INPUT_VALUE_CALLBACK_CONFIGURATION
public static final byte FUNCTION_GET_INPUT_VALUE_CALLBACK_CONFIGURATION
public static final byte FUNCTION_SET_ALL_INPUT_VALUE_CALLBACK_CONFIGURATION
public static final byte FUNCTION_GET_ALL_INPUT_VALUE_CALLBACK_CONFIGURATION
public static final byte FUNCTION_SET_MONOFLOP
public static final byte FUNCTION_GET_MONOFLOP
public static final byte FUNCTION_GET_EDGE_COUNT
public static final byte FUNCTION_SET_EDGE_COUNT_CONFIGURATION
public static final byte FUNCTION_GET_EDGE_COUNT_CONFIGURATION
public static final byte FUNCTION_GET_SPITFP_ERROR_COUNT
public static final byte FUNCTION_SET_BOOTLOADER_MODE
public static final byte FUNCTION_GET_BOOTLOADER_MODE
public static final byte FUNCTION_SET_WRITE_FIRMWARE_POINTER
public static final byte FUNCTION_WRITE_FIRMWARE
public static final byte FUNCTION_SET_STATUS_LED_CONFIG
public static final byte FUNCTION_GET_STATUS_LED_CONFIG
public static final byte FUNCTION_GET_CHIP_TEMPERATURE
public static final byte FUNCTION_RESET
public static final byte FUNCTION_WRITE_UID
public static final byte FUNCTION_READ_UID
public static final byte FUNCTION_GET_IDENTITY
public static final char DIRECTION_IN
public static final char DIRECTION_OUT
public static final int EDGE_TYPE_RISING
public static final int EDGE_TYPE_FALLING
public static final int EDGE_TYPE_BOTH
public static final int BOOTLOADER_MODE_BOOTLOADER
public static final int BOOTLOADER_MODE_FIRMWARE
public static final int BOOTLOADER_MODE_BOOTLOADER_WAIT_FOR_REBOOT
public static final int BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_REBOOT
public static final int BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_ERASE_AND_REBOOT
public static final int BOOTLOADER_STATUS_OK
public static final int BOOTLOADER_STATUS_INVALID_MODE
public static final int BOOTLOADER_STATUS_NO_CHANGE
public static final int BOOTLOADER_STATUS_ENTRY_FUNCTION_NOT_PRESENT
public static final int BOOTLOADER_STATUS_DEVICE_IDENTIFIER_INCORRECT
public static final int BOOTLOADER_STATUS_CRC_MISMATCH
public static final int STATUS_LED_CONFIG_OFF
public static final int STATUS_LED_CONFIG_ON
public static final int STATUS_LED_CONFIG_SHOW_HEARTBEAT
public static final int STATUS_LED_CONFIG_SHOW_STATUS
public BrickletIO16V2(java.lang.String uid, IPConnection ipcon)
public void setValue(boolean[] value) throws TinkerforgeException
setSelectedValue(int, boolean)
to change only one output channel state.
For example: (True, True, False, False, ..., False) will turn the channels 0-1
high and the channels 2-15 low.
All running monoflop timers will be aborted if this function is called.
\note
This function does nothing for channels that are configured as input. Pull-up
resistors can be switched on with setConfiguration(int, char, boolean)
.TinkerforgeException
public boolean[] getValue() throws TinkerforgeException
TinkerforgeException
public void setSelectedValue(int channel, boolean value) throws TinkerforgeException
setConfiguration(int, char, boolean)
.TinkerforgeException
public void setConfiguration(int channel, char direction, boolean value) throws TinkerforgeException
TinkerforgeException
public BrickletIO16V2.Configuration getConfiguration(int channel) throws TinkerforgeException
setConfiguration(int, char, boolean)
.TinkerforgeException
public void setInputValueCallbackConfiguration(int channel, long period, boolean valueHasToChange) throws TinkerforgeException
BrickletIO16V2.InputValueListener
listener is triggered periodically. A value of 0 turns the listener off.
If the `value has to change`-parameter is set to true, the listener is only
triggered after the value has changed. If the value didn't change within the
period, the listener is triggered immediately on change.
If it is set to false, the listener is continuously triggered with the period,
independent of the value.TinkerforgeException
public BrickletIO16V2.InputValueCallbackConfiguration getInputValueCallbackConfiguration(int channel) throws TinkerforgeException
setInputValueCallbackConfiguration(int, long, boolean)
.TinkerforgeException
public void setAllInputValueCallbackConfiguration(long period, boolean valueHasToChange) throws TinkerforgeException
BrickletIO16V2.AllInputValueListener
listener is triggered periodically. A value of 0 turns the listener off.
If the `value has to change`-parameter is set to true, the listener is only
triggered after the value has changed. If the value didn't change within the
period, the listener is triggered immediately on change.
If it is set to false, the listener is continuously triggered with the period,
independent of the value.TinkerforgeException
public BrickletIO16V2.AllInputValueCallbackConfiguration getAllInputValueCallbackConfiguration() throws TinkerforgeException
setAllInputValueCallbackConfiguration(long, boolean)
.TinkerforgeException
public void setMonoflop(int channel, boolean value, long time) throws TinkerforgeException
TinkerforgeException
public BrickletIO16V2.Monoflop getMonoflop(int channel) throws TinkerforgeException
setMonoflop(int, boolean, 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 long getEdgeCount(int channel, boolean resetCounter) throws TinkerforgeException
setEdgeCountConfiguration(int, int, int)
.
If you set the reset counter to *true*, the count is set back to 0
directly after it is read.TinkerforgeException
public void setEdgeCountConfiguration(int channel, int edgeType, int debounce) throws TinkerforgeException
TinkerforgeException
public BrickletIO16V2.EdgeCountConfiguration getEdgeCountConfiguration(int channel) throws TinkerforgeException
setEdgeCountConfiguration(int, int, int)
.TinkerforgeException
public BrickletIO16V2.SPITFPErrorCount getSPITFPErrorCount() throws TinkerforgeException
TinkerforgeException
public int setBootloaderMode(int mode) throws TinkerforgeException
TinkerforgeException
public int getBootloaderMode() throws TinkerforgeException
setBootloaderMode(int)
.TinkerforgeException
public void setWriteFirmwarePointer(long pointer) throws TinkerforgeException
writeFirmware(int[])
. The pointer has
to be increased by chunks of size 64. The data is written to flash
every 4 chunks (which equals to one page of size 256).
This function is used by Brick Viewer during flashing. It should not be
necessary to call it in a normal user program.TinkerforgeException
public int writeFirmware(int[] data) throws TinkerforgeException
setWriteFirmwarePointer(long)
before. The firmware is written
to flash every 4 chunks.
You can only write firmware in bootloader mode.
This function is used by Brick Viewer during flashing. It should not be
necessary to call it in a normal user program.TinkerforgeException
public void setStatusLEDConfig(int config) throws TinkerforgeException
TinkerforgeException
public int getStatusLEDConfig() throws TinkerforgeException
setStatusLEDConfig(int)
TinkerforgeException
public int getChipTemperature() throws TinkerforgeException
TinkerforgeException
public void reset() throws TinkerforgeException
TinkerforgeException
public void writeUID(long uid) throws TinkerforgeException
TinkerforgeException
public long readUID() throws TinkerforgeException
TinkerforgeException
public Device.Identity getIdentity() throws TinkerforgeException
getIdentity
in class Device
TinkerforgeException
public void addInputValueListener(BrickletIO16V2.InputValueListener listener)
public void removeInputValueListener(BrickletIO16V2.InputValueListener listener)
public void addAllInputValueListener(BrickletIO16V2.AllInputValueListener listener)
public void removeAllInputValueListener(BrickletIO16V2.AllInputValueListener listener)
public void addMonoflopDoneListener(BrickletIO16V2.MonoflopDoneListener listener)
public void removeMonoflopDoneListener(BrickletIO16V2.MonoflopDoneListener listener)
Copyright © 2020 Tinkerforge GmbH. All rights reserved.