Coding style fixes.

This commit is contained in:
László Monda
2016-12-12 00:21:39 +01:00
parent de6218ce0c
commit f66eb06712
7 changed files with 121 additions and 123 deletions

View File

@@ -5,20 +5,17 @@
#include "lufa/HIDClassCommon.h"
#include "usb_composite_device.h"
/**
* Keyboard layout is a 2D array of scan codes.
*
* First dimension is the Key ID of a given key. Key IDs are the indices of the
* of the active keys of the key_matrix_t structure. In case of left half, an
* offset of 35 is added.
*
* For each Key ID, there are 4 different possible scan codes:
* - default, when no modifiers are pressed
* - mod layer
* - fn layer
* - mod+fn layer
*
*/
// Keyboard layout is a 2D array of scan codes.
//
// First dimension is the Key ID of a given key. Key IDs are the indices of the
// of the active keys of the key_matrix_t structure. In case of left half, an
// offset of 35 is added.
//
// For each Key ID, there are 4 different possible scan codes:
// - default, when no modifiers are pressed
// - mod layer
// - fn layer
// - mod+fn layer
#define KEY_STATE_COUNT (5*7)
@@ -28,55 +25,55 @@
#define LAYOUT_LEFT_OFFSET KEY_STATE_COUNT
typedef enum {
UHK_KEY_SIMPLE,
UHK_KEY_MOUSE,
UHK_KEY_LAYER,
UHK_KEY_LAYER_TOGGLE,
UHK_KEY_KEYMAP,
UHK_KEY_MACRO,
UHK_KEY_LPRESSMOD,
UHK_KEY_LPRESSLAYER,
UHK_KEY_SIMPLE,
UHK_KEY_MOUSE,
UHK_KEY_LAYER,
UHK_KEY_LAYER_TOGGLE,
UHK_KEY_KEYMAP,
UHK_KEY_MACRO,
UHK_KEY_LPRESSMOD,
UHK_KEY_LPRESSLAYER,
} uhk_key_type_t;
typedef union {
struct {
struct {
uint8_t type;
union {
struct {
uint8_t __unused_bits;
uint8_t mods;
uint8_t key;
} __attribute__ ((packed)) simple;
struct {
uint8_t __unused_bits;
uint8_t scrollActions; // bitfield
uint8_t moveActions; // bitfield
} __attribute__ ((packed)) mouse;
struct {
uint16_t __unused_bits;
uint8_t target;
} __attribute__ ((packed)) layer;
struct {
uint16_t __unused_bits;
uint8_t target;
} __attribute__ ((packed)) keymap;
struct {
uint8_t __unused_bits;
uint16_t index;
} __attribute__ ((packed)) macro;
struct {
uint8_t longPressMod; // single mod, or bitfield?
uint8_t mods; // for the alternate action
uint8_t key;
} __attribute__ ((packed)) longpressMod;
struct {
uint8_t longPressLayer;
uint8_t mods;
uint8_t key;
} __attribute__ ((packed)) longpressLayer;
};
} __attribute__ ((packed));
uint32_t raw;
union {
struct {
uint8_t __unused_bits;
uint8_t mods;
uint8_t key;
} __attribute__ ((packed)) simple;
struct {
uint8_t __unused_bits;
uint8_t scrollActions; // bitfield
uint8_t moveActions; // bitfield
} __attribute__ ((packed)) mouse;
struct {
uint16_t __unused_bits;
uint8_t target;
} __attribute__ ((packed)) layer;
struct {
uint16_t __unused_bits;
uint8_t target;
} __attribute__ ((packed)) keymap;
struct {
uint8_t __unused_bits;
uint16_t index;
} __attribute__ ((packed)) macro;
struct {
uint8_t longPressMod; // single mod, or bitfield?
uint8_t mods; // for the alternate action
uint8_t key;
} __attribute__ ((packed)) longpressMod;
struct {
uint8_t longPressLayer;
uint8_t mods;
uint8_t key;
} __attribute__ ((packed)) longpressLayer;
};
} __attribute__ ((packed));
uint32_t raw;
} __attribute__ ((packed)) uhk_key_t;
#define Key_NoKey {.raw = 0}