Add ATTR_* macros in the newly created attributes.h and use them wherever possible for improved readability.
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
#include "config_globals.h"
|
||||
#include "attributes.h"
|
||||
|
||||
static uint8_t hardwareConfig[HARDWARE_CONFIG_SIZE];
|
||||
config_buffer_t HardwareConfigBuffer = {hardwareConfig};
|
||||
|
||||
static uint8_t userConfig1[USER_CONFIG_SIZE];
|
||||
static uint8_t __attribute__((section (".m_data_2"))) userConfig2[USER_CONFIG_SIZE];
|
||||
static uint8_t ATTR_DATA2 userConfig2[USER_CONFIG_SIZE];
|
||||
config_buffer_t ValidatedUserConfigBuffer = { userConfig1 };
|
||||
config_buffer_t StagingUserConfigBuffer = { userConfig2 };
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
// Includes:
|
||||
|
||||
#include <stdint.h>
|
||||
#include "attributes.h"
|
||||
#include "lufa/HIDClassCommon.h"
|
||||
#include "usb_composite_device.h"
|
||||
#include "main.h"
|
||||
@@ -69,24 +70,24 @@
|
||||
uint8_t longPressAction;
|
||||
uint8_t modifiers;
|
||||
uint16_t scancode;
|
||||
} __attribute__ ((packed)) keystroke;
|
||||
} ATTR_PACKED keystroke;
|
||||
struct {
|
||||
mouse_button_t buttonActions;
|
||||
mouse_scroll_t scrollActions;
|
||||
mouse_move_action_t moveActions;
|
||||
} __attribute__ ((packed)) mouse;
|
||||
} ATTR_PACKED mouse;
|
||||
struct {
|
||||
bool isToggle;
|
||||
uint8_t layer;
|
||||
} __attribute__ ((packed)) switchLayer;
|
||||
} ATTR_PACKED switchLayer;
|
||||
struct {
|
||||
uint8_t keymapId;
|
||||
} __attribute__ ((packed)) switchKeymap;
|
||||
} ATTR_PACKED switchKeymap;
|
||||
struct {
|
||||
uint8_t macroId;
|
||||
} __attribute__ ((packed)) playMacro;
|
||||
} ATTR_PACKED playMacro;
|
||||
};
|
||||
} __attribute__ ((packed)) key_action_t;
|
||||
} ATTR_PACKED key_action_t;
|
||||
|
||||
// Variables:
|
||||
|
||||
|
||||
@@ -41,29 +41,29 @@
|
||||
keystroke_type_t type;
|
||||
uint8_t scancode;
|
||||
uint8_t modifierMask;
|
||||
} __attribute__ ((packed)) key;
|
||||
} ATTR_PACKED key;
|
||||
struct {
|
||||
macro_sub_action_t action;
|
||||
uint8_t mouseButtonsMask;
|
||||
} __attribute__ ((packed)) mouseButton;
|
||||
} ATTR_PACKED mouseButton;
|
||||
struct {
|
||||
int16_t x;
|
||||
int16_t y;
|
||||
} __attribute__ ((packed)) moveMouse;
|
||||
} ATTR_PACKED moveMouse;
|
||||
struct {
|
||||
int16_t x;
|
||||
int16_t y;
|
||||
} __attribute__ ((packed)) scrollMouse;
|
||||
} ATTR_PACKED scrollMouse;
|
||||
struct {
|
||||
int16_t delay;
|
||||
} __attribute__ ((packed)) delay;
|
||||
} ATTR_PACKED delay;
|
||||
struct {
|
||||
const char *text;
|
||||
uint16_t textLen;
|
||||
} __attribute__ ((packed)) text;
|
||||
} ATTR_PACKED text;
|
||||
};
|
||||
macro_action_type_t type;
|
||||
} __attribute__ ((packed)) macro_action_t;
|
||||
} ATTR_PACKED macro_action_t;
|
||||
|
||||
// Variables:
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
// Includes:
|
||||
|
||||
#include "fsl_common.h"
|
||||
#include "attributes.h"
|
||||
#include "usb_api.h"
|
||||
#include "usb_descriptors/usb_descriptor_basic_keyboard_report.h"
|
||||
|
||||
@@ -26,7 +27,7 @@
|
||||
uint8_t modifiers;
|
||||
uint8_t reserved; // Always must be 0
|
||||
uint8_t scancodes[USB_BASIC_KEYBOARD_MAX_KEYS];
|
||||
} __attribute__ ((packed)) usb_basic_keyboard_report_t;
|
||||
} ATTR_PACKED usb_basic_keyboard_report_t;
|
||||
|
||||
// Variables:
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
typedef struct {
|
||||
uint16_t scancodes[USB_MEDIA_KEYBOARD_MAX_KEYS];
|
||||
} __attribute__ ((packed)) usb_media_keyboard_report_t;
|
||||
} ATTR_PACKED usb_media_keyboard_report_t;
|
||||
|
||||
// Variables:
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
int16_t y;
|
||||
int8_t wheelX;
|
||||
int8_t wheelY;
|
||||
} __attribute__ ((packed)) usb_mouse_report_t;
|
||||
} ATTR_PACKED usb_mouse_report_t;
|
||||
|
||||
// Variables:
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
// Includes:
|
||||
|
||||
#include "fsl_common.h"
|
||||
#include "attributes.h"
|
||||
#include "usb_api.h"
|
||||
#include "usb_descriptors/usb_descriptor_system_keyboard_report.h"
|
||||
|
||||
@@ -24,7 +25,7 @@
|
||||
|
||||
typedef struct {
|
||||
uint8_t scancodes[USB_SYSTEM_KEYBOARD_MAX_KEYS];
|
||||
} __attribute__ ((packed)) usb_system_keyboard_report_t;
|
||||
} ATTR_PACKED usb_system_keyboard_report_t;
|
||||
|
||||
// Variables:
|
||||
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
#include "wormhole.h"
|
||||
|
||||
wormhole_t Wormhole NO_INIT_GCC;
|
||||
wormhole_t ATTR_NO_INIT Wormhole;
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
// Includes:
|
||||
|
||||
#include <stdint.h>
|
||||
#include "attributes.h"
|
||||
|
||||
// Macros:
|
||||
|
||||
#define WORMHOLE_MAGIC_NUMBER 0x3b04cd9e94521f9a
|
||||
#define NO_INIT_GCC __attribute__ ((section (".noinit")))
|
||||
|
||||
// Typedefs:
|
||||
|
||||
@@ -26,6 +26,6 @@
|
||||
|
||||
// Variables:
|
||||
|
||||
extern wormhole_t Wormhole NO_INIT_GCC;
|
||||
extern wormhole_t ATTR_NO_INIT Wormhole;
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user