From 195d6bc413cfe372491e9fd0c67b41d7b2f8038c Mon Sep 17 00:00:00 2001 From: Michael Richters Date: Sat, 25 Nov 2017 23:00:13 -0600 Subject: [PATCH] Better compliance with coding style guide * s/LayerCount/layer_count/ * s/CREATE_KEYMAP/KEYMAPS/ --- examples/AppSwitcher/AppSwitcher.ino | 4 ++-- examples/Kaleidoscope/Kaleidoscope.ino | 2 +- src/layers.cpp | 6 +++--- src/layers.h | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/examples/AppSwitcher/AppSwitcher.ino b/examples/AppSwitcher/AppSwitcher.ino index aecb1242..7303cc33 100644 --- a/examples/AppSwitcher/AppSwitcher.ino +++ b/examples/AppSwitcher/AppSwitcher.ino @@ -24,7 +24,7 @@ #include "Macros.h" /* *INDENT-OFF* */ -CREATE_KEYMAP( +KEYMAPS( [0] = KEYMAP_STACKED ( 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, M(M_APPCANCEL) ), - ) +) /* *INDENT-ON* */ diff --git a/examples/Kaleidoscope/Kaleidoscope.ino b/examples/Kaleidoscope/Kaleidoscope.ino index 1964e08d..e3a90086 100644 --- a/examples/Kaleidoscope/Kaleidoscope.ino +++ b/examples/Kaleidoscope/Kaleidoscope.ino @@ -57,7 +57,7 @@ Key_KeymapNext_Momentary, Key_KeymapNext_Momentary \ ) -CREATE_KEYMAP( +KEYMAPS( QWERTY, GENERIC_FN2, NUMPAD diff --git a/src/layers.cpp b/src/layers.cpp index b3263d42..b647510a 100644 --- a/src/layers.cpp +++ b/src/layers.cpp @@ -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[] // array. If the keymap wasn't defined using CREATE_KEYMAP() in the -// sketch file, LayerCount gets the default value of zero. -uint8_t LayerCount __attribute__((weak)) = 0; +// sketch file, layer_count gets the default value of zero. +uint8_t layer_count __attribute__((weak)) = 0; static void handleKeymapKeyswitchEvent(Key keymapEntry, uint8_t keyState) { if (keymapEntry.keyCode >= LAYER_SHIFT_OFFSET) { @@ -132,7 +132,7 @@ void Layer_::move(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 the keymap wasn't defined using CREATE_KEYMAP(), proceed anyway - if (LayerCount != 0 && layer >= LayerCount) + if (layer_count != 0 && layer >= layer_count) return; bool wasOn = isOn(layer); diff --git a/src/layers.h b/src/layers.h index 09a2c6dc..d23868c1 100644 --- a/src/layers.h +++ b/src/layers.h @@ -7,9 +7,9 @@ // Macro for defining the keymap. This should be used in the sketch // file (*.ino) to define the keymap[] array that holds the user's // 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 }; \ - uint8_t LayerCount = sizeof(keymaps) / sizeof(*keymaps); + uint8_t layer_count = sizeof(keymaps) / sizeof(*keymaps); class Layer_ {