Apply `clang-format` to example sketches

Signed-off-by: Michael Richters <gedankenexperimenter@gmail.com>
pull/1157/head
Michael Richters 2 years ago
parent 56c12996ad
commit f9697e25f3
No known key found for this signature in database
GPG Key ID: 1288FD13E4EEF0C0

@ -32,7 +32,6 @@
#include "Kaleidoscope-SpaceCadet.h" #include "Kaleidoscope-SpaceCadet.h"
#define MO(n) ShiftToLayer(n) #define MO(n) ShiftToLayer(n)
#define TG(n) LockLayer(n) #define TG(n) LockLayer(n)
@ -110,8 +109,7 @@ KALEIDOSCOPE_INIT_PLUGINS(
SpaceCadet, SpaceCadet,
OneShot, OneShot,
Macros, Macros,
MouseKeys MouseKeys);
);
const macro_t *macroAction(uint8_t macro_id, KeyEvent &event) { const macro_t *macroAction(uint8_t macro_id, KeyEvent &event) {
if (keyToggledOn(event.state)) { if (keyToggledOn(event.state)) {

@ -50,7 +50,8 @@
#include "Kaleidoscope-USB-Quirks.h" #include "Kaleidoscope-USB-Quirks.h"
enum { _QWERTY, enum {
_QWERTY,
}; };
@ -70,7 +71,6 @@ Key_F5, Key_LeftControl,Key_LeftAlt, Key_LeftGui, Key_Backspace, Key_LeftAr
// clang-format on // clang-format on
// These 'solid' color effect definitions define a rainbow of // These 'solid' color effect definitions define a rainbow of
// LED color modes calibrated to draw 500mA or less on the // LED color modes calibrated to draw 500mA or less on the
// Keyboardio Model 01. // Keyboardio Model 01.
@ -133,13 +133,14 @@ static void toggleKeyboardProtocol(uint8_t combo_index) {
/** Magic combo list, a list of key combo and action pairs the firmware should /** Magic combo list, a list of key combo and action pairs the firmware should
* recognise. * recognise.
*/ */
USE_MAGIC_COMBOS({.action = toggleKeyboardProtocol, USE_MAGIC_COMBOS(
{.action = toggleKeyboardProtocol,
// Left Fn + Esc + Shift // Left Fn + Esc + Shift
.keys = { R3C6, R2C6, R3C7 } .keys = {R3C6, R2C6, R3C7}});
});
KALEIDOSCOPE_INIT_PLUGINS(Macros, KALEIDOSCOPE_INIT_PLUGINS(
Macros,
// LEDControl provides support for other LED modes // LEDControl provides support for other LED modes
LEDControl, LEDControl,
@ -158,7 +159,13 @@ KALEIDOSCOPE_INIT_PLUGINS(Macros,
LEDChaseEffect, LEDChaseEffect,
// These static effects turn your keyboard's LEDs a variety of colors // These static effects turn your keyboard's LEDs a variety of colors
solidRed, solidOrange, solidYellow, solidGreen, solidBlue, solidIndigo, solidViolet, solidRed,
solidOrange,
solidYellow,
solidGreen,
solidBlue,
solidIndigo,
solidViolet,
// The breathe effect slowly pulses all of the LEDs on your keyboard // The breathe effect slowly pulses all of the LEDs on your keyboard
LEDBreatheEffect, LEDBreatheEffect,
@ -176,8 +183,7 @@ KALEIDOSCOPE_INIT_PLUGINS(Macros,
// comfortable - or able - to do automatically, but can be useful // comfortable - or able - to do automatically, but can be useful
// nevertheless. Such as toggling the key report protocol between Boot (used // nevertheless. Such as toggling the key report protocol between Boot (used
// by BIOSes) and Report (NKRO). // by BIOSes) and Report (NKRO).
USBQuirks USBQuirks);
);
void setup() { void setup() {
Kaleidoscope.setup(); Kaleidoscope.setup();

@ -86,10 +86,17 @@ const macro_t *macroAction(uint8_t macro_id, KeyEvent &event) {
if (macro_id == 1 && keyToggledOn(event.state)) { if (macro_id == 1 && keyToggledOn(event.state)) {
Kaleidoscope.serialPort().print("Keyboard.IO keyboard driver v0.00"); Kaleidoscope.serialPort().print("Keyboard.IO keyboard driver v0.00");
return MACRO(I(25), return MACRO(I(25),
D(LeftShift), T(M), U(LeftShift), T(O), T(D), T(E), T(L), D(LeftShift),
T(M),
U(LeftShift),
T(O),
T(D),
T(E),
T(L),
T(Spacebar), T(Spacebar),
W(100), W(100),
T(0), T(1)); T(0),
T(1));
} }
return MACRO_NONE; return MACRO_NONE;
} }
@ -105,16 +112,24 @@ static void enterHardwareTestMode(uint8_t combo_index) {
/** Magic combo list, a list of key combo and action pairs the firmware should /** Magic combo list, a list of key combo and action pairs the firmware should
* recognise. * recognise.
*/ */
USE_MAGIC_COMBOS({ USE_MAGIC_COMBOS({.action = enterHardwareTestMode,
.action = enterHardwareTestMode,
// Left Fn + Prog + LED // Left Fn + Prog + LED
.keys = { R3C6, R0C0, R0C6 } .keys = {R3C6, R0C0, R0C6}});
});
KALEIDOSCOPE_INIT_PLUGINS(HardwareTestMode, KALEIDOSCOPE_INIT_PLUGINS(HardwareTestMode,
LEDControl, LEDOff, LEDControl,
solidRed, solidOrange, solidYellow, solidGreen, solidBlue, solidIndigo, solidViolet, LEDOff,
LEDBreatheEffect, LEDRainbowEffect, LEDChaseEffect, NumPad, solidRed,
solidOrange,
solidYellow,
solidGreen,
solidBlue,
solidIndigo,
solidViolet,
LEDBreatheEffect,
LEDRainbowEffect,
LEDChaseEffect,
NumPad,
Macros, Macros,
MouseKeys, MouseKeys,
MagicCombo); MagicCombo);

@ -88,12 +88,12 @@
* a macro key is pressed. * a macro key is pressed.
*/ */
enum { MACRO_VERSION_INFO, enum {
MACRO_ANY MACRO_VERSION_INFO,
MACRO_ANY,
}; };
/** The Model 100's key layouts are defined as 'keymaps'. By default, there are three /** The Model 100's key layouts are defined as 'keymaps'. By default, there are three
* keymaps: The standard QWERTY keymap, the "Function layer" keymap and the "Numpad" * keymaps: The standard QWERTY keymap, the "Function layer" keymap and the "Numpad"
* keymap. * keymap.
@ -142,7 +142,11 @@ enum { MACRO_VERSION_INFO,
* *
*/ */
enum { PRIMARY, NUMPAD, FUNCTION }; // layers enum {
PRIMARY,
NUMPAD,
FUNCTION,
}; // layers
/** /**
@ -164,7 +168,6 @@ enum { PRIMARY, NUMPAD, FUNCTION }; // layers
// #define PRIMARY_KEYMAP_CUSTOM // #define PRIMARY_KEYMAP_CUSTOM
/* This comment temporarily turns off astyle's indent enforcement /* This comment temporarily turns off astyle's indent enforcement
* so we can make the keymaps actually resemble the physical key layout better * so we can make the keymaps actually resemble the physical key layout better
*/ */
@ -336,7 +339,6 @@ const macro_t *macroAction(uint8_t macro_id, KeyEvent &event) {
} }
// These 'solid' color effect definitions define a rainbow of // These 'solid' color effect definitions define a rainbow of
// LED color modes calibrated to draw 500mA or less on the // LED color modes calibrated to draw 500mA or less on the
// Keyboardio Model 100. // Keyboardio Model 100.
@ -412,12 +414,10 @@ static void enterHardwareTestMode(uint8_t combo_index) {
*/ */
USE_MAGIC_COMBOS({.action = toggleKeyboardProtocol, USE_MAGIC_COMBOS({.action = toggleKeyboardProtocol,
// Left Fn + Esc + Shift // Left Fn + Esc + Shift
.keys = { R3C6, R2C6, R3C7 } .keys = {R3C6, R2C6, R3C7}},
}, { {.action = enterHardwareTestMode,
.action = enterHardwareTestMode,
// Left Fn + Prog + LED // Left Fn + Prog + LED
.keys = { R3C6, R0C0, R0C6 } .keys = {R3C6, R0C0, R0C6}});
});
// First, tell Kaleidoscope which plugins you want to use. // First, tell Kaleidoscope which plugins you want to use.
// The order can be important. For example, LED effects are // The order can be important. For example, LED effects are
@ -468,7 +468,13 @@ KALEIDOSCOPE_INIT_PLUGINS(
LEDChaseEffect, LEDChaseEffect,
// These static effects turn your keyboard's LEDs a variety of colors // These static effects turn your keyboard's LEDs a variety of colors
solidRed, solidOrange, solidYellow, solidGreen, solidBlue, solidIndigo, solidViolet, solidRed,
solidOrange,
solidYellow,
solidGreen,
solidBlue,
solidIndigo,
solidViolet,
// The breathe effect slowly pulses all of the LEDs on your keyboard // The breathe effect slowly pulses all of the LEDs on your keyboard
LEDBreatheEffect, LEDBreatheEffect,
@ -510,8 +516,7 @@ KALEIDOSCOPE_INIT_PLUGINS(
// comfortable - or able - to do automatically, but can be useful // comfortable - or able - to do automatically, but can be useful
// nevertheless. Such as toggling the key report protocol between Boot (used // nevertheless. Such as toggling the key report protocol between Boot (used
// by BIOSes) and Report (NKRO). // by BIOSes) and Report (NKRO).
USBQuirks USBQuirks);
);
/** The 'setup' function is one of the two standard Arduino sketch functions. /** The 'setup' function is one of the two standard Arduino sketch functions.
* It's called when your keyboard first powers up. This is where you set up * It's called when your keyboard first powers up. This is where you set up

@ -20,7 +20,8 @@
#include "Kaleidoscope.h" #include "Kaleidoscope.h"
#include "Kaleidoscope-Macros.h" #include "Kaleidoscope-Macros.h"
enum { _QWERTY, enum {
_QWERTY,
_COLEMAK, _COLEMAK,
_DVORAK, _DVORAK,
_LOWER, _LOWER,

@ -46,8 +46,7 @@ KALEIDOSCOPE_INIT_PLUGINS(
EEPROMSettings, EEPROMSettings,
EEPROMKeymap, EEPROMKeymap,
DynamicMacros, DynamicMacros,
Focus Focus);
);
void setup() { void setup() {
Kaleidoscope.setup(); Kaleidoscope.setup();

@ -70,7 +70,7 @@ class FocusHelpCommand : public Plugin {
} }
}; };
} } // namespace kaleidoscope
kaleidoscope::FocusTestCommand FocusTestCommand; kaleidoscope::FocusTestCommand FocusTestCommand;
kaleidoscope::FocusHelpCommand FocusHelpCommand; kaleidoscope::FocusHelpCommand FocusHelpCommand;

@ -61,6 +61,7 @@ class EventDropper : public Plugin {
void toggle() { void toggle() {
active_ = !active_; active_ = !active_;
} }
private: private:
bool active_ = false; bool active_ = false;
}; };
@ -95,8 +96,7 @@ static const kaleidoscope::plugin::GhostInTheFirmware::GhostKey ghost_keys[] PRO
{KeyAddr(3, 14), 200, 50}, {KeyAddr(3, 14), 200, 50},
{KeyAddr(3, 15), 200, 50}, {KeyAddr(3, 15), 200, 50},
{KeyAddr::none(), 0, 0} {KeyAddr::none(), 0, 0}};
};
KALEIDOSCOPE_INIT_PLUGINS(GhostInTheFirmware, KALEIDOSCOPE_INIT_PLUGINS(GhostInTheFirmware,
LEDControl, LEDControl,

@ -19,7 +19,11 @@
#include <Kaleidoscope-FocusSerial.h> #include <Kaleidoscope-FocusSerial.h>
#include <Kaleidoscope-MouseKeys.h> #include <Kaleidoscope-MouseKeys.h>
enum { PRIMARY, NUMPAD, FUNCTION }; // layers enum {
PRIMARY,
NUMPAD,
FUNCTION,
}; // layers
// clang-format off // clang-format off
KEYMAPS( KEYMAPS(
@ -89,7 +93,7 @@ class LayerDumper: public Plugin {
} }
}; };
} } // namespace kaleidoscope
kaleidoscope::LayerDumper LayerDumper; kaleidoscope::LayerDumper LayerDumper;

@ -64,7 +64,6 @@ class ShiftBlocker : public Plugin {
private: private:
bool active_{false}; bool active_{false};
}; };
} // namespace plugin } // namespace plugin

@ -54,7 +54,8 @@ class CPlugin : public kaleidoscope::Plugin {};
class APlugin : public kaleidoscope::Plugin { class APlugin : public kaleidoscope::Plugin {
public: public:
APlugin() : has_key_1_{false} {} APlugin()
: has_key_1_{false} {}
template<typename _Sketch> template<typename _Sketch>
kaleidoscope::EventHandlerResult exploreSketch() { kaleidoscope::EventHandlerResult exploreSketch() {
@ -117,7 +118,6 @@ class APlugin : public kaleidoscope::Plugin {
} }
private: private:
bool has_key_1_; bool has_key_1_;
}; };
@ -127,8 +127,7 @@ BPlugin b_plugin;
KALEIDOSCOPE_INIT_PLUGINS( KALEIDOSCOPE_INIT_PLUGINS(
a_plugin1, a_plugin1,
b_plugin, b_plugin,
a_plugin2 a_plugin2)
)
void setup() { void setup() {
Kaleidoscope.setup(); Kaleidoscope.setup();

@ -122,8 +122,16 @@ class LeaderPrefix : public Plugin {
private: private:
// The "digit keys": these are the keys on the number row of the Model01. // The "digit keys": these are the keys on the number row of the Model01.
KeyAddr digit_addrs_[10] = { KeyAddr digit_addrs_[10] = {
KeyAddr(0, 14), KeyAddr(0, 1), KeyAddr(0, 2), KeyAddr(0, 3), KeyAddr(0, 4), KeyAddr(0, 14),
KeyAddr(0, 5), KeyAddr(0, 10), KeyAddr(0, 11), KeyAddr(0, 12), KeyAddr(0, 13), KeyAddr(0, 1),
KeyAddr(0, 2),
KeyAddr(0, 3),
KeyAddr(0, 4),
KeyAddr(0, 5),
KeyAddr(0, 10),
KeyAddr(0, 11),
KeyAddr(0, 12),
KeyAddr(0, 13),
}; };
// This event tracker is necessary to prevent re-processing events. Any // This event tracker is necessary to prevent re-processing events. Any

@ -49,14 +49,14 @@ void setup() {
//Setting is {KeyThatWasPressed, AlternativeKeyToSend, TimeoutInMS} //Setting is {KeyThatWasPressed, AlternativeKeyToSend, TimeoutInMS}
//Note: must end with the SPACECADET_MAP_END delimiter //Note: must end with the SPACECADET_MAP_END delimiter
static kaleidoscope::plugin::SpaceCadet::KeyBinding spacecadetmap[] = { static kaleidoscope::plugin::SpaceCadet::KeyBinding spacecadetmap[] = {
{Key_LeftShift, Key_LeftParen, 250} {Key_LeftShift, Key_LeftParen, 250},
, {Key_RightShift, Key_RightParen, 250} {Key_RightShift, Key_RightParen, 250},
, {Key_LeftGui, Key_LeftCurlyBracket, 250} {Key_LeftGui, Key_LeftCurlyBracket, 250},
, {Key_RightAlt, Key_RightCurlyBracket, 250} {Key_RightAlt, Key_RightCurlyBracket, 250},
, {Key_LeftAlt, Key_RightCurlyBracket, 250} {Key_LeftAlt, Key_RightCurlyBracket, 250},
, {Key_LeftControl, Key_LeftBracket, 250} {Key_LeftControl, Key_LeftBracket, 250},
, {Key_RightControl, Key_RightBracket, 250} {Key_RightControl, Key_RightBracket, 250},
, SPACECADET_MAP_END SPACECADET_MAP_END,
}; };
//Set the map. //Set the map.
SpaceCadet.map = spacecadetmap; SpaceCadet.map = spacecadetmap;

@ -29,8 +29,7 @@ void toggleWinKey(uint8_t index) {
USE_MAGIC_COMBOS([WINKEYTOGGLE] = { USE_MAGIC_COMBOS([WINKEYTOGGLE] = {
.action = toggleWinKey, .action = toggleWinKey,
.keys = {R3C6, R3C9} .keys = {R3C6, R3C9}});
});
// clang-format off // clang-format off
KEYMAPS( KEYMAPS(

@ -66,8 +66,7 @@ KALEIDOSCOPE_INIT_PLUGINS(LEDControl,
void setup() { void setup() {
static const cRGB layerColormap[] PROGMEM = { static const cRGB layerColormap[] PROGMEM = {
CRGB(128, 0, 0), CRGB(128, 0, 0),
CRGB(0, 128, 0) CRGB(0, 128, 0)};
};
Kaleidoscope.setup(); Kaleidoscope.setup();
LEDActiveLayerColorEffect.setColormap(layerColormap); LEDActiveLayerColorEffect.setColormap(layerColormap);

@ -39,13 +39,11 @@ class TestLEDMode : public kaleidoscope::plugin::LEDMode {
uint16_t TestLEDMode::map_base_; uint16_t TestLEDMode::map_base_;
void void TestLEDMode::setup() {
TestLEDMode::setup() {
map_base_ = LEDPaletteTheme.reserveThemes(1); map_base_ = LEDPaletteTheme.reserveThemes(1);
} }
void void TestLEDMode::update(void) {
TestLEDMode::update(void) {
LEDPaletteTheme.updateHandler(map_base_, 0); LEDPaletteTheme.updateHandler(map_base_, 0);
} }
@ -54,7 +52,7 @@ TestLEDMode::onFocusEvent(const char *command) {
return LEDPaletteTheme.themeFocusEvent(command, PSTR("testLedMode.map"), map_base_, 1); return LEDPaletteTheme.themeFocusEvent(command, PSTR("testLedMode.map"), map_base_, 1);
} }
} } // namespace example
example::TestLEDMode TestLEDMode; example::TestLEDMode TestLEDMode;

Loading…
Cancel
Save