2020-05-01 21:42:49 +01:00
|
|
|
#pragma once
|
|
|
|
#include "../utils/types.h"
|
|
|
|
|
|
|
|
#define BIT(n) (1 << n)
|
|
|
|
#define KEY_A BIT(3)
|
|
|
|
#define KEY_B BIT(2)
|
2020-05-02 22:35:25 +01:00
|
|
|
#define KEY_Y BIT(0)
|
|
|
|
#define KEY_X BIT(1)
|
2020-05-01 21:42:49 +01:00
|
|
|
#define KEY_LUP BIT(18)
|
|
|
|
#define KEY_LDOWN BIT(17)
|
2020-05-02 22:35:25 +01:00
|
|
|
#define KEY_LRIGHT BIT(19)
|
|
|
|
#define KEY_LLEFT BIT(20)
|
2020-05-01 21:42:49 +01:00
|
|
|
#define KEY_RUP BIT(7)
|
|
|
|
#define KEY_RDOWN BIT(6)
|
2020-05-02 00:41:43 +01:00
|
|
|
#define KEY_VOLP BIT(14)
|
|
|
|
#define KEY_VOLM BIT(15)
|
|
|
|
#define KEY_POW BIT(16)
|
2020-05-01 21:42:49 +01:00
|
|
|
|
|
|
|
typedef struct _inputs {
|
|
|
|
union {
|
|
|
|
struct {
|
|
|
|
// Joy-Con (R).
|
|
|
|
u32 y:1;
|
|
|
|
u32 x:1;
|
|
|
|
u32 b:1;
|
|
|
|
u32 a:1;
|
|
|
|
u32 r:1;
|
|
|
|
u32 zr:1;
|
|
|
|
u32 Rdown:1;
|
|
|
|
u32 Rup:1;
|
|
|
|
u32 Rright:1;
|
|
|
|
u32 Rleft:1;
|
|
|
|
|
|
|
|
// Shared
|
|
|
|
u32 minus:1;
|
|
|
|
u32 plus:1;
|
|
|
|
u32 home:1;
|
|
|
|
u32 cap:1;
|
|
|
|
u32 volp:1;
|
|
|
|
u32 volm:1;
|
|
|
|
u32 pow:1;
|
|
|
|
|
|
|
|
// Joy-Con (L).
|
|
|
|
u32 Ldown:1;
|
|
|
|
u32 Lup:1;
|
|
|
|
u32 Lright:1;
|
|
|
|
u32 Lleft:1;
|
|
|
|
u32 l:1;
|
|
|
|
u32 zl:1;
|
|
|
|
};
|
|
|
|
u32 buttons;
|
|
|
|
};
|
|
|
|
} Inputs;
|
|
|
|
|
|
|
|
void hidInit();
|
|
|
|
Inputs *hidRead();
|
2020-05-02 00:41:43 +01:00
|
|
|
Inputs *hidWait();
|
2020-05-02 19:53:13 +01:00
|
|
|
Inputs *hidWaitMask(u32 mask);
|
|
|
|
bool hidConnected();
|