From a5ecf146085716f3a79424c2f4b3b3039ff36b3e Mon Sep 17 00:00:00 2001 From: fauxpark Date: Tue, 16 Jul 2019 16:15:07 +1000 Subject: Sendstring LUT improvements (#5727) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Align sendstring LUTs to 9 characters wide * Replace 0 with XXXXXXX * Use decimal 128 for LUT size * Align heading comments * Add ASCII table comments * Add missing AltGr LUTs and adjust keycode LUTs accordingly * Use pragma once * Correct a couple more keycodes * Capitalise "BÉPO" * Also clean up the default tables * Tidy up Belgian and Norman LUTs --- quantum/quantum.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'quantum/quantum.h') diff --git a/quantum/quantum.h b/quantum/quantum.h index f089c6ef6..56f30624c 100644 --- a/quantum/quantum.h +++ b/quantum/quantum.h @@ -201,9 +201,9 @@ extern layer_state_t default_layer_state; #define SEND_STRING(string) send_string_P(PSTR(string)) -extern const bool ascii_to_shift_lut[0x80]; -extern const bool ascii_to_altgr_lut[0x80]; -extern const uint8_t ascii_to_keycode_lut[0x80]; +extern const bool ascii_to_shift_lut[128]; +extern const bool ascii_to_altgr_lut[128]; +extern const uint8_t ascii_to_keycode_lut[128]; void send_string(const char *str); void send_string_with_delay(const char *str, uint8_t interval); -- cgit v1.2.3 From b62e160a8950f451b08f1fee0109e60a58c5ddaa Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Wed, 21 Aug 2019 17:07:49 -0700 Subject: Additional changes for Layer State typedef compatibility (#5906) * Additional changes for Layer State typedef compatibility * Replace biton32 with get_highest_layer in docs * Change additional layer structure code * Fix uGFX reference issue * Remove dynamic_keymap check * Where did all these extra spaces come from Co-Authored-By: fauxpark --- quantum/quantum.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'quantum/quantum.h') diff --git a/quantum/quantum.h b/quantum/quantum.h index 56f30624c..221462567 100644 --- a/quantum/quantum.h +++ b/quantum/quantum.h @@ -213,7 +213,7 @@ void send_char(char ascii_code); // For tri-layer void update_tri_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3); -uint32_t update_tri_layer_state(uint32_t state, uint8_t layer1, uint8_t layer2, uint8_t layer3); +layer_state_t update_tri_layer_state(layer_state_t state, uint8_t layer1, uint8_t layer2, uint8_t layer3); void set_single_persistent_default_layer(uint8_t default_layer); -- cgit v1.2.3 From 1c5b0cbbeb049b1ce3fb2da6a81fbf83dd9a3ea7 Mon Sep 17 00:00:00 2001 From: Takeshi ISHII <2170248+mtei@users.noreply.github.com> Date: Thu, 22 Aug 2019 09:10:47 +0900 Subject: AVR GPIO macro defines more readable (#5937) * A little easier to read the definition of the GPIO control macro for AVR. No change in build result. * Changed to not use GNU statement expression extension. No change in build result. * Modified split_common/serial.c to use qmk_firmware standard GPIO control macro. No change in build result. * fix PE6 -> E6 * remove some space * add some comment to config_common.h * Changed split_common/serial.c to use a newer version of qmk_firmware standard GPIO control macro. --- quantum/quantum.h | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'quantum/quantum.h') diff --git a/quantum/quantum.h b/quantum/quantum.h index 221462567..2cb26d4f4 100644 --- a/quantum/quantum.h +++ b/quantum/quantum.h @@ -149,18 +149,17 @@ extern layer_state_t default_layer_state; #if defined(__AVR__) typedef uint8_t pin_t; - #define PIN_ADDRESS(p, offset) (_SFR_IO8(ADDRESS_BASE + ((p) >> PORT_SHIFTER) + (offset))) - #define setPinInput(pin) (PIN_ADDRESS(pin, 1) &= ~_BV((pin) & 0xF)) - #define setPinInputHigh(pin) (PIN_ADDRESS(pin, 1) &= ~_BV((pin) & 0xF), \ - PIN_ADDRESS(pin, 2) |= _BV((pin) & 0xF)) + #define setPinInput(pin) (DDRx_ADDRESS(pin) &= ~_BV((pin) & 0xF)) + #define setPinInputHigh(pin) (DDRx_ADDRESS(pin) &= ~_BV((pin) & 0xF), \ + PORTx_ADDRESS(pin) |= _BV((pin) & 0xF)) #define setPinInputLow(pin) _Static_assert(0, "AVR processors cannot implement an input as pull low") - #define setPinOutput(pin) (PIN_ADDRESS(pin, 1) |= _BV((pin) & 0xF)) + #define setPinOutput(pin) (DDRx_ADDRESS(pin) |= _BV((pin) & 0xF)) - #define writePinHigh(pin) (PIN_ADDRESS(pin, 2) |= _BV((pin) & 0xF)) - #define writePinLow(pin) (PIN_ADDRESS(pin, 2) &= ~_BV((pin) & 0xF)) + #define writePinHigh(pin) (PORTx_ADDRESS(pin) |= _BV((pin) & 0xF)) + #define writePinLow(pin) (PORTx_ADDRESS(pin) &= ~_BV((pin) & 0xF)) #define writePin(pin, level) ((level) ? writePinHigh(pin) : writePinLow(pin)) - #define readPin(pin) ((bool)(PIN_ADDRESS(pin, 0) & _BV((pin) & 0xF))) + #define readPin(pin) ((bool)(PINx_ADDRESS(pin) & _BV((pin) & 0xF))) #elif defined(PROTOCOL_CHIBIOS) typedef ioline_t pin_t; -- cgit v1.2.3 From b624f32f944acdc59dcb130674c09090c5c404cb Mon Sep 17 00:00:00 2001 From: skullY Date: Fri, 30 Aug 2019 11:19:03 -0700 Subject: clang-format changes --- quantum/quantum.h | 153 +++++++++++++++++++++++++++--------------------------- 1 file changed, 76 insertions(+), 77 deletions(-) (limited to 'quantum/quantum.h') diff --git a/quantum/quantum.h b/quantum/quantum.h index 2cb26d4f4..066113590 100644 --- a/quantum/quantum.h +++ b/quantum/quantum.h @@ -16,12 +16,12 @@ #pragma once #if defined(__AVR__) - #include - #include - #include +# include +# include +# include #endif #if defined(PROTOCOL_CHIBIOS) - #include "hal.h" +# include "hal.h" #endif #include "wait.h" @@ -29,23 +29,23 @@ #include "keymap.h" #ifdef BACKLIGHT_ENABLE - #ifdef LED_MATRIX_ENABLE - #include "ledmatrix.h" - #else - #include "backlight.h" - #endif +# ifdef LED_MATRIX_ENABLE +# include "ledmatrix.h" +# else +# include "backlight.h" +# endif #endif #if defined(RGBLIGHT_ENABLE) - #include "rgblight.h" +# include "rgblight.h" #elif defined(RGB_MATRIX_ENABLE) - // Dummy define RGBLIGHT_MODE_xxxx - #define RGBLIGHT_H_DUMMY_DEFINE - #include "rgblight.h" +// Dummy define RGBLIGHT_MODE_xxxx +# define RGBLIGHT_H_DUMMY_DEFINE +# include "rgblight.h" #endif #ifdef RGB_MATRIX_ENABLE - #include "rgb_matrix.h" +# include "rgb_matrix.h" #endif #include "action_layer.h" @@ -64,120 +64,119 @@ extern layer_state_t default_layer_state; #ifndef NO_ACTION_LAYER - extern layer_state_t layer_state; +extern layer_state_t layer_state; #endif #if defined(MIDI_ENABLE) && defined(MIDI_ADVANCED) - #include "process_midi.h" +# include "process_midi.h" #endif #ifdef AUDIO_ENABLE - #include "audio.h" - #include "process_audio.h" - #ifdef AUDIO_CLICKY - #include "process_clicky.h" - #endif +# include "audio.h" +# include "process_audio.h" +# ifdef AUDIO_CLICKY +# include "process_clicky.h" +# endif #endif #ifdef STENO_ENABLE - #include "process_steno.h" +# include "process_steno.h" #endif #if defined(AUDIO_ENABLE) || (defined(MIDI_ENABLE) && defined(MIDI_BASIC)) - #include "process_music.h" +# include "process_music.h" #endif #ifdef LEADER_ENABLE - #include "process_leader.h" +# include "process_leader.h" #endif #ifdef UNICODE_ENABLE - #include "process_unicode.h" +# include "process_unicode.h" #endif #ifdef UCIS_ENABLE - #include "process_ucis.h" +# include "process_ucis.h" #endif #ifdef UNICODEMAP_ENABLE - #include "process_unicodemap.h" +# include "process_unicodemap.h" #endif #ifdef TAP_DANCE_ENABLE - #include "process_tap_dance.h" +# include "process_tap_dance.h" #endif #ifdef PRINTING_ENABLE - #include "process_printer.h" +# include "process_printer.h" #endif #ifdef AUTO_SHIFT_ENABLE - #include "process_auto_shift.h" +# include "process_auto_shift.h" #endif #ifdef COMBO_ENABLE - #include "process_combo.h" +# include "process_combo.h" #endif #ifdef KEY_LOCK_ENABLE - #include "process_key_lock.h" +# include "process_key_lock.h" #endif #ifdef TERMINAL_ENABLE - #include "process_terminal.h" +# include "process_terminal.h" #else - #include "process_terminal_nop.h" +# include "process_terminal_nop.h" #endif #ifdef SPACE_CADET_ENABLE - #include "process_space_cadet.h" +# include "process_space_cadet.h" #endif #ifdef HD44780_ENABLE - #include "hd44780.h" +# include "hd44780.h" #endif #ifdef HAPTIC_ENABLE - #include "haptic.h" +# include "haptic.h" #endif #ifdef OLED_DRIVER_ENABLE - #include "oled_driver.h" +# include "oled_driver.h" #endif // Function substitutions to ease GPIO manipulation #if defined(__AVR__) - typedef uint8_t pin_t; +typedef uint8_t pin_t; - #define setPinInput(pin) (DDRx_ADDRESS(pin) &= ~_BV((pin) & 0xF)) - #define setPinInputHigh(pin) (DDRx_ADDRESS(pin) &= ~_BV((pin) & 0xF), \ - PORTx_ADDRESS(pin) |= _BV((pin) & 0xF)) - #define setPinInputLow(pin) _Static_assert(0, "AVR processors cannot implement an input as pull low") - #define setPinOutput(pin) (DDRx_ADDRESS(pin) |= _BV((pin) & 0xF)) +# define setPinInput(pin) (DDRx_ADDRESS(pin) &= ~_BV((pin)&0xF)) +# define setPinInputHigh(pin) (DDRx_ADDRESS(pin) &= ~_BV((pin)&0xF), PORTx_ADDRESS(pin) |= _BV((pin)&0xF)) +# define setPinInputLow(pin) _Static_assert(0, "AVR processors cannot implement an input as pull low") +# define setPinOutput(pin) (DDRx_ADDRESS(pin) |= _BV((pin)&0xF)) - #define writePinHigh(pin) (PORTx_ADDRESS(pin) |= _BV((pin) & 0xF)) - #define writePinLow(pin) (PORTx_ADDRESS(pin) &= ~_BV((pin) & 0xF)) - #define writePin(pin, level) ((level) ? writePinHigh(pin) : writePinLow(pin)) +# define writePinHigh(pin) (PORTx_ADDRESS(pin) |= _BV((pin)&0xF)) +# define writePinLow(pin) (PORTx_ADDRESS(pin) &= ~_BV((pin)&0xF)) +# define writePin(pin, level) ((level) ? writePinHigh(pin) : writePinLow(pin)) - #define readPin(pin) ((bool)(PINx_ADDRESS(pin) & _BV((pin) & 0xF))) +# define readPin(pin) ((bool)(PINx_ADDRESS(pin) & _BV((pin)&0xF))) #elif defined(PROTOCOL_CHIBIOS) - typedef ioline_t pin_t; +typedef ioline_t pin_t; - #define setPinInput(pin) palSetLineMode(pin, PAL_MODE_INPUT) - #define setPinInputHigh(pin) palSetLineMode(pin, PAL_MODE_INPUT_PULLUP) - #define setPinInputLow(pin) palSetLineMode(pin, PAL_MODE_INPUT_PULLDOWN) - #define setPinOutput(pin) palSetLineMode(pin, PAL_MODE_OUTPUT_PUSHPULL) +# define setPinInput(pin) palSetLineMode(pin, PAL_MODE_INPUT) +# define setPinInputHigh(pin) palSetLineMode(pin, PAL_MODE_INPUT_PULLUP) +# define setPinInputLow(pin) palSetLineMode(pin, PAL_MODE_INPUT_PULLDOWN) +# define setPinOutput(pin) palSetLineMode(pin, PAL_MODE_OUTPUT_PUSHPULL) - #define writePinHigh(pin) palSetLine(pin) - #define writePinLow(pin) palClearLine(pin) - #define writePin(pin, level) ((level) ? writePinHigh(pin) : writePinLow(pin)) +# define writePinHigh(pin) palSetLine(pin) +# define writePinLow(pin) palClearLine(pin) +# define writePin(pin, level) ((level) ? writePinHigh(pin) : writePinLow(pin)) - #define readPin(pin) palReadLine(pin) +# define readPin(pin) palReadLine(pin) #endif // Send string macros #define STRINGIZE(z) #z -#define ADD_SLASH_X(y) STRINGIZE(\x ## y) +#define ADD_SLASH_X(y) STRINGIZE(\x##y) #define SYMBOL_STR(x) ADD_SLASH_X(x) #define SS_TAP_CODE 1 @@ -200,8 +199,8 @@ extern layer_state_t default_layer_state; #define SEND_STRING(string) send_string_P(PSTR(string)) -extern const bool ascii_to_shift_lut[128]; -extern const bool ascii_to_altgr_lut[128]; +extern const bool ascii_to_shift_lut[128]; +extern const bool ascii_to_altgr_lut[128]; extern const uint8_t ascii_to_keycode_lut[128]; void send_string(const char *str); @@ -211,31 +210,31 @@ void send_string_with_delay_P(const char *str, uint8_t interval); void send_char(char ascii_code); // For tri-layer -void update_tri_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3); +void update_tri_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3); layer_state_t update_tri_layer_state(layer_state_t state, uint8_t layer1, uint8_t layer2, uint8_t layer3); void set_single_persistent_default_layer(uint8_t default_layer); void tap_random_base64(void); -#define IS_LAYER_ON(layer) (layer_state & (1UL << (layer))) +#define IS_LAYER_ON(layer) (layer_state & (1UL << (layer))) #define IS_LAYER_OFF(layer) (~layer_state & (1UL << (layer))) -void matrix_init_kb(void); -void matrix_scan_kb(void); -void matrix_init_user(void); -void matrix_scan_user(void); +void matrix_init_kb(void); +void matrix_scan_kb(void); +void matrix_init_user(void); +void matrix_scan_user(void); uint16_t get_record_keycode(keyrecord_t *record); uint16_t get_event_keycode(keyevent_t event); -bool process_action_kb(keyrecord_t *record); -bool process_record_kb(uint16_t keycode, keyrecord_t *record); -bool process_record_user(uint16_t keycode, keyrecord_t *record); +bool process_action_kb(keyrecord_t *record); +bool process_record_kb(uint16_t keycode, keyrecord_t *record); +bool process_record_user(uint16_t keycode, keyrecord_t *record); #ifndef BOOTMAGIC_LITE_COLUMN - #define BOOTMAGIC_LITE_COLUMN 0 +# define BOOTMAGIC_LITE_COLUMN 0 #endif #ifndef BOOTMAGIC_LITE_ROW - #define BOOTMAGIC_LITE_ROW 0 +# define BOOTMAGIC_LITE_ROW 0 #endif void bootmagic_lite(void); @@ -256,7 +255,7 @@ void backlight_task_internal(void); void backlight_on(uint8_t backlight_pin); void backlight_off(uint8_t backlight_pin); - #ifdef BACKLIGHT_BREATHING +# ifdef BACKLIGHT_BREATHING void breathing_task(void); void breathing_enable(void); void breathing_pulse(void); @@ -270,13 +269,13 @@ void breathing_period_default(void); void breathing_period_set(uint8_t value); void breathing_period_inc(void); void breathing_period_dec(void); - #endif +# endif #endif -void send_dword(uint32_t number); -void send_word(uint16_t number); -void send_byte(uint8_t number); -void send_nibble(uint8_t number); +void send_dword(uint32_t number); +void send_word(uint16_t number); +void send_byte(uint8_t number); +void send_nibble(uint8_t number); uint16_t hex_to_keycode(uint8_t hex); void led_set_user(uint8_t usb_led); -- cgit v1.2.3 From dab4967f1bebc9a70374ed3e1fe7906828b280c2 Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Tue, 3 Sep 2019 08:34:31 -0700 Subject: Add Dip Switch as a core feature (#6140) * Add Dip Switches as a core feature * Add documentation for Dip Switch feature * Update Preonic Rev3 to use new feature and remove custom matrix * Apply suggestions from code review Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Remove custom matrix line completely Rather than just disabling it Co-Authored-By: fauxpark * DIP changes Co-Authored-By: fauxpark * Use better check for DIP Switch configuration * Add to show features * Add bitmask callback for dip switch * Fix OLKB Boards dip switch config * Update docs to include bitmask example * Fix comments/documentation Co-Authored-By: fauxpark * Fix issues with docs and use example from @tuzonghua * Fix wording Co-Authored-By: fauxpark * Fix example to use proper formatting Bad, BAAAAAAD drashna!!! * Handle dip switch initialization better --- quantum/quantum.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'quantum/quantum.h') diff --git a/quantum/quantum.h b/quantum/quantum.h index 066113590..f5ac97379 100644 --- a/quantum/quantum.h +++ b/quantum/quantum.h @@ -145,6 +145,11 @@ extern layer_state_t layer_state; # include "oled_driver.h" #endif +#ifdef DIP_SWITCH_ENABLE + #include "dip_switch.h" +#endif + + // Function substitutions to ease GPIO manipulation #if defined(__AVR__) typedef uint8_t pin_t; -- cgit v1.2.3 From 4531cc874e1bb8602fede9dc038b692673521590 Mon Sep 17 00:00:00 2001 From: Joel Challis Date: Sat, 2 Nov 2019 21:20:03 +0000 Subject: Initial migration of software PWM backlight (#6709) * Initial migration of software PWM backlight * First pass at backlight driver docs * Correct driver name in docs * Run backlight_task when using BACKLIGHT_PINS * Resolve backlight docs TODOs --- quantum/quantum.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'quantum/quantum.h') diff --git a/quantum/quantum.h b/quantum/quantum.h index f5ac97379..01abe1c0a 100644 --- a/quantum/quantum.h +++ b/quantum/quantum.h @@ -257,8 +257,8 @@ void tap_code16(uint16_t code); void backlight_init_ports(void); void backlight_task(void); void backlight_task_internal(void); -void backlight_on(uint8_t backlight_pin); -void backlight_off(uint8_t backlight_pin); +void backlight_on(pin_t backlight_pin); +void backlight_off(pin_t backlight_pin); # ifdef BACKLIGHT_BREATHING void breathing_task(void); -- cgit v1.2.3 From 542cb0a8ce3f324c6bd46751d733daf86384a8f6 Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Mon, 4 Nov 2019 22:59:13 -0800 Subject: [Core] Convert Dynamic Macro to a Core Feature (#5948) * Convert Dynamic Macro to a Core Feature This imports the code from Dynamic Macro into the core code, and handles it, as such. This deprecates the old method but does not remove it, for legacy support. This way, no existing user files need to be touched. Additionally, this reorganizes the documentation to better reflect the changes. Also, it adds user hooks to the feature so users can customize the existing functionality. Based heavily on and closes #2976 * Apply suggestions from code review Co-Authored-By: fauxpark Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Cleanup based on feedback * Add short-form keycodes and document them - add short-form keycodes to quantum/quantum_keycodes.h - document the new aliases in docs/feature_dynamic_macros.md * Add Dynamic Macros section and keycodes to docs/keycodes.md * Make anti-nesting optional * Add documentation for DYNAMIC_MACRO_NO_NESTING option * Fix Merge artifacts * Fix formatting typo in docs Co-Authored-By: James Young <18669334+noroadsleft@users.noreply.github.com> * Remove DYNAMIC_MACRO_RANGE as it's not needed * Fix includes and layer var type --- quantum/quantum.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'quantum/quantum.h') diff --git a/quantum/quantum.h b/quantum/quantum.h index 01abe1c0a..87343a15d 100644 --- a/quantum/quantum.h +++ b/quantum/quantum.h @@ -149,6 +149,10 @@ extern layer_state_t layer_state; #include "dip_switch.h" #endif +#ifdef DYNAMIC_MACRO_ENABLE + #include "process_dynamic_macro.h" +#endif + // Function substitutions to ease GPIO manipulation #if defined(__AVR__) -- cgit v1.2.3 From dfb78d2a086daa2ceb3fd043afce03785abfa23a Mon Sep 17 00:00:00 2001 From: fauxpark Date: Wed, 6 Nov 2019 11:42:16 +1100 Subject: New and improved lock LED callbacks (#7215) * New and improved lock LED callbacks * Include stdbool * Update documentation * Use full function signatures and add keyboard-level example --- quantum/quantum.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'quantum/quantum.h') diff --git a/quantum/quantum.h b/quantum/quantum.h index 87343a15d..7988c5878 100644 --- a/quantum/quantum.h +++ b/quantum/quantum.h @@ -289,5 +289,7 @@ uint16_t hex_to_keycode(uint8_t hex); void led_set_user(uint8_t usb_led); void led_set_kb(uint8_t usb_led); +bool led_update_user(led_t led_state); +bool led_update_kb(led_t led_state); void api_send_unicode(uint32_t unicode); -- cgit v1.2.3 From a91c0c476507cb8c12840abb59bff34ab0de3c03 Mon Sep 17 00:00:00 2001 From: zvecr Date: Sun, 17 Nov 2019 14:02:26 +0000 Subject: Run clang-format manually to fix recently changed files --- quantum/quantum.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'quantum/quantum.h') diff --git a/quantum/quantum.h b/quantum/quantum.h index 7988c5878..6beab65a3 100644 --- a/quantum/quantum.h +++ b/quantum/quantum.h @@ -146,14 +146,13 @@ extern layer_state_t layer_state; #endif #ifdef DIP_SWITCH_ENABLE - #include "dip_switch.h" +# include "dip_switch.h" #endif #ifdef DYNAMIC_MACRO_ENABLE - #include "process_dynamic_macro.h" +# include "process_dynamic_macro.h" #endif - // Function substitutions to ease GPIO manipulation #if defined(__AVR__) typedef uint8_t pin_t; -- cgit v1.2.3