public class BrickletHallEffect extends Device
Modifier and Type | Class and Description |
---|---|
class |
BrickletHallEffect.EdgeCountConfig |
static interface |
BrickletHallEffect.EdgeCountListener
This listener is triggered periodically with the period that is set by
setEdgeCountCallbackPeriod(long) . |
class |
BrickletHallEffect.EdgeInterrupt |
Device.Identity
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEVICE_DISPLAY_NAME |
static int |
DEVICE_IDENTIFIER |
static short |
EDGE_TYPE_BOTH |
static short |
EDGE_TYPE_FALLING |
static short |
EDGE_TYPE_RISING |
static byte |
FUNCTION_EDGE_INTERRUPT |
static byte |
FUNCTION_GET_EDGE_COUNT |
static byte |
FUNCTION_GET_EDGE_COUNT_CALLBACK_PERIOD |
static byte |
FUNCTION_GET_EDGE_COUNT_CONFIG |
static byte |
FUNCTION_GET_EDGE_INTERRUPT |
static byte |
FUNCTION_GET_IDENTITY |
static byte |
FUNCTION_GET_VALUE |
static byte |
FUNCTION_SET_EDGE_COUNT_CALLBACK_PERIOD |
static byte |
FUNCTION_SET_EDGE_COUNT_CONFIG |
static byte |
FUNCTION_SET_EDGE_INTERRUPT |
Constructor and Description |
---|
BrickletHallEffect(java.lang.String uid,
IPConnection ipcon)
Creates an object with the unique device ID \c uid.
|
Modifier and Type | Method and Description |
---|---|
void |
addEdgeCountListener(BrickletHallEffect.EdgeCountListener listener)
Adds a EdgeCount listener.
|
BrickletHallEffect.EdgeInterrupt |
edgeInterrupt()
This listener is triggered every n-th count, as configured with
setEdgeInterrupt(long) . |
long |
getEdgeCount(boolean resetCounter)
Returns the current value of the edge counter.
|
long |
getEdgeCountCallbackPeriod()
Returns the period as set by
setEdgeCountCallbackPeriod(long) . |
BrickletHallEffect.EdgeCountConfig |
getEdgeCountConfig()
Returns the edge type and debounce time as set by
setEdgeCountConfig(short, short) . |
long |
getEdgeInterrupt()
Returns the edges as set by
setEdgeInterrupt(long) . |
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.
|
boolean |
getValue()
Returns *true* if a magnetic field of 3.5 millitesla or greater is detected.
|
void |
removeEdgeCountListener(BrickletHallEffect.EdgeCountListener listener)
Removes a EdgeCount listener.
|
void |
setEdgeCountCallbackPeriod(long period)
Sets the period with which the
BrickletHallEffect.EdgeCountListener listener is triggered
periodically. |
void |
setEdgeCountConfig(short edgeType,
short debounce)
The edge type parameter configures if rising edges, falling edges or
both are counted.
|
void |
setEdgeInterrupt(long edges)
Sets the number of edges until an interrupt is invoked.
|
getAPIVersion, getResponseExpected, setResponseExpected, setResponseExpectedAll
public static final int DEVICE_IDENTIFIER
public static final java.lang.String DEVICE_DISPLAY_NAME
public static final byte FUNCTION_GET_VALUE
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_SET_EDGE_INTERRUPT
public static final byte FUNCTION_GET_EDGE_INTERRUPT
public static final byte FUNCTION_SET_EDGE_COUNT_CALLBACK_PERIOD
public static final byte FUNCTION_GET_EDGE_COUNT_CALLBACK_PERIOD
public static final byte FUNCTION_EDGE_INTERRUPT
public static final byte FUNCTION_GET_IDENTITY
public static final short EDGE_TYPE_RISING
public static final short EDGE_TYPE_FALLING
public static final short EDGE_TYPE_BOTH
public BrickletHallEffect(java.lang.String uid, IPConnection ipcon)
public boolean getValue() throws TinkerforgeException
TinkerforgeException
public long getEdgeCount(boolean resetCounter) throws TinkerforgeException
setEdgeCountConfig(short, short)
.
If you set the reset counter to *true*, the count is set back to 0
directly after it is read.TinkerforgeException
public void setEdgeCountConfig(short edgeType, short debounce) throws TinkerforgeException
TinkerforgeException
public BrickletHallEffect.EdgeCountConfig getEdgeCountConfig() throws TinkerforgeException
setEdgeCountConfig(short, short)
.TinkerforgeException
public void setEdgeInterrupt(long edges) throws TinkerforgeException
TinkerforgeException
public long getEdgeInterrupt() throws TinkerforgeException
setEdgeInterrupt(long)
.TinkerforgeException
public void setEdgeCountCallbackPeriod(long period) throws TinkerforgeException
BrickletHallEffect.EdgeCountListener
listener is triggered
periodically. A value of 0 turns the listener off.
The BrickletHallEffect.EdgeCountListener
listener is only triggered if the edge count has changed
since the last triggering.TinkerforgeException
public long getEdgeCountCallbackPeriod() throws TinkerforgeException
setEdgeCountCallbackPeriod(long)
.TinkerforgeException
public BrickletHallEffect.EdgeInterrupt edgeInterrupt() throws TinkerforgeException
setEdgeInterrupt(long)
. The parameters are the
current count and the current value (see getValue()
and
getEdgeCount(boolean)
).TinkerforgeException
public Device.Identity getIdentity() throws TinkerforgeException
getIdentity
in class Device
TinkerforgeException
public void addEdgeCountListener(BrickletHallEffect.EdgeCountListener listener)
public void removeEdgeCountListener(BrickletHallEffect.EdgeCountListener listener)
Copyright © 2021 Tinkerforge GmbH. All rights reserved.