summaryrefslogtreecommitdiff
path: root/quantum
diff options
context:
space:
mode:
Diffstat (limited to 'quantum')
-rw-r--r--quantum/color.c6
-rw-r--r--quantum/encoder.c8
-rw-r--r--quantum/process_keycode/process_rgb.c10
-rw-r--r--quantum/quantum.c2
-rw-r--r--quantum/quantum.h4
-rw-r--r--quantum/quantum_keycodes.h6
-rw-r--r--quantum/rgb_matrix.c8
-rw-r--r--quantum/rgblight.c5
-rw-r--r--quantum/via.c246
-rw-r--r--quantum/via.h46
10 files changed, 151 insertions, 190 deletions
diff --git a/quantum/color.c b/quantum/color.c
index 85a6d52cf0..a5977e8ee2 100644
--- a/quantum/color.c
+++ b/quantum/color.c
@@ -88,9 +88,9 @@ RGB hsv_to_rgb(HSV hsv) {
#ifdef RGBW
-#ifndef MIN
-# define MIN(a, b) ((a) < (b) ? (a) : (b))
-#endif
+# ifndef MIN
+# define MIN(a, b) ((a) < (b) ? (a) : (b))
+# endif
void convert_rgb_to_rgbw(LED_TYPE *led) {
// Determine lowest value in all three colors, put that into
// the white channel and then shift all colors by that amount
diff --git a/quantum/encoder.c b/quantum/encoder.c
index c41b89f495..8e11562eb7 100644
--- a/quantum/encoder.c
+++ b/quantum/encoder.c
@@ -37,8 +37,8 @@ static pin_t encoders_pad_b[] = ENCODERS_PAD_B;
static int8_t encoder_LUT[] = {0, -1, 1, 0, 1, 0, 0, -1, -1, 0, 0, 1, 0, 1, -1, 0};
-static uint8_t encoder_state[NUMBER_OF_ENCODERS] = {0};
-static int8_t encoder_pulses[NUMBER_OF_ENCODERS] = {0};
+static uint8_t encoder_state[NUMBER_OF_ENCODERS] = {0};
+static int8_t encoder_pulses[NUMBER_OF_ENCODERS] = {0};
#ifdef SPLIT_KEYBOARD
// right half encoders come over as second set of encoders
@@ -88,7 +88,7 @@ static void encoder_update(int8_t index, uint8_t state) {
encoder_value[index]++;
encoder_update_kb(index, true);
}
- if (encoder_pulses[i] <= -ENCODER_RESOLUTION) { // direction is arbitrary here, but this clockwise
+ if (encoder_pulses[i] <= -ENCODER_RESOLUTION) { // direction is arbitrary here, but this clockwise
encoder_value[index]--;
encoder_update_kb(index, false);
}
@@ -109,7 +109,7 @@ void encoder_state_raw(uint8_t* slave_state) { memcpy(slave_state, &encoder_valu
void encoder_update_raw(uint8_t* slave_state) {
for (uint8_t i = 0; i < NUMBER_OF_ENCODERS; i++) {
uint8_t index = i + thatHand;
- int8_t delta = slave_state[i] - encoder_value[index];
+ int8_t delta = slave_state[i] - encoder_value[index];
while (delta > 0) {
delta--;
encoder_value[index]++;
diff --git a/quantum/process_keycode/process_rgb.c b/quantum/process_keycode/process_rgb.c
index c76166342f..627e5986fb 100644
--- a/quantum/process_keycode/process_rgb.c
+++ b/quantum/process_keycode/process_rgb.c
@@ -20,8 +20,8 @@ typedef void (*rgb_func_pointer)(void);
/**
* Wrapper for inc/dec rgb keycode
- *
- * noinline to optimise for firmware size not speed (not in hot path)
+ *
+ * noinline to optimise for firmware size not speed (not in hot path)
*/
static void __attribute__((noinline)) handleKeycodeRGB(const uint8_t is_shifted, const rgb_func_pointer inc_func, const rgb_func_pointer dec_func) {
if (is_shifted) {
@@ -35,10 +35,10 @@ static void __attribute__((noinline)) handleKeycodeRGB(const uint8_t is_shifted,
* Wrapper for animation mode
* - if not in animation family -> jump to that animation
* - otherwise -> wrap round animation speed
- *
- * noinline to optimise for firmware size not speed (not in hot path)
+ *
+ * noinline to optimise for firmware size not speed (not in hot path)
*/
-static void __attribute__((noinline,unused)) handleKeycodeRGBMode(const uint8_t start, const uint8_t end) {
+static void __attribute__((noinline, unused)) handleKeycodeRGBMode(const uint8_t start, const uint8_t end) {
if ((start <= rgblight_get_mode()) && (rgblight_get_mode() < end)) {
rgblight_step();
} else {
diff --git a/quantum/quantum.c b/quantum/quantum.c
index 11a8d76092..286d664ba9 100644
--- a/quantum/quantum.c
+++ b/quantum/quantum.c
@@ -335,6 +335,7 @@ __attribute__((weak)) const bool ascii_to_altgr_lut[128] PROGMEM = {0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+// clang-format off
__attribute__((weak)) const uint8_t ascii_to_keycode_lut[128] PROGMEM = {// NUL SOH STX ETX EOT ENQ ACK BEL
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
// BS TAB LF VT FF CR SO SI
@@ -368,6 +369,7 @@ __attribute__((weak)) const uint8_t ascii_to_keycode_lut[128] PROGMEM = {// NUL
KC_P, KC_Q, KC_R, KC_S, KC_T, KC_U, KC_V, KC_W,
// x y z { | } ~ DEL
KC_X, KC_Y, KC_Z, KC_LBRC, KC_BSLS, KC_RBRC, KC_GRV, KC_DEL};
+// clang-format on
void send_string(const char *str) { send_string_with_delay(str, 0); }
diff --git a/quantum/quantum.h b/quantum/quantum.h
index 50a7924584..4bad4cdee3 100644
--- a/quantum/quantum.h
+++ b/quantum/quantum.h
@@ -176,11 +176,11 @@ extern layer_state_t layer_state;
#endif
#ifdef DYNAMIC_KEYMAP_ENABLE
-# include "dynamic_keymap.h"
+# include "dynamic_keymap.h"
#endif
#ifdef VIA_ENABLE
-# include "via.h"
+# include "via.h"
#endif
// Function substitutions to ease GPIO manipulation
diff --git a/quantum/quantum_keycodes.h b/quantum/quantum_keycodes.h
index 278b445a41..2c3c4788b2 100644
--- a/quantum/quantum_keycodes.h
+++ b/quantum/quantum_keycodes.h
@@ -679,7 +679,7 @@ enum quantum_keycodes {
#define AG_TOGG MAGIC_TOGGLE_ALT_GUI
#define GUI_OFF MAGIC_NO_GUI
-#define GUI_ON MAGIC_UNNO_GUI
+#define GUI_ON MAGIC_UNNO_GUI
#define GE_SWAP MAGIC_SWAP_GRAVE_ESC
#define GE_NORM MAGIC_UNSWAP_GRAVE_ESC
@@ -687,8 +687,8 @@ enum quantum_keycodes {
#define BS_SWAP MAGIC_SWAP_BACKSLASH_BACKSPACE
#define BS_NORM MAGIC_UNSWAP_BACKSLASH_BACKSPACE
-#define NK_ON MAGIC_HOST_NKRO
-#define NK_OFF MAGIC_UNHOST_NKRO
+#define NK_ON MAGIC_HOST_NKRO
+#define NK_OFF MAGIC_UNHOST_NKRO
#define NK_TOGG MAGIC_TOGGLE_NKRO
#define EH_LEFT MAGIC_EE_HANDS_LEFT
diff --git a/quantum/rgb_matrix.c b/quantum/rgb_matrix.c
index 27e5c18114..1a9cf82e5f 100644
--- a/quantum/rgb_matrix.c
+++ b/quantum/rgb_matrix.c
@@ -435,10 +435,10 @@ void rgb_matrix_init(void) {
}
void rgb_matrix_set_suspend_state(bool state) {
- if (state && RGB_DISABLE_WHEN_USB_SUSPENDED) {
- rgb_matrix_set_color_all(0, 0, 0);
- }
- g_suspend_state = state;
+ if (RGB_DISABLE_WHEN_USB_SUSPENDED && state) {
+ rgb_matrix_set_color_all(0, 0, 0); // turn off all LEDs when suspending
+ }
+ g_suspend_state = state;
}
void rgb_matrix_toggle(void) {
diff --git a/quantum/rgblight.c b/quantum/rgblight.c
index 0c5f650830..86d7da4a8e 100644
--- a/quantum/rgblight.c
+++ b/quantum/rgblight.c
@@ -640,11 +640,12 @@ void rgblight_set(void) {
# else
start_led = led + clipping_start_pos;
# endif
-#ifdef RGBW
+
+# ifdef RGBW
for (uint8_t i = 0; i < num_leds; i++) {
convert_rgb_to_rgbw(&start_led[i]);
}
-#endif
+# endif
ws2812_setleds(start_led, num_leds);
}
#endif
diff --git a/quantum/via.c b/quantum/via.c
index 2a47b9ee94..f85af8d9e1 100644
--- a/quantum/via.c
+++ b/quantum/via.c
@@ -45,7 +45,7 @@
#include "raw_hid.h"
#include "dynamic_keymap.h"
#include "tmk_core/common/eeprom.h"
-#include "version.h" // for QMK_BUILDDATE used in EEPROM magic
+#include "version.h" // for QMK_BUILDDATE used in EEPROM magic
// Forward declare some helpers.
#if defined(VIA_QMK_BACKLIGHT_ENABLE)
@@ -60,37 +60,32 @@ void via_qmk_rgblight_get_value(uint8_t *data);
// Can be called in an overriding via_init_kb() to test if keyboard level code usage of
// EEPROM is invalid and use/save defaults.
-bool via_eeprom_is_valid(void)
-{
- char *p = QMK_BUILDDATE; // e.g. "2019-11-05-11:29:54"
- uint8_t magic0 = ( ( p[2] & 0x0F ) << 4 ) | ( p[3] & 0x0F );
- uint8_t magic1 = ( ( p[5] & 0x0F ) << 4 ) | ( p[6] & 0x0F );
- uint8_t magic2 = ( ( p[8] & 0x0F ) << 4 ) | ( p[9] & 0x0F );
-
- return (eeprom_read_byte( (void*)VIA_EEPROM_MAGIC_ADDR+0 ) == magic0 &&
- eeprom_read_byte( (void*)VIA_EEPROM_MAGIC_ADDR+1 ) == magic1 &&
- eeprom_read_byte( (void*)VIA_EEPROM_MAGIC_ADDR+2 ) == magic2 );
+bool via_eeprom_is_valid(void) {
+ char * p = QMK_BUILDDATE; // e.g. "2019-11-05-11:29:54"
+ uint8_t magic0 = ((p[2] & 0x0F) << 4) | (p[3] & 0x0F);
+ uint8_t magic1 = ((p[5] & 0x0F) << 4) | (p[6] & 0x0F);
+ uint8_t magic2 = ((p[8] & 0x0F) << 4) | (p[9] & 0x0F);
+
+ return (eeprom_read_byte((void *)VIA_EEPROM_MAGIC_ADDR + 0) == magic0 && eeprom_read_byte((void *)VIA_EEPROM_MAGIC_ADDR + 1) == magic1 && eeprom_read_byte((void *)VIA_EEPROM_MAGIC_ADDR + 2) == magic2);
}
// Sets VIA/keyboard level usage of EEPROM to valid/invalid
// Keyboard level code (eg. via_init_kb()) should not call this
-void via_eeprom_set_valid(bool valid)
-{
- char *p = QMK_BUILDDATE; // e.g. "2019-11-05-11:29:54"
- uint8_t magic0 = ( ( p[2] & 0x0F ) << 4 ) | ( p[3] & 0x0F );
- uint8_t magic1 = ( ( p[5] & 0x0F ) << 4 ) | ( p[6] & 0x0F );
- uint8_t magic2 = ( ( p[8] & 0x0F ) << 4 ) | ( p[9] & 0x0F );
-
- eeprom_update_byte( (void*)VIA_EEPROM_MAGIC_ADDR+0, valid ? magic0 : 0xFF);
- eeprom_update_byte( (void*)VIA_EEPROM_MAGIC_ADDR+1, valid ? magic1 : 0xFF);
- eeprom_update_byte( (void*)VIA_EEPROM_MAGIC_ADDR+2, valid ? magic2 : 0xFF);
+void via_eeprom_set_valid(bool valid) {
+ char * p = QMK_BUILDDATE; // e.g. "2019-11-05-11:29:54"
+ uint8_t magic0 = ((p[2] & 0x0F) << 4) | (p[3] & 0x0F);
+ uint8_t magic1 = ((p[5] & 0x0F) << 4) | (p[6] & 0x0F);
+ uint8_t magic2 = ((p[8] & 0x0F) << 4) | (p[9] & 0x0F);
+
+ eeprom_update_byte((void *)VIA_EEPROM_MAGIC_ADDR + 0, valid ? magic0 : 0xFF);
+ eeprom_update_byte((void *)VIA_EEPROM_MAGIC_ADDR + 1, valid ? magic1 : 0xFF);
+ eeprom_update_byte((void *)VIA_EEPROM_MAGIC_ADDR + 2, valid ? magic2 : 0xFF);
}
// Flag QMK and VIA/keyboard level EEPROM as invalid.
// Used in bootmagic_lite() and VIA command handler.
// Keyboard level code should not need to call this.
-void via_eeprom_reset(void)
-{
+void via_eeprom_reset(void) {
// Set the VIA specific EEPROM state as invalid.
via_eeprom_set_valid(false);
// Set the TMK/QMK EEPROM state as invalid.
@@ -100,8 +95,7 @@ void via_eeprom_reset(void)
// Override bootmagic_lite() so it can flag EEPROM as invalid
// as well as jump to bootloader, thus performing a "factory reset"
// of dynamic keymaps and optionally backlight/other settings.
-void bootmagic_lite(void)
-{
+void bootmagic_lite(void) {
// The lite version of TMK's bootmagic based on Wilba.
// 100% less potential for accidentally making the
// keyboard do stupid things.
@@ -134,12 +128,10 @@ void bootmagic_lite(void)
// for backlight, rotary encoders, etc.
// The override should not set via_eeprom_set_valid(true) as
// the caller also needs to check the valid state.
-__attribute__((weak)) void via_init_kb(void) {
-}
+__attribute__((weak)) void via_init_kb(void) {}
// Called by QMK core to initialize dynamic keymaps etc.
-void via_init(void)
-{
+void via_init(void) {
// Let keyboard level test EEPROM valid state,
// but not set it valid, it is done here.
via_init_kb();
@@ -147,7 +139,7 @@ void via_init(void)
// If the EEPROM has the magic, the data is good.
// OK to load from EEPROM.
if (via_eeprom_is_valid()) {
- } else {
+ } else {
// This resets the layout options
via_set_layout_options(0);
// This resets the keymaps in EEPROM to what is in flash.
@@ -161,12 +153,11 @@ void via_init(void)
// This is generalized so the layout options EEPROM usage can be
// variable, between 1 and 4 bytes.
-uint32_t via_get_layout_options(void)
-{
+uint32_t via_get_layout_options(void) {
uint32_t value = 0;
// Start at the most significant byte
- void * source = (void *)(VIA_EEPROM_LAYOUT_OPTIONS_ADDR);
- for ( uint8_t i = 0; i < VIA_EEPROM_LAYOUT_OPTIONS_SIZE; i++ ) {
+ void *source = (void *)(VIA_EEPROM_LAYOUT_OPTIONS_ADDR);
+ for (uint8_t i = 0; i < VIA_EEPROM_LAYOUT_OPTIONS_SIZE; i++) {
value = value << 8;
value |= eeprom_read_byte(source);
source++;
@@ -174,24 +165,21 @@ uint32_t via_get_layout_options(void)
return value;
}
-void via_set_layout_options(uint32_t value)
-{
+void via_set_layout_options(uint32_t value) {
// Start at the least significant byte
- void * target = (void *)(VIA_EEPROM_LAYOUT_OPTIONS_ADDR+VIA_EEPROM_LAYOUT_OPTIONS_SIZE-1);
- for ( uint8_t i = 0; i < VIA_EEPROM_LAYOUT_OPTIONS_SIZE; i++ ) {
- eeprom_update_byte(target, value & 0xFF );
+ void *target = (void *)(VIA_EEPROM_LAYOUT_OPTIONS_ADDR + VIA_EEPROM_LAYOUT_OPTIONS_SIZE - 1);
+ for (uint8_t i = 0; i < VIA_EEPROM_LAYOUT_OPTIONS_SIZE; i++) {
+ eeprom_update_byte(target, value & 0xFF);
value = value >> 8;
target--;
}
}
// Called by QMK core to process VIA-specific keycodes.
-bool process_record_via(uint16_t keycode, keyrecord_t *record)
-{
+bool process_record_via(uint16_t keycode, keyrecord_t *record) {
// Handle macros
if (record->event.pressed) {
- if ( keycode >= MACRO00 && keycode <= MACRO15 )
- {
+ if (keycode >= MACRO00 && keycode <= MACRO15) {
uint8_t id = keycode - MACRO00;
dynamic_keymap_macro_send(id);
return false;
@@ -201,7 +189,7 @@ bool process_record_via(uint16_t keycode, keyrecord_t *record)
// TODO: ideally this would be generalized and refactored into
// QMK core as advanced keycodes, until then, the simple case
// can be available here to keyboards using VIA
- switch(keycode) {
+ switch (keycode) {
case FN_MO13:
if (record->event.pressed) {
layer_on(1);
@@ -231,7 +219,7 @@ bool process_record_via(uint16_t keycode, keyrecord_t *record)
// DO NOT call raw_hid_send() in the overide function.
__attribute__((weak)) void raw_hid_receive_kb(uint8_t *data, uint8_t length) {
uint8_t *command_id = &(data[0]);
- *command_id = id_unhandled;
+ *command_id = id_unhandled;
}
// VIA handles received HID messages first, and will route to
@@ -241,103 +229,84 @@ __attribute__((weak)) void raw_hid_receive_kb(uint8_t *data, uint8_t length) {
//
// raw_hid_send() is called at the end, with the same buffer, which was
// possibly modified with returned values.
-void raw_hid_receive( uint8_t *data, uint8_t length )
-{
- uint8_t *command_id = &(data[0]);
+void raw_hid_receive(uint8_t *data, uint8_t length) {
+ uint8_t *command_id = &(data[0]);
uint8_t *command_data = &(data[1]);
- switch ( *command_id )
- {
- case id_get_protocol_version:
- {
+ switch (*command_id) {
+ case id_get_protocol_version: {
command_data[0] = VIA_PROTOCOL_VERSION >> 8;
command_data[1] = VIA_PROTOCOL_VERSION & 0xFF;
break;
}
- case id_get_keyboard_value:
- {
- switch ( command_data[0] )
- {
- case id_uptime:
- {
- uint32_t value = timer_read32();
- command_data[1] = (value >> 24 ) & 0xFF;
- command_data[2] = (value >> 16 ) & 0xFF;
- command_data[3] = (value >> 8 ) & 0xFF;
+ case id_get_keyboard_value: {
+ switch (command_data[0]) {
+ case id_uptime: {
+ uint32_t value = timer_read32();
+ command_data[1] = (value >> 24) & 0xFF;
+ command_data[2] = (value >> 16) & 0xFF;
+ command_data[3] = (value >> 8) & 0xFF;
command_data[4] = value & 0xFF;
break;
}
- case id_layout_options:
- {
- uint32_t value = via_get_layout_options();
- command_data[1] = (value >> 24 ) & 0xFF;
- command_data[2] = (value >> 16 ) & 0xFF;
- command_data[3] = (value >> 8 ) & 0xFF;
+ case id_layout_options: {
+ uint32_t value = via_get_layout_options();
+ command_data[1] = (value >> 24) & 0xFF;
+ command_data[2] = (value >> 16) & 0xFF;
+ command_data[3] = (value >> 8) & 0xFF;
command_data[4] = value & 0xFF;
break;
}
- case id_switch_matrix_state:
- {
-#if ( (MATRIX_COLS/8+1)*MATRIX_ROWS <= 28 )
+ case id_switch_matrix_state: {
+#if ((MATRIX_COLS / 8 + 1) * MATRIX_ROWS <= 28)
uint8_t i = 1;
- for ( uint8_t row=0; row<MATRIX_ROWS; row++ ) {
+ for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
matrix_row_t value = matrix_get_row(row);
-#if (MATRIX_COLS > 24)
- command_data[i++] = (value >> 24 ) & 0xFF;
-#endif
-#if (MATRIX_COLS > 16)
- command_data[i++] = (value >> 16 ) & 0xFF;
-#endif
-#if (MATRIX_COLS > 8)
- command_data[i++] = (value >> 8 ) & 0xFF;
-#endif
+# if (MATRIX_COLS > 24)
+ command_data[i++] = (value >> 24) & 0xFF;
+# endif
+# if (MATRIX_COLS > 16)
+ command_data[i++] = (value >> 16) & 0xFF;
+# endif
+# if (MATRIX_COLS > 8)
+ command_data[i++] = (value >> 8) & 0xFF;
+# endif
command_data[i++] = value & 0xFF;
}
#endif
break;
}
- default:
- {
- raw_hid_receive_kb(data,length);
+ default: {
+ raw_hid_receive_kb(data, length);
break;
}
}
break;
}
- case id_set_keyboard_value:
- {
- switch ( command_data[0] )
- {
- case id_layout_options:
- {
- uint32_t value = ( (uint32_t)command_data[1] << 24 ) |
- ( (uint32_t)command_data[2] << 16 ) |
- ( (uint32_t)command_data[3] << 8 ) |
- (uint32_t)command_data[4];
+ case id_set_keyboard_value: {
+ switch (command_data[0]) {
+ case id_layout_options: {
+ uint32_t value = ((uint32_t)command_data[1] << 24) | ((uint32_t)command_data[2] << 16) | ((uint32_t)command_data[3] << 8) | (uint32_t)command_data[4];
via_set_layout_options(value);
break;
}
- default:
- {
- raw_hid_receive_kb(data,length);
+ default: {
+ raw_hid_receive_kb(data, length);
break;
}
}
break;
}
- case id_dynamic_keymap_get_keycode:
- {
- uint16_t keycode = dynamic_keymap_get_keycode( command_data[0], command_data[1], command_data[2] );
- command_data[3] = keycode >> 8;
- command_data[4] = keycode & 0xFF;
+ case id_dynamic_keymap_get_keycode: {
+ uint16_t keycode = dynamic_keymap_get_keycode(command_data[0], command_data[1], command_data[2]);
+ command_data[3] = keycode >> 8;
+ command_data[4] = keycode & 0xFF;
break;
}
- case id_dynamic_keymap_set_keycode:
- {
- dynamic_keymap_set_keycode( command_data[0], command_data[1], command_data[2], ( command_data[3] << 8 ) | command_data[4] );
+ case id_dynamic_keymap_set_keycode: {
+ dynamic_keymap_set_keycode(command_data[0], command_data[1], command_data[2], (command_data[3] << 8) | command_data[4]);
break;
}
- case id_dynamic_keymap_reset:
- {
+ case id_dynamic_keymap_reset: {
dynamic_keymap_reset();
break;
}
@@ -389,73 +358,62 @@ void raw_hid_receive( uint8_t *data, uint8_t length )
#endif
break;
}
- case id_dynamic_keymap_macro_get_count:
- {
+ case id_dynamic_keymap_macro_get_count: {
command_data[0] = dynamic_keymap_macro_get_count();
break;
}
- case id_dynamic_keymap_macro_get_buffer_size:
- {
- uint16_t size = dynamic_keymap_macro_get_buffer_size();
+ case id_dynamic_keymap_macro_get_buffer_size: {
+ uint16_t size = dynamic_keymap_macro_get_buffer_size();
command_data[0] = size >> 8;
command_data[1] = size & 0xFF;
break;
}
- case id_dynamic_keymap_macro_get_buffer:
- {
- uint16_t offset = ( command_data[0] << 8 ) | command_data[1];
- uint16_t size = command_data[2]; // size <= 28
- dynamic_keymap_macro_get_buffer( offset, size, &command_data[3] );
+ case id_dynamic_keymap_macro_get_buffer: {
+ uint16_t offset = (command_data[0] << 8) | command_data[1];
+ uint16_t size = command_data[2]; // size <= 28
+ dynamic_keymap_macro_get_buffer(offset, size, &command_data[3]);
break;
}
- case id_dynamic_keymap_macro_set_buffer:
- {
- uint16_t offset = ( command_data[0] << 8 ) | command_data[1];
- uint16_t size = command_data[2]; // size <= 28
- dynamic_keymap_macro_set_buffer( offset, size, &command_data[3] );
+ case id_dynamic_keymap_macro_set_buffer: {
+ uint16_t offset = (command_data[0] << 8) | command_data[1];
+ uint16_t size = command_data[2]; // size <= 28
+ dynamic_keymap_macro_set_buffer(offset, size, &command_data[3]);
break;
}
- case id_dynamic_keymap_macro_reset:
- {
+ case id_dynamic_keymap_macro_reset: {
dynamic_keymap_macro_reset();
break;
}
- case id_dynamic_keymap_get_layer_count:
- {
+ case id_dynamic_keymap_get_layer_count: {
command_data[0] = dynamic_keymap_get_layer_count();
break;
}
- case id_dynamic_keymap_get_buffer:
- {
- uint16_t offset = ( command_data[0] << 8 ) | command_data[1];
- uint16_t size = command_data[2]; // size <= 28
- dynamic_keymap_get_buffer( offset, size, &command_data[3] );
+ case id_dynamic_keymap_get_buffer: {
+ uint16_t offset = (command_data[0] << 8) | command_data[1];
+ uint16_t size = command_data[2]; // size <= 28
+ dynamic_keymap_get_buffer(offset, size, &command_data[3]);
break;
}
- case id_dynamic_keymap_set_buffer:
- {
- uint16_t offset = ( command_data[0] << 8 ) | command_data[1];
- uint16_t size = command_data[2]; // size <= 28
- dynamic_keymap_set_buffer( offset, size, &command_data[3] );
+ case id_dynamic_keymap_set_buffer: {
+ uint16_t offset = (command_data[0] << 8) | command_data[1];
+ uint16_t size = command_data[2]; // size <= 28
+ dynamic_keymap_set_buffer(offset, size, &command_data[3]);
break;
}
- case id_eeprom_reset:
- {
+ case id_eeprom_reset: {
via_eeprom_reset();
break;
}
- case id_bootloader_jump:
- {
+ case id_bootloader_jump: {
// Need to send data back before the jump
// Informs host that the command is handled
- raw_hid_send( data, length );
+ raw_hid_send(data, length);
// Give host time to read it
wait_ms(100);
bootloader_jump();
break;
}
- default:
- {
+ default: {
// The command ID is not known
// Return the unhandled state
*command_id = id_unhandled;
@@ -465,7 +423,7 @@ void raw_hid_receive( uint8_t *data, uint8_t length )
// Return the same buffer, optionally with values changed
// (i.e. returning state to the host, or the unhandled state).
- raw_hid_send( data, length );
+ raw_hid_send(data, length);
}
#if defined(VIA_QMK_BACKLIGHT_ENABLE)
diff --git a/quantum/via.h b/quantum/via.h
index aaa01705e3..012547e055 100644
--- a/quantum/via.h
+++ b/quantum/via.h
@@ -16,7 +16,7 @@
#pragma once
-#include <tmk_core/common/eeconfig.h> // for EECONFIG_SIZE
+#include <tmk_core/common/eeconfig.h> // for EECONFIG_SIZE
// Keyboard level code can change where VIA stores the magic.
// The magic is the build date YYMMDD encoded as BCD in 3 bytes,
@@ -25,25 +25,25 @@
// The only reason this is important is in case EEPROM usage changes
// and the EEPROM was not explicitly reset by bootmagic lite.
#ifndef VIA_EEPROM_MAGIC_ADDR
-# define VIA_EEPROM_MAGIC_ADDR (EECONFIG_SIZE)
+# define VIA_EEPROM_MAGIC_ADDR (EECONFIG_SIZE)
#endif
-#define VIA_EEPROM_LAYOUT_OPTIONS_ADDR (VIA_EEPROM_MAGIC_ADDR+3)
+#define VIA_EEPROM_LAYOUT_OPTIONS_ADDR (VIA_EEPROM_MAGIC_ADDR + 3)
// Changing the layout options size after release will invalidate EEPROM,
// but this is something that should be set correctly on initial implementation.
// 1 byte is enough for most uses (i.e. 8 binary states, or 6 binary + 1 ternary/quaternary )
#ifndef VIA_EEPROM_LAYOUT_OPTIONS_SIZE
-# define VIA_EEPROM_LAYOUT_OPTIONS_SIZE 1
+# define VIA_EEPROM_LAYOUT_OPTIONS_SIZE 1
#endif
// The end of the EEPROM memory used by VIA
// By default, dynamic keymaps will start at this if there is no
// custom config
-#define VIA_EEPROM_CUSTOM_CONFIG_ADDR (VIA_EEPROM_LAYOUT_OPTIONS_ADDR+VIA_EEPROM_LAYOUT_OPTIONS_SIZE)
+#define VIA_EEPROM_CUSTOM_CONFIG_ADDR (VIA_EEPROM_LAYOUT_OPTIONS_ADDR + VIA_EEPROM_LAYOUT_OPTIONS_SIZE)
#ifndef VIA_EEPROM_CUSTOM_CONFIG_SIZE
-# define VIA_EEPROM_CUSTOM_CONFIG_SIZE 0
+# define VIA_EEPROM_CUSTOM_CONFIG_SIZE 0
#endif
// This is changed only when the command IDs change,
@@ -118,22 +118,22 @@ enum via_keycodes {
};
enum user_keycodes {
- USER00 = 0x5F80,
- USER01,
- USER02,
- USER03,
- USER04,
- USER05,
- USER06,
- USER07,
- USER08,
- USER09,
- USER10,
- USER11,
- USER12,
- USER13,
- USER14,
- USER15,
+ USER00 = 0x5F80,
+ USER01,
+ USER02,
+ USER03,
+ USER04,
+ USER05,
+ USER06,
+ USER07,
+ USER08,
+ USER09,
+ USER10,
+ USER11,
+ USER12,
+ USER13,
+ USER14,
+ USER15,
};
// Can be called in an overriding via_init_kb() to test if keyboard level code usage of
@@ -154,7 +154,7 @@ void via_init(void);
// Used by VIA to store and retrieve the layout options.
uint32_t via_get_layout_options(void);
-void via_set_layout_options(uint32_t value);
+void via_set_layout_options(uint32_t value);
// Called by QMK core to process VIA-specific keycodes.
bool process_record_via(uint16_t keycode, keyrecord_t *record);