|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object lejos.nxt.I2CSensor lejos.nxt.addon.TouchPanel
public class TouchPanel
This Class manages the MINDSENSORS Touch Panel.
Nested Class Summary | |
---|---|
class |
TouchPanel.VirtualButton
The inner class VirtualButton is used to read the touch panel 8 virtual buttons. |
Field Summary | |
---|---|
static byte |
BTN_L1
|
static byte |
BTN_L2
|
static byte |
BTN_L3
|
static byte |
BTN_L4
|
static byte |
BTN_R1
|
static byte |
BTN_R2
|
static byte |
BTN_R3
|
static byte |
BTN_R4
|
TouchPanel.VirtualButton |
L1
Virtual button 1 at left (topmost) |
TouchPanel.VirtualButton |
L2
Virtual button 2 at left |
TouchPanel.VirtualButton |
L3
Virtual button 3 at left |
TouchPanel.VirtualButton |
L4
Virtual button 4 at left (downmost) |
TouchPanel.VirtualButton |
R1
Virtual button 1 at right (topmost) |
TouchPanel.VirtualButton |
R2
Virtual button 2 at right |
TouchPanel.VirtualButton |
R3
Virtual button 3 at right |
TouchPanel.VirtualButton |
R4
Virtual button 4 at right (downmost) |
Fields inherited from class lejos.nxt.I2CSensor |
---|
address, DEFAULT_I2C_ADDRESS, port, REG_PRODUCT_ID, REG_VENDOR_ID, REG_VERSION |
Fields inherited from interface lejos.nxt.SensorConstants |
---|
BLACK, BLANK_INDEX, BLUE, BLUE_INDEX, GREEN, GREEN_INDEX, MAX_AD_RAW, MAX_TYPE, MIN_TYPE, MODE_ANGLESTEP, MODE_BOOLEAN, MODE_CELSIUS, MODE_FARENHEIT, MODE_PCTFULLSCALE, MODE_PERIODCOUNTER, MODE_RAW, MODE_TRANSITIONCNT, RED, RED_INDEX, TYPE_ANGLE, TYPE_COLORBLUE, TYPE_COLORFULL, TYPE_COLORGREEN, TYPE_COLORNONE, TYPE_COLORRED, TYPE_CUSTOM, TYPE_HISPEED, TYPE_LIGHT_ACTIVE, TYPE_LIGHT_INACTIVE, TYPE_LOWSPEED, TYPE_LOWSPEED_9V, TYPE_NO_SENSOR, TYPE_REFLECTION, TYPE_SOUND_DB, TYPE_SOUND_DBA, TYPE_SWITCH, TYPE_TEMPERATURE, WHITE, YELLOW |
Constructor Summary | |
---|---|
TouchPanel(I2CPort port)
Instantiates a new Touch Panel sensor. |
Method Summary | |
---|---|
void |
calibrate()
Starts the calibration routine. |
boolean |
getButtonLastState(byte btnId)
Gets the button state after last readButtons call. |
ArrayList<Point> |
getGesture()
Read all available points from the device. |
Point |
getPoint()
Gets the point where the touch panel is being touched. |
boolean |
isAnyButtonDown()
Checks if any virtual button is down. |
boolean |
isNoButtonDown()
Checks if no virtual button is down. |
byte |
readButtons()
Private function to read the buttons register. |
boolean |
restoreDefaultCalibration()
Restores calibration data to factory defaults |
boolean |
saveCalibration()
Commits calibration data to permanent memory |
boolean |
setCalibratedMode(boolean yes)
Sets the mode (calibrated or not) |
boolean |
setSamplingRate(int rate)
Sets the gesture sampling rate, |
Methods inherited from class lejos.nxt.I2CSensor |
---|
fetchString, getAddress, getData, getData, getPort, getProductID, getVendorID, getVersion, sendData, sendData, sendData, setAddress |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final byte BTN_L4
public static final byte BTN_L3
public static final byte BTN_L2
public static final byte BTN_L1
public static final byte BTN_R4
public static final byte BTN_R3
public static final byte BTN_R2
public static final byte BTN_R1
public final TouchPanel.VirtualButton R1
public final TouchPanel.VirtualButton R2
public final TouchPanel.VirtualButton R3
public final TouchPanel.VirtualButton R4
public final TouchPanel.VirtualButton L1
public final TouchPanel.VirtualButton L2
public final TouchPanel.VirtualButton L3
public final TouchPanel.VirtualButton L4
Constructor Detail |
---|
public TouchPanel(I2CPort port)
port
- the port the sensor is attached toMethod Detail |
---|
public void calibrate()
public Point getPoint()
public boolean getButtonLastState(byte btnId)
btnId
- the button id
public byte readButtons()
public boolean isAnyButtonDown()
public boolean isNoButtonDown()
public boolean setCalibratedMode(boolean yes)
public boolean saveCalibration()
public boolean restoreDefaultCalibration()
public boolean setSamplingRate(int rate) throws IllegalArgumentException
rate
- can be a number from 1 to 8, 1 being the fastest, 8 being the slowest, default is 4
IllegalArgumentException
- if rate is outside the range 1..8public ArrayList<Point> getGesture()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |