Apply `clang-format` to example sketches

Signed-off-by: Michael Richters <gedankenexperimenter@gmail.com>
pull/1157/head
Michael Richters 3 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"
#define MO(n) ShiftToLayer(n)
#define TG(n) LockLayer(n)
@ -110,8 +109,7 @@ KALEIDOSCOPE_INIT_PLUGINS(
SpaceCadet,
OneShot,
Macros,
MouseKeys
);
MouseKeys);
const macro_t *macroAction(uint8_t macro_id, KeyEvent &event) {
if (keyToggledOn(event.state)) {

@ -50,8 +50,9 @@
#include "Kaleidoscope-USB-Quirks.h"
enum { _QWERTY,
};
enum {
_QWERTY,
};
// clang-format off
@ -70,7 +71,6 @@ Key_F5, Key_LeftControl,Key_LeftAlt, Key_LeftGui, Key_Backspace, Key_LeftAr
// clang-format on
// These 'solid' color effect definitions define a rainbow of
// LED color modes calibrated to draw 500mA or less on the
// 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
* recognise.
*/
USE_MAGIC_COMBOS({.action = toggleKeyboardProtocol,
USE_MAGIC_COMBOS(
{.action = toggleKeyboardProtocol,
// 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,
@ -158,7 +159,13 @@ KALEIDOSCOPE_INIT_PLUGINS(Macros,
LEDChaseEffect,
// 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
LEDBreatheEffect,
@ -176,8 +183,7 @@ KALEIDOSCOPE_INIT_PLUGINS(Macros,
// comfortable - or able - to do automatically, but can be useful
// nevertheless. Such as toggling the key report protocol between Boot (used
// by BIOSes) and Report (NKRO).
USBQuirks
);
USBQuirks);
void setup() {
Kaleidoscope.setup();

@ -86,10 +86,17 @@ const macro_t *macroAction(uint8_t macro_id, KeyEvent &event) {
if (macro_id == 1 && keyToggledOn(event.state)) {
Kaleidoscope.serialPort().print("Keyboard.IO keyboard driver v0.00");
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),
W(100),
T(0), T(1));
T(0),
T(1));
}
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
* recognise.
*/
USE_MAGIC_COMBOS({
.action = enterHardwareTestMode,
USE_MAGIC_COMBOS({.action = enterHardwareTestMode,
// Left Fn + Prog + LED
.keys = { R3C6, R0C0, R0C6 }
});
.keys = {R3C6, R0C0, R0C6}});
KALEIDOSCOPE_INIT_PLUGINS(HardwareTestMode,
LEDControl, LEDOff,
solidRed, solidOrange, solidYellow, solidGreen, solidBlue, solidIndigo, solidViolet,
LEDBreatheEffect, LEDRainbowEffect, LEDChaseEffect, NumPad,
LEDControl,
LEDOff,
solidRed,
solidOrange,
solidYellow,
solidGreen,
solidBlue,
solidIndigo,
solidViolet,
LEDBreatheEffect,
LEDRainbowEffect,
LEDChaseEffect,
NumPad,
Macros,
MouseKeys,
MagicCombo);

@ -88,10 +88,10 @@
* a macro key is pressed.
*/
enum { MACRO_VERSION_INFO,
MACRO_ANY
};
enum {
MACRO_VERSION_INFO,
MACRO_ANY,
};
/** The Model 100's key layouts are defined as 'keymaps'. By default, there are three
@ -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
/* This comment temporarily turns off astyle's indent enforcement
* 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
// LED color modes calibrated to draw 500mA or less on the
// Keyboardio Model 100.
@ -412,12 +414,10 @@ static void enterHardwareTestMode(uint8_t combo_index) {
*/
USE_MAGIC_COMBOS({.action = toggleKeyboardProtocol,
// Left Fn + Esc + Shift
.keys = { R3C6, R2C6, R3C7 }
}, {
.action = enterHardwareTestMode,
.keys = {R3C6, R2C6, R3C7}},
{.action = enterHardwareTestMode,
// Left Fn + Prog + LED
.keys = { R3C6, R0C0, R0C6 }
});
.keys = {R3C6, R0C0, R0C6}});
// First, tell Kaleidoscope which plugins you want to use.
// The order can be important. For example, LED effects are
@ -468,7 +468,13 @@ KALEIDOSCOPE_INIT_PLUGINS(
LEDChaseEffect,
// 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
LEDBreatheEffect,
@ -510,8 +516,7 @@ KALEIDOSCOPE_INIT_PLUGINS(
// comfortable - or able - to do automatically, but can be useful
// nevertheless. Such as toggling the key report protocol between Boot (used
// by BIOSes) and Report (NKRO).
USBQuirks
);
USBQuirks);
/** 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

@ -20,14 +20,15 @@
#include "Kaleidoscope.h"
#include "Kaleidoscope-Macros.h"
enum { _QWERTY,
enum {
_QWERTY,
_COLEMAK,
_DVORAK,
_LOWER,
_RAISE,
_PLOVER,
_ADJUST
};
};
// clang-format off

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

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

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

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

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

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

@ -50,8 +50,8 @@ static void leaderTestAA(uint8_t seq_index) {
}
static const kaleidoscope::plugin::Leader::dictionary_t leader_dictionary[] PROGMEM =
LEADER_DICT({LEADER_SEQ(LEAD(0), Key_A), leaderTestA},
{LEADER_SEQ(LEAD(0), Key_A, Key_A), leaderTestAA});
LEADER_DICT({LEADER_SEQ(LEAD(0), Key_A), leaderTestA},
{LEADER_SEQ(LEAD(0), Key_A, Key_A), leaderTestAA});
KALEIDOSCOPE_INIT_PLUGINS(Leader);

@ -122,8 +122,16 @@ class LeaderPrefix : public Plugin {
private:
// The "digit keys": these are the keys on the number row of the Model01.
KeyAddr digit_addrs_[10] = {
KeyAddr(0, 14), 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),
KeyAddr(0, 14),
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
@ -172,9 +180,9 @@ void leaderTestPrefix(uint8_t seq_index) {
}
static const kaleidoscope::plugin::Leader::dictionary_t leader_dictionary[] PROGMEM =
LEADER_DICT({LEADER_SEQ(LEAD(0), Key_X), leaderTestX},
{LEADER_SEQ(LEAD(0), Key_X, Key_X), leaderTestXX},
{LEADER_SEQ(LEAD(0), Key_Z), leaderTestPrefix});
LEADER_DICT({LEADER_SEQ(LEAD(0), Key_X), leaderTestX},
{LEADER_SEQ(LEAD(0), Key_X, Key_X), leaderTestXX},
{LEADER_SEQ(LEAD(0), Key_Z), leaderTestPrefix});
// The order matters here; LeaderPrefix won't work unless it precedes Leader in
// this list. If there are other plugins in the list, these two should ideally

@ -71,7 +71,7 @@ void macroTypeString(KeyEvent &event) {
}
// Example macro for macro step sequence.
const macro_t* macroSteps(KeyEvent &event) {
const macro_t *macroSteps(KeyEvent &event) {
if (keyToggledOn(event.state)) {
// Note that the following sequence leaves two keys down (`Key_RightAlt` and
// `Key_C`). These virtual keys will remain in effect until the Macros key
@ -82,7 +82,7 @@ const macro_t* macroSteps(KeyEvent &event) {
}
// Example macro that sets `event.key`.
const macro_t* macroNewSentence1(KeyEvent &event) {
const macro_t *macroNewSentence1(KeyEvent &event) {
if (keyToggledOn(event.state)) {
event.key = OSM(LeftShift);
return MACRO(Tc(Period), Tc(Spacebar), Tc(Spacebar));
@ -114,7 +114,7 @@ void macroNewSentence3(KeyEvent &event) {
// Macro that auto-repeats?
const macro_t* macroAction(uint8_t macro_id, KeyEvent &event) {
const macro_t *macroAction(uint8_t macro_id, KeyEvent &event) {
switch (macro_id) {
case 0:

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

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

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

@ -57,12 +57,12 @@ const macro_t *macroAction(uint8_t macro_id, KeyEvent &event) {
col = 10;
for (uint8_t step = 0; step <= 0xf0; step += 8) {
AlphaSquare.color = { step, step, step };
AlphaSquare.color = {step, step, step};
AlphaSquare.display({i, 0}, col);
delay(10);
}
for (uint8_t step = 0xff; step >= 8; step -= 8) {
AlphaSquare.color = { step, step, step };
AlphaSquare.color = {step, step, step};
AlphaSquare.display({i, 0}, col);
delay(10);
}
@ -74,14 +74,14 @@ const macro_t *macroAction(uint8_t macro_id, KeyEvent &event) {
delay(100);
for (uint8_t step = 0; step <= 0xf0; step += 8) {
AlphaSquare.color = { step, step, step };
AlphaSquare.color = {step, step, step};
AlphaSquare.display(kaleidoscope::plugin::alpha_square::symbols::Lambda, 2);
AlphaSquare.display(kaleidoscope::plugin::alpha_square::symbols::Lambda, 10);
delay(10);
}
for (uint8_t step = 0xff; step >= 8; step -= 8) {
AlphaSquare.color = { step, step, step };
AlphaSquare.color = {step, step, step};
AlphaSquare.display(kaleidoscope::plugin::alpha_square::symbols::Lambda, 2);
AlphaSquare.display(kaleidoscope::plugin::alpha_square::symbols::Lambda, 10);
delay(10);
@ -102,7 +102,7 @@ KALEIDOSCOPE_INIT_PLUGINS(LEDControl,
void setup() {
Kaleidoscope.setup();
AlphaSquare.color = { 0xcb, 0xc0, 0xff };
AlphaSquare.color = {0xcb, 0xc0, 0xff};
}
void loop() {

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

Loading…
Cancel
Save