-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathHover.h
More file actions
73 lines (63 loc) · 2.19 KB
/
Hover.h
File metadata and controls
73 lines (63 loc) · 2.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/* ===========================================================================
# This is the library for Hover.
#
# Hover is a development kit that lets you control your hardware projects in a whole new way.
# Wave goodbye to physical buttons. Hover detects hand movements in the air for touch-less interaction.
# It also features five touch-sensitive regions for even more options.
# Hover uses I2C and 2 digital pins. It is compatible with Arduino, Raspberry Pi and more.
#
# Hover can be purchased here: http://www.hoverlabs.co
#
# Written by Emran Mahbub and Jonathan Li for Hover Labs.
# BSD license, all text above must be included in any redistribution
# ===========================================================================
#
# INSTALLATION
# The 3 library files (Hover.cpp, Hover.h and keywords.txt) in the Hover folder should be placed in your Arduino Library folder.
# Run the HoverDemo.ino file from your Arduino IDE.
#
# SUPPORT
# For questions and comments, email us at support@hoverlabs.co
# v3.0
# ===========================================================================*/
#ifndef _Hover_H
#define _Hover_H
class Gesture {
public:
Gesture ();
Gesture(char * gestureType, uint8_t gestureID, uint8_t gestureValue);
char gestureType[15];
uint8_t gestureID;
uint8_t gestureValue;
};
class Touch {
public:
Touch();
Touch(char * touchType, uint8_t touchID, uint8_t touchValue);
char touchType[20];
uint8_t touchID;
uint8_t touchValue;
};
class Position {
public:
Position(uint16_t x, uint16_t y, uint16_t z);
uint16_t x, y, z;
};
class Hover {
public:
Hover(uint8_t ts, uint8_t rst, uint8_t gestmode, uint8_t touchmode, uint8_t tapmode, uint8_t posmode);
void begin();
Position getPosition(void);
Gesture getGesture(void);
Touch getTouch(void);
void readI2CData(void);
private:
boolean _valid;
uint8_t _dat[26], _i2caddr, _ts, _rst, _gestmode, _touchmode, _tapmode, _posmode;
void setRelease();
boolean getStatus();
void readPositionData(uint16_t *x, uint16_t *y, uint16_t *z);
void readGestureData(char * gtype, uint8_t * gid, uint8_t * gval);
void readTouchData(char * ttype, uint8_t * tid, uint8_t * tval);
};
#endif