My Project
Main Page
Modules
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Modules
hid.h
Go to the documentation of this file.
1
#pragma once
2
3
//See also: http://3dbrew.org/wiki/HID_Services http://3dbrew.org/wiki/HID_Shared_Memory
4
5
#define HID_SHAREDMEM_DEFAULT (0x10000000)
6
7
typedef
enum
8
{
9
KEY_A
=
BIT
(0),
10
KEY_B
=
BIT
(1),
11
KEY_SELECT
=
BIT
(2),
12
KEY_START
=
BIT
(3),
13
KEY_DRIGHT
=
BIT
(4),
14
KEY_DLEFT
=
BIT
(5),
15
KEY_DUP
=
BIT
(6),
16
KEY_DDOWN
=
BIT
(7),
17
KEY_R
=
BIT
(8),
18
KEY_L
=
BIT
(9),
19
KEY_X
=
BIT
(10),
20
KEY_Y
=
BIT
(11),
21
KEY_ZL
=
BIT
(14),
// (new 3DS only)
22
KEY_ZR
=
BIT
(15),
// (new 3DS only)
23
KEY_TOUCH
=
BIT
(20),
// Not actually provided by HID
24
KEY_CSTICK_RIGHT
=
BIT
(24),
// c-stick (new 3DS only)
25
KEY_CSTICK_LEFT
=
BIT
(25),
// c-stick (new 3DS only)
26
KEY_CSTICK_UP
=
BIT
(26),
// c-stick (new 3DS only)
27
KEY_CSTICK_DOWN
=
BIT
(27),
// c-stick (new 3DS only)
28
KEY_CPAD_RIGHT
=
BIT
(28),
// circle pad
29
KEY_CPAD_LEFT
=
BIT
(29),
// circle pad
30
KEY_CPAD_UP
=
BIT
(30),
// circle pad
31
KEY_CPAD_DOWN
=
BIT
(31),
// circle pad
32
33
// Generic catch-all directions
34
KEY_UP
=
KEY_DUP
|
KEY_CPAD_UP
,
35
KEY_DOWN
=
KEY_DDOWN
|
KEY_CPAD_DOWN
,
36
KEY_LEFT
=
KEY_DLEFT
|
KEY_CPAD_LEFT
,
37
KEY_RIGHT
=
KEY_DRIGHT
|
KEY_CPAD_RIGHT
,
38
}
PAD_KEY
;
39
40
typedef
struct
41
{
42
u16
px,
py
;
43
}
touchPosition
;
44
45
typedef
struct
46
{
47
s16
dx,
dy
;
48
}
circlePosition
;
49
50
typedef
struct
51
{
52
s16
x
;
53
s16
y
;
54
s16
z
;
55
}
accelVector
;
56
57
typedef
struct
58
{
59
s16
x
;
//roll
60
s16
z
;
//yaw
61
s16
y
;
//pitch
62
}
angularRate
;
63
64
typedef
enum
65
{
66
HIDEVENT_PAD0
= 0,
//"Event signaled by HID-module, when the sharedmem+0(PAD/circle-pad)/+0xA8(touch-screen) region was updated."
67
HIDEVENT_PAD1
,
//"Event signaled by HID-module, when the sharedmem+0(PAD/circle-pad)/+0xA8(touch-screen) region was updated."
68
HIDEVENT_Accel
,
//"Event signaled by HID-module, when the sharedmem accelerometer state was updated."
69
HIDEVENT_Gyro
,
//"Event signaled by HID-module, when the sharedmem gyroscope state was updated."
70
HIDEVENT_DebugPad
,
//"Event signaled by HID-module, when the sharedmem DebugPad state was updated."
71
72
HIDEVENT_MAX
,
// used to know how many events there are
73
}
HID_Event
;
74
75
extern
Handle
hidMemHandle
;
76
extern
vu32
*
hidSharedMem
;
77
78
Result
hidInit
(
u32
* sharedMem);
79
void
hidExit
();
80
81
void
hidScanInput
();
82
u32
hidKeysHeld
();
83
u32
hidKeysDown
();
84
u32
hidKeysUp
();
85
void
hidTouchRead
(
touchPosition
* pos);
86
void
hidCircleRead
(
circlePosition
* pos);
87
void
hidAccelRead
(
accelVector
* vector);
88
void
hidGyroRead
(
angularRate
* rate);
89
90
void
hidWaitForEvent
(
HID_Event
id
,
bool
nextEvent);
91
92
// libnds compatibility defines
93
#define scanKeys hidScanInput
94
#define keysHeld hidKeysHeld
95
#define keysDown hidKeysDown
96
#define keysUp hidKeysUp
97
#define touchRead hidTouchRead
98
#define circleRead hidCircleRead
99
100
Result
HIDUSER_GetHandles
(
Handle
* outMemHandle,
Handle
*eventpad0,
Handle
*eventpad1,
Handle
*eventaccel,
Handle
*eventgyro,
Handle
*eventdebugpad);
101
Result
HIDUSER_EnableAccelerometer
();
102
Result
HIDUSER_DisableAccelerometer
();
103
Result
HIDUSER_EnableGyroscope
();
104
Result
HIDUSER_DisableGyroscope
();
105
hidKeysDown
u32 hidKeysDown()
Definition:
hid.c:155
touchPosition::py
u16 py
Definition:
hid.h:42
vu32
volatile u32 vu32
Definition:
types.h:33
Result
s32 Result
Definition:
types.h:42
KEY_ZR
Definition:
hid.h:22
angularRate::z
s16 z
Definition:
hid.h:60
accelVector::y
s16 y
Definition:
hid.h:53
HIDEVENT_DebugPad
Definition:
hid.h:70
u16
uint16_t u16
Definition:
types.h:22
KEY_CSTICK_UP
Definition:
hid.h:26
accelVector::x
s16 x
Definition:
hid.h:52
touchPosition
Definition:
hid.h:40
circlePosition::dy
s16 dy
Definition:
hid.h:47
hidWaitForEvent
void hidWaitForEvent(HID_Event id, bool nextEvent)
Definition:
hid.c:74
KEY_Y
Definition:
hid.h:20
Handle
u32 Handle
Definition:
types.h:41
HIDEVENT_PAD0
Definition:
hid.h:66
KEY_CSTICK_DOWN
Definition:
hid.h:27
KEY_RIGHT
Definition:
hid.h:37
angularRate::x
s16 x
Definition:
hid.h:59
circlePosition
Definition:
hid.h:45
KEY_START
Definition:
hid.h:12
hidInit
Result hidInit(u32 *sharedMem)
Definition:
hid.c:22
KEY_CSTICK_RIGHT
Definition:
hid.h:24
HIDEVENT_Accel
Definition:
hid.h:68
KEY_CPAD_UP
Definition:
hid.h:30
hidTouchRead
void hidTouchRead(touchPosition *pos)
Definition:
hid.c:165
accelVector
Definition:
hid.h:50
KEY_LEFT
Definition:
hid.h:36
hidAccelRead
void hidAccelRead(accelVector *vector)
Definition:
hid.c:175
HIDEVENT_Gyro
Definition:
hid.h:69
hidExit
void hidExit()
Definition:
hid.c:57
u32
uint32_t u32
Definition:
types.h:23
hidCircleRead
void hidCircleRead(circlePosition *pos)
Definition:
hid.c:170
PAD_KEY
PAD_KEY
Definition:
hid.h:7
angularRate::y
s16 y
Definition:
hid.h:61
KEY_DLEFT
Definition:
hid.h:14
HIDUSER_GetHandles
Result HIDUSER_GetHandles(Handle *outMemHandle, Handle *eventpad0, Handle *eventpad1, Handle *eventaccel, Handle *eventgyro, Handle *eventdebugpad)
Definition:
hid.c:185
angularRate
Definition:
hid.h:57
HID_Event
HID_Event
Definition:
hid.h:64
KEY_A
Definition:
hid.h:9
KEY_L
Definition:
hid.h:18
KEY_SELECT
Definition:
hid.h:11
HIDEVENT_MAX
Definition:
hid.h:72
HIDUSER_DisableAccelerometer
Result HIDUSER_DisableAccelerometer()
Definition:
hid.c:215
KEY_DDOWN
Definition:
hid.h:16
hidKeysHeld
u32 hidKeysHeld()
Definition:
hid.c:150
KEY_DRIGHT
Definition:
hid.h:13
KEY_R
Definition:
hid.h:17
hidGyroRead
void hidGyroRead(angularRate *rate)
Definition:
hid.c:180
HIDUSER_EnableGyroscope
Result HIDUSER_EnableGyroscope()
Definition:
hid.c:226
KEY_DUP
Definition:
hid.h:15
BIT
#define BIT(n)
Definition:
types.h:45
hidMemHandle
Handle hidMemHandle
Definition:
hid.c:9
KEY_TOUCH
Definition:
hid.h:23
KEY_CPAD_DOWN
Definition:
hid.h:31
hidKeysUp
u32 hidKeysUp()
Definition:
hid.c:160
KEY_CSTICK_LEFT
Definition:
hid.h:25
KEY_CPAD_LEFT
Definition:
hid.h:29
hidSharedMem
vu32 * hidSharedMem
Definition:
hid.c:13
hidScanInput
void hidScanInput()
Definition:
hid.c:100
HIDUSER_EnableAccelerometer
Result HIDUSER_EnableAccelerometer()
Definition:
hid.c:204
KEY_UP
Definition:
hid.h:34
accelVector::z
s16 z
Definition:
hid.h:54
KEY_CPAD_RIGHT
Definition:
hid.h:28
HIDEVENT_PAD1
Definition:
hid.h:67
KEY_B
Definition:
hid.h:10
KEY_ZL
Definition:
hid.h:21
KEY_DOWN
Definition:
hid.h:35
KEY_X
Definition:
hid.h:19
HIDUSER_DisableGyroscope
Result HIDUSER_DisableGyroscope()
Definition:
hid.c:237
s16
int16_t s16
Definition:
types.h:27
include
3ds
services
hid.h
Generated on Mon Nov 24 2014 23:37:58 for My Project by
1.8.8