Make the macro parser store the data it extracts into macro_action_t variables

This commit is contained in:
Eric Tang
2017-08-09 13:09:17 -07:00
parent c342f75031
commit 22e49c50d1
2 changed files with 83 additions and 32 deletions

View File

@@ -4,6 +4,7 @@
// Includes:
#include <stdint.h>
#include "key_action.h"
// Macros:
@@ -16,6 +17,52 @@
uint16_t macroActionsCount;
} macro_reference_t;
typedef enum {
MacroSubAction_Press,
MacroSubAction_Hold,
MacroSubAction_Release,
} macro_sub_action_t;
typedef enum {
MacroActionType_Key,
MacroActionType_MouseButton,
MacroActionType_MoveMouse,
MacroActionType_ScrollMouse,
MacroActionType_Delay,
MacroActionType_Text,
} macro_action_type_t;
typedef struct {
union {
struct {
macro_sub_action_t action;
keystroke_type_t type;
uint8_t scancode;
uint8_t modifierMask;
} __attribute__ ((packed)) key;
struct {
macro_sub_action_t action;
uint8_t mouseButtonsMask;
} __attribute__ ((packed)) mouseButton;
struct {
int16_t x;
int16_t y;
} __attribute__ ((packed)) moveMouse;
struct {
int16_t x;
int16_t y;
} __attribute__ ((packed)) scrollMouse;
struct {
int16_t delay;
} __attribute__ ((packed)) delay;
struct {
const char *text;
uint16_t textLen;
} __attribute__ ((packed)) text;
};
macro_action_type_t type;
} __attribute__ ((packed)) macro_action_t;
// Variables:
extern macro_reference_t AllMacros[MAX_MACRO_NUM];