Run the code through Kaleidoscope’s formatter
This commit is contained in:
parent
eda0a38fd3
commit
4ab3126e8e
@ -5,26 +5,27 @@
|
|||||||
|
|
||||||
namespace kaleidoscope {
|
namespace kaleidoscope {
|
||||||
namespace plugin {
|
namespace plugin {
|
||||||
EventHandlerResult LayerBasedTheme::onLayerChange() {
|
EventHandlerResult LayerBasedTheme::onLayerChange() {
|
||||||
uint8_t current_layer = Layer.mostRecent();
|
uint8_t current_layer = Layer.mostRecent();
|
||||||
uint8_t current_mode =::LEDControl.get_mode_index();
|
uint8_t current_mode = ::LEDControl.get_mode_index();
|
||||||
uint8_t new_mode;
|
uint8_t new_mode;
|
||||||
|
|
||||||
if (current_layer <= 3) {
|
if (current_layer <= 3) {
|
||||||
new_mode = 2;
|
new_mode = 2;
|
||||||
} else {
|
} else {
|
||||||
new_mode = 3;
|
new_mode = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (new_mode != current_mode) {
|
if (new_mode != current_mode) {
|
||||||
::LEDControl.set_mode(new_mode);
|
::LEDControl.set_mode(new_mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
return EventHandlerResult::OK;
|
return EventHandlerResult::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
LayerBasedTheme::TransientLEDMode::TransientLEDMode(const LayerBasedTheme *parent)
|
LayerBasedTheme::TransientLEDMode::TransientLEDMode(
|
||||||
: parent_(parent) {};
|
const LayerBasedTheme *parent)
|
||||||
|
: parent_(parent){};
|
||||||
} // namespace plugin
|
} // namespace plugin
|
||||||
} // namespace kaleidoscope
|
} // namespace kaleidoscope
|
||||||
|
|
||||||
|
@ -3,24 +3,25 @@
|
|||||||
#include "kaleidoscope/event_handler_result.h"
|
#include "kaleidoscope/event_handler_result.h"
|
||||||
#include "kaleidoscope/plugin.h"
|
#include "kaleidoscope/plugin.h"
|
||||||
#include "kaleidoscope/plugin/AccessTransientLEDMode.h"
|
#include "kaleidoscope/plugin/AccessTransientLEDMode.h"
|
||||||
#include "kaleidoscope/plugin/LEDModeInterface.h"
|
|
||||||
#include "kaleidoscope/plugin/LEDMode.h"
|
#include "kaleidoscope/plugin/LEDMode.h"
|
||||||
|
#include "kaleidoscope/plugin/LEDModeInterface.h"
|
||||||
|
|
||||||
namespace kaleidoscope {
|
namespace kaleidoscope {
|
||||||
namespace plugin {
|
namespace plugin {
|
||||||
class LayerBasedTheme : public Plugin,
|
class LayerBasedTheme : public Plugin,
|
||||||
public LEDModeInterface,
|
public LEDModeInterface,
|
||||||
public AccessTransientLEDMode {
|
public AccessTransientLEDMode {
|
||||||
public:
|
public:
|
||||||
LayerBasedTheme(void) {}
|
LayerBasedTheme(void) {}
|
||||||
|
|
||||||
EventHandlerResult onLayerChange();
|
EventHandlerResult onLayerChange();
|
||||||
|
|
||||||
class TransientLEDMode : public LEDMode {
|
class TransientLEDMode : public LEDMode {
|
||||||
public:
|
public:
|
||||||
explicit TransientLEDMode(const LayerBasedTheme *parent);
|
explicit TransientLEDMode(const LayerBasedTheme *parent);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const LayerBasedTheme *parent_;
|
const LayerBasedTheme *parent_;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
} // namespace plugin
|
} // namespace plugin
|
||||||
|
78
Model100.ino
78
Model100.ino
@ -6,23 +6,22 @@
|
|||||||
#define BUILD_INFORMATION "locally built on " __DATE__ " at " __TIME__
|
#define BUILD_INFORMATION "locally built on " __DATE__ " at " __TIME__
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "Kaleidoscope-Colormap.h"
|
||||||
#include "Kaleidoscope.h"
|
|
||||||
#include "Kaleidoscope-EEPROM-Settings.h"
|
|
||||||
#include "Kaleidoscope-EEPROM-Keymap.h"
|
#include "Kaleidoscope-EEPROM-Keymap.h"
|
||||||
|
#include "Kaleidoscope-EEPROM-Settings.h"
|
||||||
#include "Kaleidoscope-FocusSerial.h"
|
#include "Kaleidoscope-FocusSerial.h"
|
||||||
#include "Kaleidoscope-MouseKeys.h"
|
#include "Kaleidoscope-HardwareTestMode.h"
|
||||||
#include "Kaleidoscope-Macros.h"
|
#include "Kaleidoscope-HostPowerManagement.h"
|
||||||
|
#include "Kaleidoscope-LED-Palette-Theme.h"
|
||||||
|
#include "Kaleidoscope-LED-Stalker.h"
|
||||||
#include "Kaleidoscope-LEDControl.h"
|
#include "Kaleidoscope-LEDControl.h"
|
||||||
#include "Kaleidoscope-LEDEffect-BootGreeting.h"
|
#include "Kaleidoscope-LEDEffect-BootGreeting.h"
|
||||||
#include "Kaleidoscope-LEDEffect-Rainbow.h"
|
#include "Kaleidoscope-LEDEffect-Rainbow.h"
|
||||||
#include "Kaleidoscope-LED-Stalker.h"
|
#include "Kaleidoscope-Macros.h"
|
||||||
#include "Kaleidoscope-LED-Palette-Theme.h"
|
|
||||||
#include "Kaleidoscope-Colormap.h"
|
|
||||||
#include "Kaleidoscope-HardwareTestMode.h"
|
|
||||||
#include "Kaleidoscope-HostPowerManagement.h"
|
|
||||||
#include "Kaleidoscope-MagicCombo.h"
|
#include "Kaleidoscope-MagicCombo.h"
|
||||||
|
#include "Kaleidoscope-MouseKeys.h"
|
||||||
#include "Kaleidoscope-USB-Quirks.h"
|
#include "Kaleidoscope-USB-Quirks.h"
|
||||||
|
#include "Kaleidoscope.h"
|
||||||
|
|
||||||
#include "LayerBasedTheme.h"
|
#include "LayerBasedTheme.h"
|
||||||
|
|
||||||
@ -31,30 +30,30 @@ enum {
|
|||||||
MACRO_ANY,
|
MACRO_ANY,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/** The Model 100's key layouts are defined as 'keymaps'.
|
/** The Model 100's key layouts are defined as 'keymaps'.
|
||||||
*
|
*
|
||||||
* Each keymap is defined as a list using the 'KEYMAP_STACKED' macro, built
|
* Each keymap is defined as a list using the 'KEYMAP_STACKED' macro, built
|
||||||
* of first the left hand's layout, followed by the right hand's layout.
|
* of first the left hand's layout, followed by the right hand's layout.
|
||||||
*
|
*
|
||||||
* Keymaps typically consist mostly of `Key_` definitions. There are many, many keys
|
* Keymaps typically consist mostly of `Key_` definitions. There are many, many
|
||||||
* defined as part of the USB HID Keyboard specification. You can find the names
|
* keys defined as part of the USB HID Keyboard specification. You can find the
|
||||||
* (if not yet the explanations) for all the standard `Key_` defintions offered by
|
* names (if not yet the explanations) for all the standard `Key_` defintions
|
||||||
* Kaleidoscope in these files:
|
* offered by Kaleidoscope in these files:
|
||||||
* https://github.com/keyboardio/Kaleidoscope/blob/master/src/kaleidoscope/key_defs/keyboard.h
|
* https://github.com/keyboardio/Kaleidoscope/blob/master/src/kaleidoscope/key_defs/keyboard.h
|
||||||
* https://github.com/keyboardio/Kaleidoscope/blob/master/src/kaleidoscope/key_defs/consumerctl.h
|
* https://github.com/keyboardio/Kaleidoscope/blob/master/src/kaleidoscope/key_defs/consumerctl.h
|
||||||
* https://github.com/keyboardio/Kaleidoscope/blob/master/src/kaleidoscope/key_defs/sysctl.h
|
* https://github.com/keyboardio/Kaleidoscope/blob/master/src/kaleidoscope/key_defs/sysctl.h
|
||||||
* https://github.com/keyboardio/Kaleidoscope/blob/master/src/kaleidoscope/key_defs/keymaps.h
|
* https://github.com/keyboardio/Kaleidoscope/blob/master/src/kaleidoscope/key_defs/keymaps.h
|
||||||
*
|
*
|
||||||
* Additional things that should be documented here include
|
* Additional things that should be documented here include
|
||||||
* using ___ to let keypresses fall through to the previously active layer
|
* using ___ to let keypresses fall through to the previously active layer
|
||||||
* using XXX to mark a keyswitch as 'blocked' on this layer
|
* using XXX to mark a keyswitch as 'blocked' on this layer
|
||||||
* using ShiftToLayer() and LockLayer() keys to change the active keymap.
|
* using ShiftToLayer() and LockLayer() keys to change the active keymap.
|
||||||
* keeping NUM and FN consistent and accessible on all layers
|
* keeping NUM and FN consistent and accessible on all layers
|
||||||
*
|
*
|
||||||
* A key defined as 'ShiftToLayer(FUNCTION)' will switch to FUNCTION while held.
|
* A key defined as 'ShiftToLayer(FUNCTION)' will switch to FUNCTION while held.
|
||||||
* Similarly, a key defined as 'LockLayer(FUNCTION)' will switch to FUNCTION when tapped.
|
* Similarly, a key defined as 'LockLayer(FUNCTION)' will switch to FUNCTION
|
||||||
*/
|
* when tapped.
|
||||||
|
*/
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
PRIMARY,
|
PRIMARY,
|
||||||
@ -68,7 +67,6 @@ enum {
|
|||||||
ONEHAND_RIGHT,
|
ONEHAND_RIGHT,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/* 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
|
||||||
*/
|
*/
|
||||||
@ -242,8 +240,8 @@ const macro_t *macroAction(uint8_t macro_id, KeyEvent &event) {
|
|||||||
return MACRO_NONE;
|
return MACRO_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void toggleLedsOnSuspendResume(
|
||||||
void toggleLedsOnSuspendResume(kaleidoscope::plugin::HostPowerManagement::Event event) {
|
kaleidoscope::plugin::HostPowerManagement::Event event) {
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case kaleidoscope::plugin::HostPowerManagement::Suspend:
|
case kaleidoscope::plugin::HostPowerManagement::Suspend:
|
||||||
LEDControl.disable();
|
LEDControl.disable();
|
||||||
@ -256,14 +254,12 @@ void toggleLedsOnSuspendResume(kaleidoscope::plugin::HostPowerManagement::Event
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void hostPowerManagementEventHandler(kaleidoscope::plugin::HostPowerManagement::Event event) {
|
void hostPowerManagementEventHandler(
|
||||||
|
kaleidoscope::plugin::HostPowerManagement::Event event) {
|
||||||
toggleLedsOnSuspendResume(event);
|
toggleLedsOnSuspendResume(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
enum {
|
enum { COMBO_TOGGLE_NKRO_MODE, COMBO_ENTER_TEST_MODE };
|
||||||
COMBO_TOGGLE_NKRO_MODE,
|
|
||||||
COMBO_ENTER_TEST_MODE
|
|
||||||
};
|
|
||||||
|
|
||||||
static void toggleKeyboardProtocol(uint8_t combo_index) {
|
static void toggleKeyboardProtocol(uint8_t combo_index) {
|
||||||
USBQuirks.toggleKeyboardProtocol();
|
USBQuirks.toggleKeyboardProtocol();
|
||||||
|
Loading…
Reference in New Issue
Block a user