Run clang-format manually to fix recently changed files (#7934)
* Run clang-format manually to fix recently changed files * Run clang-format manually to fix recently changed files - revert template files * Run clang-format manually to fix recently changed files - format off for ascii_to_keycode_lut
This commit is contained in:
@@ -217,7 +217,7 @@ void IS31FL3733_update_pwm_buffers(uint8_t addr, uint8_t index) {
|
||||
|
||||
// If any of the transactions fail we risk writing dirty PG0,
|
||||
// refresh page 0 just in case.
|
||||
if (!IS31FL3733_write_pwm_buffer(addr, g_pwm_buffer[index])){
|
||||
if (!IS31FL3733_write_pwm_buffer(addr, g_pwm_buffer[index])) {
|
||||
g_led_control_registers_update_required[index] = true;
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -87,9 +87,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
|
||||
|
||||
+10
-10
@@ -20,36 +20,36 @@
|
||||
#include "progmem.h" // to read default from flash
|
||||
#include "quantum.h" // for send_string()
|
||||
#include "dynamic_keymap.h"
|
||||
#include "via.h" // for default VIA_EEPROM_ADDR_END
|
||||
#include "via.h" // for default VIA_EEPROM_ADDR_END
|
||||
|
||||
#ifndef DYNAMIC_KEYMAP_LAYER_COUNT
|
||||
# define DYNAMIC_KEYMAP_LAYER_COUNT 4
|
||||
# define DYNAMIC_KEYMAP_LAYER_COUNT 4
|
||||
#endif
|
||||
|
||||
#ifndef DYNAMIC_KEYMAP_MACRO_COUNT
|
||||
# define DYNAMIC_KEYMAP_MACRO_COUNT 16
|
||||
# define DYNAMIC_KEYMAP_MACRO_COUNT 16
|
||||
#endif
|
||||
|
||||
// If DYNAMIC_KEYMAP_EEPROM_ADDR not explicitly defined in config.h,
|
||||
// default it start after VIA_EEPROM_CUSTOM_ADDR+VIA_EEPROM_CUSTOM_SIZE
|
||||
#ifndef DYNAMIC_KEYMAP_EEPROM_ADDR
|
||||
# ifdef VIA_EEPROM_CUSTOM_CONFIG_ADDR
|
||||
# define DYNAMIC_KEYMAP_EEPROM_ADDR (VIA_EEPROM_CUSTOM_CONFIG_ADDR+VIA_EEPROM_CUSTOM_CONFIG_SIZE)
|
||||
# else
|
||||
# error DYNAMIC_KEYMAP_EEPROM_ADDR not defined
|
||||
# endif
|
||||
# ifdef VIA_EEPROM_CUSTOM_CONFIG_ADDR
|
||||
# define DYNAMIC_KEYMAP_EEPROM_ADDR (VIA_EEPROM_CUSTOM_CONFIG_ADDR + VIA_EEPROM_CUSTOM_CONFIG_SIZE)
|
||||
# else
|
||||
# error DYNAMIC_KEYMAP_EEPROM_ADDR not defined
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// Dynamic macro starts after dynamic keymaps
|
||||
#ifndef DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR
|
||||
# define DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR (DYNAMIC_KEYMAP_EEPROM_ADDR+(DYNAMIC_KEYMAP_LAYER_COUNT*MATRIX_ROWS*MATRIX_COLS*2))
|
||||
# define DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR (DYNAMIC_KEYMAP_EEPROM_ADDR + (DYNAMIC_KEYMAP_LAYER_COUNT * MATRIX_ROWS * MATRIX_COLS * 2))
|
||||
#endif
|
||||
|
||||
// Dynamic macro uses up all remaining memory
|
||||
// Assumes 1K EEPROM on ATMega32U4
|
||||
// Override for anything different
|
||||
#ifndef DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE
|
||||
# define DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE (1024-DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR)
|
||||
# define DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE (1024 - DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR)
|
||||
#endif
|
||||
|
||||
uint8_t dynamic_keymap_get_layer_count(void) { return DYNAMIC_KEYMAP_LAYER_COUNT; }
|
||||
|
||||
+4
-4
@@ -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]++;
|
||||
|
||||
@@ -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 {
|
||||
|
||||
+5
-3
@@ -320,8 +320,8 @@ bool process_record_quantum(keyrecord_t *record) {
|
||||
switch (keycode) {
|
||||
case GRAVE_ESC: {
|
||||
/* true if the last press of GRAVE_ESC was shifted (i.e. GUI or SHIFT were pressed), false otherwise.
|
||||
* Used to ensure that the correct keycode is released if the key is released.
|
||||
*/
|
||||
* Used to ensure that the correct keycode is released if the key is released.
|
||||
*/
|
||||
static bool grave_esc_was_shifted = false;
|
||||
|
||||
uint8_t shifted = get_mods() & ((MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT) | MOD_BIT(KC_LGUI) | MOD_BIT(KC_RGUI)));
|
||||
@@ -379,6 +379,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
|
||||
@@ -412,6 +413,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); }
|
||||
|
||||
@@ -477,7 +479,7 @@ void send_string_with_delay_P(const char *str, uint8_t interval) {
|
||||
|
||||
void send_char(char ascii_code) {
|
||||
#if defined(AUDIO_ENABLE) && defined(SENDSTRING_BELL)
|
||||
if (ascii_code == '\a') { // BEL
|
||||
if (ascii_code == '\a') { // BEL
|
||||
PLAY_SONG(bell_song);
|
||||
return;
|
||||
}
|
||||
|
||||
+2
-2
@@ -163,11 +163,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
|
||||
|
||||
@@ -677,7 +677,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
|
||||
@@ -685,8 +685,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
|
||||
|
||||
@@ -434,11 +434,11 @@ void rgb_matrix_init(void) {
|
||||
eeconfig_debug_rgb_matrix(); // display current eeprom values
|
||||
}
|
||||
|
||||
void rgb_matrix_set_suspend_state(bool state) {
|
||||
if (RGB_DISABLE_WHEN_USB_SUSPENDED && state) {
|
||||
rgb_matrix_set_color_all(0, 0, 0); // turn off all LEDs when suspending
|
||||
void rgb_matrix_set_suspend_state(bool 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;
|
||||
g_suspend_state = state;
|
||||
}
|
||||
|
||||
void rgb_matrix_toggle(void) {
|
||||
|
||||
+3
-3
@@ -622,12 +622,12 @@ void rgblight_set(void) {
|
||||
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
|
||||
ws2812_setleds(start_led, num_leds);
|
||||
# endif
|
||||
ws2812_setleds(start_led, num_leds);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
+102
-145
File diff suppressed because it is too large
Load Diff
+27
-34
@@ -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,34 +25,33 @@
|
||||
// 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,
|
||||
// so VIA Configurator can detect compatible firmware.
|
||||
// so VIA Configurator can detect compatible firmware.
|
||||
#define VIA_PROTOCOL_VERSION 0x0009
|
||||
|
||||
enum via_command_id
|
||||
{
|
||||
id_get_protocol_version = 0x01, // always 0x01
|
||||
enum via_command_id {
|
||||
id_get_protocol_version = 0x01, // always 0x01
|
||||
id_get_keyboard_value,
|
||||
id_set_keyboard_value,
|
||||
id_dynamic_keymap_get_keycode,
|
||||
@@ -74,12 +73,7 @@ enum via_command_id
|
||||
id_unhandled = 0xFF,
|
||||
};
|
||||
|
||||
enum via_keyboard_value_id
|
||||
{
|
||||
id_uptime = 0x01,
|
||||
id_layout_options,
|
||||
id_switch_matrix_state
|
||||
};
|
||||
enum via_keyboard_value_id { id_uptime = 0x01, id_layout_options, id_switch_matrix_state };
|
||||
|
||||
// Can't use SAFE_RANGE here, it might change if someone adds
|
||||
// new values to enum quantum_keycodes.
|
||||
@@ -108,22 +102,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
|
||||
@@ -144,8 +138,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);
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ int retro_tapping_counter = 0;
|
||||
#endif
|
||||
|
||||
#ifdef IGNORE_MOD_TAP_INTERRUPT_PER_KEY
|
||||
__attribute__ ((weak)) bool get_ignore_mod_tap_interrupt(uint16_t keycode) { return false; }
|
||||
__attribute__((weak)) bool get_ignore_mod_tap_interrupt(uint16_t keycode) { return false; }
|
||||
#endif
|
||||
|
||||
#ifndef TAP_CODE_DELAY
|
||||
|
||||
Reference in New Issue
Block a user