updated tex
[wiimote.git] / wii.h
blob49b7b2776261ade9c40113909bb199b334312da7
1 /*
2 * Wiimote Bluetooth mouse driver
4 * Macros & definitions
6 * Copyright (C) 2009, 2010 Daniel Borkmann <daniel@netsniff-ng.org>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 #ifndef __KERNEL__
24 # include <stdint.h>
25 #endif /* __KERNEL__ */
27 /* These are the Nintendo Wii button defs */
28 #define BUTTON_TWO 0x0001
29 #define BUTTON_ONE 0x0002
30 #define BUTTON_B 0x0004
31 #define BUTTON_A 0x0008
32 #define BUTTON_MINUS 0x0010
33 #define BUTTON_HOME 0x0080
34 #define BUTTON_LEFT 0x0100
35 #define BUTTON_RIGHT 0x0200
36 #define BUTTON_DOWN 0x0400
37 #define BUTTON_UP 0x0800
38 #define BUTTON_PLUS 0x1000
40 #define L2CAP_PSM_HIDP_CTRL 0x11
41 #define L2CAP_PSM_HIDP_INTR 0x13
43 #define WII_SET_CALIBRATION_DATA { 0x52, 0x17, 0x00, 0x00, 0x00, 0x16, 0x00, 0x07 }
44 #define WII_ENABLE_BUTTON_ACCELM { 0x52, 0x12, 0x00, 0x31 }
45 #define WII_ENABLE_RUMBLE { 0x52, 0x11, 0x01 }
46 #define WII_DISABLE_RUMBLE { 0x52, 0x11, 0x00 }
47 #define WII_GENERIC_LED { 0x52, 0x11, 0x00 }
49 /* Wii axis inversion: 1.0 off | -1.0 on */
50 #define WII_INVERT_Y_AXIS 1.0f
52 #define WII_BLK_TRANSMISSION_LEN 7
53 #define WII_BLK_SLEEP_GAP_LEN 300
55 struct wiimote_data {
56 uint16_t buttons;
57 int32_t pos_dx;
58 int32_t pos_dy;
61 #ifdef __KERNEL__
62 # include <linux/input.h>
64 /* Mapping can easily be modified by defs from linux/input.h */
65 static const unsigned int wiimote_translation_table[][2] = {
66 { BUTTON_B, BTN_LEFT },
67 { BUTTON_A, BTN_RIGHT },
68 { BUTTON_HOME, BTN_MIDDLE },
69 { BUTTON_LEFT, KEY_LEFT },
70 { BUTTON_RIGHT, KEY_RIGHT },
71 { BUTTON_UP, KEY_UP },
72 { BUTTON_DOWN, KEY_DOWN },
73 { BUTTON_ONE, KEY_PAGEUP },
74 { BUTTON_TWO, KEY_PAGEDOWN },
75 { BUTTON_PLUS, KEY_VOLUMEUP },
76 { BUTTON_MINUS, KEY_VOLUMEDOWN },
78 #endif /* __KERNEL__ */