Implement logic for pulsed button presses. This commit has not been tested.
This commit is contained in:
11
Joystick.h
11
Joystick.h
@ -15,9 +15,9 @@
|
||||
#define JOYSTICK_NUM_BYTES (JOYSTICK_NUM_BUTTONS+7)/8
|
||||
|
||||
enum ButtonType {
|
||||
BUTTON_MAINTAINED,
|
||||
BUTTON_PULSED,
|
||||
BUTTON_PULSED_DOUBLE_ACTION
|
||||
BUTTON_MAINTAINED = 0x1,
|
||||
BUTTON_PULSED = 0x2,
|
||||
BUTTON_PULSED_DOUBLE_ACTION = 0x4
|
||||
};
|
||||
|
||||
typedef struct JoyReport {
|
||||
@ -46,6 +46,8 @@ class Joystick {
|
||||
void Write();
|
||||
|
||||
private:
|
||||
void _ReleasePulsedButtons();
|
||||
|
||||
struct {
|
||||
uint8_t pin;
|
||||
ButtonType type;
|
||||
@ -61,4 +63,7 @@ class Joystick {
|
||||
bool _debug;
|
||||
};
|
||||
|
||||
// Internal use only.
|
||||
#define _BUTTON_PULSED_TYPES (BUTTON_PULSED | BUTTON_PULSED_DOUBLE_ACTION)
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user