libctru
v2.4.1
|
HID service. More...
Go to the source code of this file.
Data Structures | |
struct | touchPosition |
Touch position. More... | |
struct | circlePosition |
Circle Pad position. More... | |
struct | accelVector |
Accelerometer vector. More... | |
struct | angularRate |
Gyroscope angular rate. More... | |
Macros | |
#define | scanKeys hidScanInput |
Compatibility macro for hidScanInput. | |
#define | keysHeld hidKeysHeld |
Compatibility macro for hidKeysHeld. | |
#define | keysDown hidKeysDown |
Compatibility macro for hidKeysDown. | |
#define | keysUp hidKeysUp |
Compatibility macro for hidKeysUp. | |
#define | touchRead hidTouchRead |
Compatibility macro for hidTouchRead. | |
#define | circleRead hidCircleRead |
Compatibility macro for hidCircleRead. | |
Enumerations | |
enum | { KEY_A = BIT(0) , KEY_B = BIT(1) , KEY_SELECT = BIT(2) , KEY_START = BIT(3) , KEY_DRIGHT = BIT(4) , KEY_DLEFT = BIT(5) , KEY_DUP = BIT(6) , KEY_DDOWN = BIT(7) , KEY_R = BIT(8) , KEY_L = BIT(9) , KEY_X = BIT(10) , KEY_Y = BIT(11) , KEY_ZL = BIT(14) , KEY_ZR = BIT(15) , KEY_TOUCH = BIT(20) , KEY_CSTICK_RIGHT = BIT(24) , KEY_CSTICK_LEFT = BIT(25) , KEY_CSTICK_UP = BIT(26) , KEY_CSTICK_DOWN = BIT(27) , KEY_CPAD_RIGHT = BIT(28) , KEY_CPAD_LEFT = BIT(29) , KEY_CPAD_UP = BIT(30) , KEY_CPAD_DOWN = BIT(31) , KEY_UP = KEY_DUP | KEY_CPAD_UP , KEY_DOWN = KEY_DDOWN | KEY_CPAD_DOWN , KEY_LEFT = KEY_DLEFT | KEY_CPAD_LEFT , KEY_RIGHT = KEY_DRIGHT | KEY_CPAD_RIGHT } |
Key values. More... | |
enum | HID_Event { HIDEVENT_PAD0 = 0 , HIDEVENT_PAD1 , HIDEVENT_Accel , HIDEVENT_Gyro , HIDEVENT_DebugPad , HIDEVENT_MAX } |
HID events. More... | |
Functions | |
Result | hidInit (void) |
Initializes HID. | |
void | hidExit (void) |
Exits HID. | |
void | hidSetRepeatParameters (u32 delay, u32 interval) |
Sets the key repeat parameters for hidKeysRepeat. More... | |
void | hidScanInput (void) |
Scans HID for input data. | |
u32 | hidKeysHeld (void) |
Returns a bitmask of held buttons. More... | |
u32 | hidKeysDown (void) |
Returns a bitmask of newly pressed buttons, this frame. More... | |
u32 | hidKeysDownRepeat (void) |
Returns a bitmask of newly pressed or repeated buttons, this frame. More... | |
u32 | hidKeysUp (void) |
Returns a bitmask of newly released buttons, this frame. More... | |
void | hidTouchRead (touchPosition *pos) |
Reads the current touch position. More... | |
void | hidCircleRead (circlePosition *pos) |
Reads the current circle pad position. More... | |
void | hidAccelRead (accelVector *vector) |
Reads the current accelerometer data. More... | |
void | hidGyroRead (angularRate *rate) |
Reads the current gyroscope data. More... | |
void | hidWaitForEvent (HID_Event id, bool nextEvent) |
Waits for an HID event. More... | |
Result | hidWaitForAnyEvent (bool nextEvents, Handle cancelEvent, s64 timeout) |
Waits for any HID or IRRST event. More... | |
Result | HIDUSER_GetHandles (Handle *outMemHandle, Handle *eventpad0, Handle *eventpad1, Handle *eventaccel, Handle *eventgyro, Handle *eventdebugpad) |
Gets the handles for HID operation. More... | |
Result | HIDUSER_EnableAccelerometer (void) |
Enables the accelerometer. | |
Result | HIDUSER_DisableAccelerometer (void) |
Disables the accelerometer. | |
Result | HIDUSER_EnableGyroscope (void) |
Enables the gyroscope. | |
Result | HIDUSER_DisableGyroscope (void) |
Disables the gyroscope. | |
Result | HIDUSER_GetGyroscopeRawToDpsCoefficient (float *coeff) |
Gets the gyroscope raw to dps coefficient. More... | |
Result | HIDUSER_GetSoundVolume (u8 *volume) |
Gets the current volume slider value. More... | |
Variables | |
Handle | hidMemHandle |
HID shared memory handle. | |
vu32 * | hidSharedMem |
HID shared memory. | |
HID service.
anonymous enum |
Key values.
enum HID_Event |
HID events.
void hidAccelRead | ( | accelVector * | vector | ) |
Reads the current accelerometer data.
vector | Pointer to output the accelerometer data to. |
void hidCircleRead | ( | circlePosition * | pos | ) |
Reads the current circle pad position.
pos | Pointer to output the circle pad position to. |
void hidGyroRead | ( | angularRate * | rate | ) |
Reads the current gyroscope data.
rate | Pointer to output the gyroscope data to. |
u32 hidKeysDown | ( | void | ) |
Returns a bitmask of newly pressed buttons, this frame.
Individual buttons can be extracted using binary AND.
u32 hidKeysDownRepeat | ( | void | ) |
Returns a bitmask of newly pressed or repeated buttons, this frame.
Individual buttons can be extracted using binary AND.
u32 hidKeysHeld | ( | void | ) |
Returns a bitmask of held buttons.
Individual buttons can be extracted using binary AND.
u32 hidKeysUp | ( | void | ) |
Returns a bitmask of newly released buttons, this frame.
Individual buttons can be extracted using binary AND.
Sets the key repeat parameters for hidKeysRepeat.
delay | Initial delay. |
interval | Repeat interval. |
void hidTouchRead | ( | touchPosition * | pos | ) |
Reads the current touch position.
pos | Pointer to output the touch position to. |
Result HIDUSER_GetGyroscopeRawToDpsCoefficient | ( | float * | coeff | ) |
Gets the gyroscope raw to dps coefficient.
coeff | Pointer to output the coefficient to. |
Result HIDUSER_GetHandles | ( | Handle * | outMemHandle, |
Handle * | eventpad0, | ||
Handle * | eventpad1, | ||
Handle * | eventaccel, | ||
Handle * | eventgyro, | ||
Handle * | eventdebugpad | ||
) |
Gets the handles for HID operation.
outMemHandle | Pointer to output the shared memory handle to. |
eventpad0 | Pointer to output the pad 0 event handle to. |
eventpad1 | Pointer to output the pad 1 event handle to. |
eventaccel | Pointer to output the accelerometer event handle to. |
eventgyro | Pointer to output the gyroscope event handle to. |
eventdebugpad | Pointer to output the debug pad event handle to. |
Gets the current volume slider value.
(0-63)
volume | Pointer to write the volume slider value to. |
Waits for any HID or IRRST event.
nextEvents | Whether to discard the current events and wait for the next events. |
cancelEvent | Optional additional handle to wait on, otherwise 0. |
timeout | Timeout. |
void hidWaitForEvent | ( | HID_Event | id, |
bool | nextEvent | ||
) |
Waits for an HID event.
id | ID of the event. |
nextEvent | Whether to discard the current event and wait for the next event. |