Better compliance with coding style guide

* s/LayerCount/layer_count/
* s/CREATE_KEYMAP/KEYMAPS/
pull/244/head
Michael Richters 7 years ago
parent 0fb2abf6bc
commit 195d6bc413

@ -24,7 +24,7 @@
#include "Macros.h" #include "Macros.h"
/* *INDENT-OFF* */ /* *INDENT-OFF* */
CREATE_KEYMAP( KEYMAPS(
[0] = KEYMAP_STACKED [0] = KEYMAP_STACKED
( (
Key_NoKey, Key_1, Key_2, Key_3, Key_4, Key_5, Key_NoKey, Key_NoKey, Key_1, Key_2, Key_3, Key_4, Key_5, Key_NoKey,
@ -43,7 +43,7 @@ CREATE_KEYMAP(
Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl, Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl,
M(M_APPCANCEL) M(M_APPCANCEL)
), ),
) )
/* *INDENT-ON* */ /* *INDENT-ON* */

@ -57,7 +57,7 @@
Key_KeymapNext_Momentary, Key_KeymapNext_Momentary \ Key_KeymapNext_Momentary, Key_KeymapNext_Momentary \
) )
CREATE_KEYMAP( KEYMAPS(
QWERTY, QWERTY,
GENERIC_FN2, GENERIC_FN2,
NUMPAD NUMPAD

@ -10,8 +10,8 @@ Key(*Layer_::getKey)(uint8_t layer, byte row, byte col) = Layer.getKeyFromPROGME
// The total number of defined layers in the firmware sketch keymaps[] // The total number of defined layers in the firmware sketch keymaps[]
// array. If the keymap wasn't defined using CREATE_KEYMAP() in the // array. If the keymap wasn't defined using CREATE_KEYMAP() in the
// sketch file, LayerCount gets the default value of zero. // sketch file, layer_count gets the default value of zero.
uint8_t LayerCount __attribute__((weak)) = 0; uint8_t layer_count __attribute__((weak)) = 0;
static void handleKeymapKeyswitchEvent(Key keymapEntry, uint8_t keyState) { static void handleKeymapKeyswitchEvent(Key keymapEntry, uint8_t keyState) {
if (keymapEntry.keyCode >= LAYER_SHIFT_OFFSET) { if (keymapEntry.keyCode >= LAYER_SHIFT_OFFSET) {
@ -132,7 +132,7 @@ void Layer_::move(uint8_t layer) {
void Layer_::on(uint8_t layer) { void Layer_::on(uint8_t layer) {
// If we're trying to turn on a layer that doesn't exist, abort (but // If we're trying to turn on a layer that doesn't exist, abort (but
// if the keymap wasn't defined using CREATE_KEYMAP(), proceed anyway // if the keymap wasn't defined using CREATE_KEYMAP(), proceed anyway
if (LayerCount != 0 && layer >= LayerCount) if (layer_count != 0 && layer >= layer_count)
return; return;
bool wasOn = isOn(layer); bool wasOn = isOn(layer);

@ -7,9 +7,9 @@
// Macro for defining the keymap. This should be used in the sketch // Macro for defining the keymap. This should be used in the sketch
// file (*.ino) to define the keymap[] array that holds the user's // file (*.ino) to define the keymap[] array that holds the user's
// layers. It also computes the number of layers in that keymap. // layers. It also computes the number of layers in that keymap.
#define CREATE_KEYMAP(layers...) \ #define KEYMAPS(layers...) \
const Key keymaps[][ROWS][COLS] PROGMEM = { layers }; \ const Key keymaps[][ROWS][COLS] PROGMEM = { layers }; \
uint8_t LayerCount = sizeof(keymaps) / sizeof(*keymaps); uint8_t layer_count = sizeof(keymaps) / sizeof(*keymaps);
class Layer_ { class Layer_ {

Loading…
Cancel
Save