libctru  v1.6.0
irrst.h
Go to the documentation of this file.
1 /**
2  * @file irrst.h
3  * @brief IRRST service.
4  */
5 #pragma once
6 
7 //See also: http://3dbrew.org/wiki/IR_Services http://3dbrew.org/wiki/IRRST_Shared_Memory
8 
9 #include "3ds/services/hid.h" // for circlePosition definition
10 
11 /// IRRST's shared memory handle.
12 extern Handle irrstMemHandle;
13 
14 /// IRRST's shared memory.
15 extern vu32* irrstSharedMem;
16 
17 /// Initializes IRRST.
18 Result irrstInit(void);
19 
20 /// Exits IRRST.
21 void irrstExit(void);
22 
23 /// Scans IRRST for input.
24 void irrstScanInput(void);
25 
26 /**
27  * @brief Gets IRRST's held keys.
28  * @return IRRST's held keys.
29  */
30 u32 irrstKeysHeld(void);
31 
32 /**
33  * @brief Reads the current c-stick position.
34  * @param pos Pointer to output the current c-stick position to.
35  */
37 
38 /**
39  * @brief Waits for the IRRST input event to trigger.
40  * @param nextEvent Whether to discard the current event and wait until the next event.
41  */
42 void irrstWaitForEvent(bool nextEvent);
43 
44 /// Macro for irrstCstickRead.
45 #define hidCstickRead irrstCstickRead
46 
47 /**
48  * @brief Gets the shared memory and event handles for IRRST.
49  * @param outMemHandle Pointer to write the shared memory handle to.
50  * @param outEventHandle Pointer to write the event handle to.
51  */
52 Result IRRST_GetHandles(Handle* outMemHandle, Handle* outEventHandle);
53 
54 /**
55  * @brief Initializes IRRST.
56  * @param unk1 Unknown.
57  * @param unk2 Unknown.
58  */
59 Result IRRST_Initialize(u32 unk1, u8 unk2);
60 
61 /// Shuts down IRRST.
volatile u32 vu32
32-bit volatile unsigned integer.
Definition: types.h:33
s32 Result
Function result.
Definition: types.h:42
void irrstExit(void)
Exits IRRST.
void irrstCstickRead(circlePosition *pos)
Reads the current c-stick position.
HID service.
u32 Handle
Resource handle.
Definition: types.h:41
void irrstWaitForEvent(bool nextEvent)
Waits for the IRRST input event to trigger.
uint8_t u8
would be nice if newlib had this already
Definition: types.h:21
Circle Pad position.
Definition: hid.h:51
uint32_t u32
32-bit unsigned integer
Definition: types.h:23
Result irrstInit(void)
Initializes IRRST.
void irrstScanInput(void)
Scans IRRST for input.
u32 irrstKeysHeld(void)
Gets IRRST's held keys.
Handle irrstMemHandle
IRRST's shared memory handle.
vu32 * irrstSharedMem
IRRST's shared memory.
Result IRRST_Shutdown(void)
Shuts down IRRST.
Result IRRST_GetHandles(Handle *outMemHandle, Handle *outEventHandle)
Gets the shared memory and event handles for IRRST.
Result IRRST_Initialize(u32 unk1, u8 unk2)
Initializes IRRST.