NXShield  v1.07
NXShield Library Reference by OpenElectrons.com
 All Classes Files Functions Variables Enumerations Enumerator Macros Pages
NXTHID.h
1 
2 // NXTHID.h
3 //
4 // This is a class for controlling the NXT Human Interface Device, made by Mindsensors.
5 // See http://www.mindsensors.com/index.php?module=pagemaster&PAGE_user_op=view_page&PAGE_id=119.
6 
7 // Initial version: 2010-06-17 by Andrew Sylvester
8 // Large parts of the code is ported from the NXC library for the device,
9 // written by Deepak Patil.
10 
11 /*
12  This library is free software; you can redistribute it and/or
13  modify it under the terms of the GNU Lesser General Public
14  License as published by the Free Software Foundation; either
15  version 2.1 of the License, or (at your option) any later version.
16 
17  This library is distributed in the hope that it will be useful,
18  but WITHOUT ANY WARRANTY; without even the implied warranty of
19  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20  Lesser General Public License for more details.
21 
22  You should have received a copy of the GNU Lesser General Public
23  License along with this library; if not, write to the Free Software
24  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 */
26 
27 
28 #ifndef NXTHID_H
29 #define NXTHID_H
30 
31 #define HID_Command 0x41
32 #define HID_Modifier 0x42
33 #define HID_Text 0x04
34 #define HID_Keyboard 0x43
35 
36 #define HID_None 0x00
37 #define HID_L_Ctrl 0x01
38 #define HID_L_Shift 0x02
39 #define HID_L_Alt 0x04
40 #define HID_L_GUI 0x08
41 #define HID_R_Ctrl 0x10
42 #define HID_R_Shift 0x20
43 #define HID_R_Alt 0x40
44 #define HID_R_GUI 0x80
45 
46 #include "NXShieldI2C.h"
47 
51 class NXTHID : public NXShieldI2C
52 {
53 public:
55  NXTHID(uint8_t i2c_address = 0x04);
56 
58  uint8_t issueCommand(char command);
59 
61  bool transmitData();
62 
64  bool asciiMode();
65 
67  bool directMode();
68 
70  bool setModifier(uint8_t mod);
71 
73  bool sendKeyboardData(uint8_t data);
74 
76  bool sendTextString(char *str);
77 
78 };
79 
80 #endif
This class implements I2C interfaces used by NXShield.
Definition: NXShieldI2C.h:32
NXTHID(uint8_t i2c_address=0x04)
Definition: NXTHID.cpp:31
bool transmitData()
Definition: NXTHID.cpp:41
bool setModifier(uint8_t mod)
Definition: NXTHID.cpp:56
This class interfaces with NXTHID attached to NXShield.
Definition: NXTHID.h:51
bool sendTextString(char *str)
Definition: NXTHID.cpp:72
bool sendKeyboardData(uint8_t data)
Definition: NXTHID.cpp:62
bool asciiMode()
Definition: NXTHID.cpp:46
bool directMode()
Definition: NXTHID.cpp:51
uint8_t issueCommand(char command)
Definition: NXTHID.cpp:36