From e7b95fba58949de7880036132c4cf4ee71821d33 Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Mon, 26 Aug 2019 13:49:51 -0700 Subject: Fix Indicator LEDs brightness --- keyboards/ergodox_ez/ergodox_ez.c | 1 - 1 file changed, 1 deletion(-) diff --git a/keyboards/ergodox_ez/ergodox_ez.c b/keyboards/ergodox_ez/ergodox_ez.c index a67707895d..4db274a804 100644 --- a/keyboards/ergodox_ez/ergodox_ez.c +++ b/keyboards/ergodox_ez/ergodox_ez.c @@ -62,7 +62,6 @@ void matrix_init_kb(void) { void ergodox_blink_all_leds(void) { ergodox_led_all_off(); - ergodox_led_all_set(LED_BRIGHTNESS_DEFAULT); ergodox_right_led_1_on(); _delay_ms(50); ergodox_right_led_2_on(); -- cgit v1.2.3 From 3489ebb1c16268c81339611482275f99ad93ad4b Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Mon, 26 Aug 2019 13:57:18 -0700 Subject: use full brightness instead --- keyboards/ergodox_ez/ergodox_ez.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/keyboards/ergodox_ez/ergodox_ez.c b/keyboards/ergodox_ez/ergodox_ez.c index 4db274a804..b6def95789 100644 --- a/keyboards/ergodox_ez/ergodox_ez.c +++ b/keyboards/ergodox_ez/ergodox_ez.c @@ -110,6 +110,8 @@ void ergodox_blink_all_leds(void) //ergodox_led_all_on(); //_delay_ms(333); + ergodox_led_all_set((uint8_t)keyboard_config.led_level * 255 / 4 ); + ergodox_led_all_off(); } -- cgit v1.2.3 From fd63ea595f17face0dcf5ce935e58cea1c724ff6 Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Mon, 26 Aug 2019 13:58:05 -0700 Subject: Restore brightness --- keyboards/ergodox_ez/ergodox_ez.c | 1 + 1 file changed, 1 insertion(+) diff --git a/keyboards/ergodox_ez/ergodox_ez.c b/keyboards/ergodox_ez/ergodox_ez.c index b6def95789..3fd4e30833 100644 --- a/keyboards/ergodox_ez/ergodox_ez.c +++ b/keyboards/ergodox_ez/ergodox_ez.c @@ -62,6 +62,7 @@ void matrix_init_kb(void) { void ergodox_blink_all_leds(void) { ergodox_led_all_off(); + ergodox_led_all_set(LED_BRIGHTNESS_DEFAULT); ergodox_right_led_1_on(); _delay_ms(50); ergodox_right_led_2_on(); -- cgit v1.2.3 From ba5c46267c807686d240c604f8c42b70f5168d70 Mon Sep 17 00:00:00 2001 From: Joel Challis Date: Thu, 15 Aug 2019 22:03:26 +0100 Subject: Add an alternative method for keyboard discovery to speed up build (#6073) * Add an alternative method for keyboard discovery to speed up build * Chain MAKEFLAGS for docker_build.sh * Slight improvement to number of items sent to sort * Remove debug line * Fix line escape --- Makefile | 9 ++++++++- util/docker_build.sh | 8 +++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index a6c3ee35b7..6512f7217e 100644 --- a/Makefile +++ b/Makefile @@ -20,7 +20,10 @@ endif override SILENT := false ifndef SUB_IS_SILENT -QMK_VERSION := $(shell git describe --abbrev=0 --tags 2>/dev/null) +ifndef SKIP_GIT + QMK_VERSION := $(shell git describe --abbrev=0 --tags 2>/dev/null) +endif + ifneq ($(QMK_VERSION),) $(info QMK Firmware $(QMK_VERSION)) endif @@ -94,6 +97,7 @@ $(eval $(call NEXT_PATH_ELEMENT)) # endif define GET_KEYBOARDS +ifndef ALT_GET_KEYBOARDS All_RULES_MK := $$(patsubst $(ROOT_DIR)/keyboards/%/rules.mk,%,$$(wildcard $(ROOT_DIR)/keyboards/*/rules.mk)) All_RULES_MK += $$(patsubst $(ROOT_DIR)/keyboards/%/rules.mk,%,$$(wildcard $(ROOT_DIR)/keyboards/*/*/rules.mk)) All_RULES_MK += $$(patsubst $(ROOT_DIR)/keyboards/%/rules.mk,%,$$(wildcard $(ROOT_DIR)/keyboards/*/*/*/rules.mk)) @@ -105,6 +109,9 @@ define GET_KEYBOARDS KEYMAPS_MK += $$(patsubst $(ROOT_DIR)/keyboards/%/rules.mk,%,$$(wildcard $(ROOT_DIR)/keyboards/*/*/*/*/keymaps/*/rules.mk)) KEYBOARDS := $$(sort $$(filter-out $$(KEYMAPS_MK), $$(All_RULES_MK))) +else + KEYBOARDS := $(shell find keyboards/ -type f -iname "rules.mk" | grep -v keymaps | sed 's!keyboards/\(.*\)/rules.mk!\1!' | sort | uniq) +endif endef $(eval $(call GET_KEYBOARDS)) diff --git a/util/docker_build.sh b/util/docker_build.sh index 1e17bfbedc..738f1c7153 100755 --- a/util/docker_build.sh +++ b/util/docker_build.sh @@ -46,5 +46,11 @@ fi dir=$(pwd -W 2>/dev/null) || dir=$PWD # Use Windows path if on Windows # Run container and build firmware -docker run --rm -it $usb_args -w /qmk_firmware/ -v "$dir":/qmk_firmware qmkfm/base_container \ +docker run --rm -it $usb_args \ + -w /qmk_firmware/ \ + -v "$dir":/qmk_firmware \ + -e ALT_GET_KEYBOARDS=true \ + -e SKIP_GIT="$SKIP_GIT" \ + -e MAKEFLAGS="$MAKEFLAGS" \ + qmkfm/base_container \ make "$keyboard${keymap:+:$keymap}${target:+:$target}" -- cgit v1.2.3 From 4b766cec2eee6b512163f34e185614d5ea2df3cc Mon Sep 17 00:00:00 2001 From: Danny Date: Fri, 16 Aug 2019 19:46:41 -0400 Subject: Add support for different encoder pinout for right half of split keyboard (#6521) * Add support for different encoder pinouts for split keyboard * Update documentation for new encoder pinout feature --- quantum/encoder.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/quantum/encoder.c b/quantum/encoder.c index 31f00c346b..10d8cf7da0 100644 --- a/quantum/encoder.c +++ b/quantum/encoder.c @@ -16,6 +16,9 @@ */ #include "encoder.h" +#ifdef SPLIT_KEYBOARD + #include "split_util.h" +#endif // for memcpy #include @@ -54,6 +57,17 @@ void encoder_update_kb(int8_t index, bool clockwise) { } void encoder_init(void) { +#if defined(SPLIT_KEYBOARD) && defined(ENCODERS_PAD_A_RIGHT) && defined(ENCODERS_PAD_B_RIGHT) + if (!isLeftHand) { + const pin_t encoders_pad_a_right[] = ENCODERS_PAD_A_RIGHT; + const pin_t encoders_pad_b_right[] = ENCODERS_PAD_B_RIGHT; + for (uint8_t i = 0; i < NUMBER_OF_ENCODERS; i++) { + encoders_pad_a[i] = encoders_pad_a_right[i]; + encoders_pad_b[i] = encoders_pad_b_right[i]; + } + } +#endif + for (int i = 0; i < NUMBER_OF_ENCODERS; i++) { setPinInputHigh(encoders_pad_a[i]); setPinInputHigh(encoders_pad_b[i]); -- cgit v1.2.3 From d52ad98f4ad4d0fe1c2c9edfc3acd7d145c315d2 Mon Sep 17 00:00:00 2001 From: fauxpark Date: Sat, 17 Aug 2019 17:29:00 +1000 Subject: Remove backslashes from template keymap (#6548) --- quantum/template/base/keymaps/default/keymap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/quantum/template/base/keymaps/default/keymap.c b/quantum/template/base/keymaps/default/keymap.c index 0e9fad357f..5eeedd45ef 100644 --- a/quantum/template/base/keymaps/default/keymap.c +++ b/quantum/template/base/keymaps/default/keymap.c @@ -23,8 +23,8 @@ enum custom_keycodes { const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [0] = LAYOUT( /* Base */ - KC_A, KC_1, KC_H, \ - KC_TAB, KC_SPC \ + KC_A, KC_1, KC_H, + KC_TAB, KC_SPC ), }; -- cgit v1.2.3 From dbd4de0174623d23b67ffd35026aa7b28fa03f99 Mon Sep 17 00:00:00 2001 From: fauxpark Date: Sun, 18 Aug 2019 07:29:41 +1000 Subject: Add ATmega32U2 to mcu_selection.mk (#6561) --- quantum/mcu_selection.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quantum/mcu_selection.mk b/quantum/mcu_selection.mk index cca7720e9c..2d62dcbf1e 100644 --- a/quantum/mcu_selection.mk +++ b/quantum/mcu_selection.mk @@ -36,7 +36,7 @@ ifneq ($(findstring STM32F303, $(MCU)),) DFU_SUFFIX_ARGS = -p DF11 -v 0483 endif -ifneq (,$(filter $(MCU),atmega32u4 at90usb1286)) +ifneq (,$(filter $(MCU),atmega32u2 atmega32u4 at90usb1286)) # Processor frequency. # This will define a symbol, F_CPU, in all source code files equal to the # processor frequency in Hz. You can then use this symbol in your source code to -- cgit v1.2.3 From e5224082f197399a8d549f04e6f5a6343e46152d Mon Sep 17 00:00:00 2001 From: Stephen Wanhella Date: Wed, 21 Aug 2019 17:07:08 -0700 Subject: Added keycodes for swapping and unswapping the Control and OS keys (#6110) * Add MAGIC_SWAP_CONTROL_LGUI and MAGIC_UNSWAP_CONTROL_LGUI keycodes Key codes to swap and unswap the control and windows/cmd keys * Fix issues with pull request #6110 Renamed swap/unswap lctl and lgui key codes, added key codes to swap/unswap rctl and rgui, and moved new bool inside keycode_config.h struct to the end * Move new keycodes to the end of the enum (#6110) * add cases for swapped control and OS keys to mod_config (#6110) * Add new keycodes to feature_bootmagic.md (#6110) * Add R+L swap codes to keep in parity with AG_* codes * Extend Magic range check to include new magic codes * Update audio docs * Combine 2 byte ranges into 1 word for EECONFG Fix names for Keymap config EEPROM * Update docs/feature_bootmagic.md Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update docs/feature_bootmagic.md Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update docs/feature_bootmagic.md Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update docs/feature_bootmagic.md Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> --- quantum/keycode_config.c | 38 ++++++++++++++++++++++++++++++++++++ quantum/keycode_config.h | 2 ++ quantum/quantum.c | 48 +++++++++++++++++++++++++++++++++++++++++++++- quantum/quantum_keycodes.h | 13 +++++++++++++ tmk_core/common/command.c | 2 ++ tmk_core/common/eeconfig.c | 12 +++++++++--- tmk_core/common/eeconfig.h | 8 +++++--- 7 files changed, 116 insertions(+), 7 deletions(-) diff --git a/quantum/keycode_config.c b/quantum/keycode_config.c index 0dc5105d21..73fe15861d 100644 --- a/quantum/keycode_config.c +++ b/quantum/keycode_config.c @@ -31,6 +31,12 @@ uint16_t keycode_config(uint16_t keycode) { if (keymap_config.swap_control_capslock) { return KC_CAPSLOCK; } + if (keymap_config.swap_lctl_lgui) { + if (keymap_config.no_gui) { + return KC_NO; + } + return KC_LGUI; + } return KC_LCTL; case KC_LALT: if (keymap_config.swap_lalt_lgui) { @@ -44,10 +50,21 @@ uint16_t keycode_config(uint16_t keycode) { if (keymap_config.swap_lalt_lgui) { return KC_LALT; } + if (keymap_config.swap_lctl_lgui) { + return KC_LCTRL; + } if (keymap_config.no_gui) { return KC_NO; } return KC_LGUI; + case KC_RCTL: + if (keymap_config.swap_rctl_rgui) { + if (keymap_config.no_gui) { + return KC_NO; + } + return KC_RGUI; + } + return KC_RCTL; case KC_RALT: if (keymap_config.swap_ralt_rgui) { if (keymap_config.no_gui) { @@ -60,6 +77,9 @@ uint16_t keycode_config(uint16_t keycode) { if (keymap_config.swap_ralt_rgui) { return KC_RALT; } + if (keymap_config.swap_rctl_rgui) { + return KC_RCTL; + } if (keymap_config.no_gui) { return KC_NO; } @@ -108,6 +128,24 @@ uint8_t mod_config(uint8_t mod) { mod |= MOD_RGUI; } } + if (keymap_config.swap_lctl_lgui) { + if ((mod & MOD_RGUI) == MOD_LGUI) { + mod &= ~MOD_LGUI; + mod |= MOD_LCTL; + } else if ((mod & MOD_RCTL) == MOD_LCTL) { + mod &= ~MOD_LCTL; + mod |= MOD_LGUI; + } + } + if (keymap_config.swap_rctl_rgui) { + if ((mod & MOD_RGUI) == MOD_RGUI) { + mod &= ~MOD_RGUI; + mod |= MOD_RCTL; + } else if ((mod & MOD_RCTL) == MOD_RCTL) { + mod &= ~MOD_RCTL; + mod |= MOD_RGUI; + } + } if (keymap_config.no_gui) { mod &= ~MOD_LGUI; mod &= ~MOD_RGUI; diff --git a/quantum/keycode_config.h b/quantum/keycode_config.h index 022f4bd19b..7b01fcea45 100644 --- a/quantum/keycode_config.h +++ b/quantum/keycode_config.h @@ -36,6 +36,8 @@ typedef union { bool swap_grave_esc:1; bool swap_backslash_backspace:1; bool nkro:1; + bool swap_lctl_lgui:1; + bool swap_rctl_rgui:1; }; } keymap_config_t; diff --git a/quantum/quantum.c b/quantum/quantum.c index 9a44bd012a..b87fedbf70 100644 --- a/quantum/quantum.c +++ b/quantum/quantum.c @@ -65,9 +65,17 @@ extern backlight_config_t backlight_config; #ifndef AG_SWAP_SONG #define AG_SWAP_SONG SONG(AG_SWAP_SOUND) #endif + #ifndef CG_NORM_SONG + #define CG_NORM_SONG SONG(AG_NORM_SOUND) + #endif + #ifndef CG_SWAP_SONG + #define CG_SWAP_SONG SONG(AG_SWAP_SOUND) + #endif float goodbye_song[][2] = GOODBYE_SONG; float ag_norm_song[][2] = AG_NORM_SONG; float ag_swap_song[][2] = AG_SWAP_SONG; + float cg_norm_song[][2] = CG_NORM_SONG; + float cg_swap_song[][2] = CG_SWAP_SONG; #ifdef DEFAULT_LAYER_SONGS float default_layer_songs[][16][2] = DEFAULT_LAYER_SONGS; #endif @@ -559,7 +567,8 @@ bool process_record_quantum(keyrecord_t *record) { return false; #endif #endif - case MAGIC_SWAP_CONTROL_CAPSLOCK ... MAGIC_TOGGLE_NKRO: + case MAGIC_SWAP_CONTROL_CAPSLOCK ... MAGIC_TOGGLE_ALT_GUI: + case MAGIC_SWAP_LCTL_LGUI ... MAGIC_TOGGLE_CTL_GUI: if (record->event.pressed) { // MAGIC actions (BOOTMAGIC without the boot) if (!eeconfig_is_enabled()) { @@ -581,6 +590,12 @@ bool process_record_quantum(keyrecord_t *record) { case MAGIC_SWAP_RALT_RGUI: keymap_config.swap_ralt_rgui = true; break; + case MAGIC_SWAP_LCTL_LGUI: + keymap_config.swap_lctl_lgui = true; + break; + case MAGIC_SWAP_RCTL_RGUI: + keymap_config.swap_rctl_rgui = true; + break; case MAGIC_NO_GUI: keymap_config.no_gui = true; break; @@ -600,6 +615,13 @@ bool process_record_quantum(keyrecord_t *record) { PLAY_SONG(ag_swap_song); #endif break; + case MAGIC_SWAP_CTL_GUI: + keymap_config.swap_lctl_lgui = true; + keymap_config.swap_rctl_rgui = true; + #ifdef AUDIO_ENABLE + PLAY_SONG(cg_swap_song); + #endif + break; case MAGIC_UNSWAP_CONTROL_CAPSLOCK: keymap_config.swap_control_capslock = false; break; @@ -612,6 +634,12 @@ bool process_record_quantum(keyrecord_t *record) { case MAGIC_UNSWAP_RALT_RGUI: keymap_config.swap_ralt_rgui = false; break; + case MAGIC_UNSWAP_LCTL_LGUI: + keymap_config.swap_lctl_lgui = false; + break; + case MAGIC_UNSWAP_RCTL_RGUI: + keymap_config.swap_rctl_rgui = false; + break; case MAGIC_UNNO_GUI: keymap_config.no_gui = false; break; @@ -631,6 +659,13 @@ bool process_record_quantum(keyrecord_t *record) { PLAY_SONG(ag_norm_song); #endif break; + case MAGIC_UNSWAP_CTL_GUI: + keymap_config.swap_lctl_lgui = false; + keymap_config.swap_rctl_rgui = false; + #ifdef AUDIO_ENABLE + PLAY_SONG(cg_norm_song); + #endif + break; case MAGIC_TOGGLE_ALT_GUI: keymap_config.swap_lalt_lgui = !keymap_config.swap_lalt_lgui; keymap_config.swap_ralt_rgui = !keymap_config.swap_ralt_rgui; @@ -642,6 +677,17 @@ bool process_record_quantum(keyrecord_t *record) { } #endif break; + case MAGIC_TOGGLE_CTL_GUI: + keymap_config.swap_lctl_lgui = !keymap_config.swap_lctl_lgui; + keymap_config.swap_rctl_rgui = !keymap_config.swap_rctl_rgui; + #ifdef AUDIO_ENABLE + if (keymap_config.swap_rctl_rgui) { + PLAY_SONG(cg_swap_song); + } else { + PLAY_SONG(cg_norm_song); + } + #endif + break; case MAGIC_TOGGLE_NKRO: keymap_config.nkro = !keymap_config.nkro; break; diff --git a/quantum/quantum_keycodes.h b/quantum/quantum_keycodes.h index b5c6783e5e..bb16da4d50 100644 --- a/quantum/quantum_keycodes.h +++ b/quantum/quantum_keycodes.h @@ -492,6 +492,15 @@ enum quantum_keycodes { CMB_ON, CMB_OFF, CMB_TOG, + + MAGIC_SWAP_LCTL_LGUI, + MAGIC_SWAP_RCTL_RGUI, + MAGIC_UNSWAP_LCTL_LGUI, + MAGIC_UNSWAP_RCTL_RGUI, + MAGIC_SWAP_CTL_GUI, + MAGIC_UNSWAP_CTL_GUI, + MAGIC_TOGGLE_CTL_GUI, + // always leave at the end SAFE_RANGE }; @@ -639,6 +648,10 @@ enum quantum_keycodes { #define AG_NORM MAGIC_UNSWAP_ALT_GUI #define AG_TOGG MAGIC_TOGGLE_ALT_GUI +#define CG_SWAP MAGIC_SWAP_CTL_GUI +#define CG_NORM MAGIC_UNSWAP_CTL_GUI +#define CG_TOGG MAGIC_TOGGLE_CTL_GUI + // GOTO layer - 16 layers max // when: // ON_PRESS = 1 diff --git a/tmk_core/common/command.c b/tmk_core/common/command.c index d3884d9fa9..949615ecf9 100644 --- a/tmk_core/common/command.c +++ b/tmk_core/common/command.c @@ -286,6 +286,8 @@ static void print_eeconfig(void) print("keymap_config.raw: "); print_hex8(kc.raw); print("\n"); print(".swap_control_capslock: "); print_dec(kc.swap_control_capslock); print("\n"); print(".capslock_to_control: "); print_dec(kc.capslock_to_control); print("\n"); + print(".swap_lctl_lgui: "); print_dec(kc.swap_lctl_lgui); print("\n"); + print(".swap_rctl_rgui: "); print_dec(kc.swap_rctl_rgui); print("\n"); print(".swap_lalt_lgui: "); print_dec(kc.swap_lalt_lgui); print("\n"); print(".swap_ralt_rgui: "); print_dec(kc.swap_ralt_rgui); print("\n"); print(".no_gui: "); print_dec(kc.no_gui); print("\n"); diff --git a/tmk_core/common/eeconfig.c b/tmk_core/common/eeconfig.c index 39628475f6..71de5da0cf 100644 --- a/tmk_core/common/eeconfig.c +++ b/tmk_core/common/eeconfig.c @@ -39,7 +39,8 @@ void eeconfig_init_quantum(void) { eeprom_update_byte(EECONFIG_DEBUG, 0); eeprom_update_byte(EECONFIG_DEFAULT_LAYER, 0); default_layer_state = 0; - eeprom_update_byte(EECONFIG_KEYMAP, 0); + eeprom_update_byte(EECONFIG_KEYMAP_LOWER_BYTE, 0); + eeprom_update_byte(EECONFIG_KEYMAP_UPPER_BYTE, 0); eeprom_update_byte(EECONFIG_MOUSEKEY_ACCEL, 0); eeprom_update_byte(EECONFIG_BACKLIGHT, 0); eeprom_update_byte(EECONFIG_AUDIO, 0xFF); // On by default @@ -127,12 +128,17 @@ void eeconfig_update_default_layer(uint8_t val) { eeprom_update_byte(EECONFIG_DE * * FIXME: needs doc */ -uint8_t eeconfig_read_keymap(void) { return eeprom_read_byte(EECONFIG_KEYMAP); } +uint16_t eeconfig_read_keymap(void) { + return ( eeprom_read_byte(EECONFIG_KEYMAP_LOWER_BYTE) | (eeprom_read_byte(EECONFIG_KEYMAP_UPPER_BYTE) << 8) ); +} /** \brief eeconfig update keymap * * FIXME: needs doc */ -void eeconfig_update_keymap(uint8_t val) { eeprom_update_byte(EECONFIG_KEYMAP, val); } +void eeconfig_update_keymap(uint16_t val) { + eeprom_update_byte(EECONFIG_KEYMAP_LOWER_BYTE, val & 0xFF); + eeprom_update_byte(EECONFIG_KEYMAP_UPPER_BYTE, ( val >> 8 ) & 0xFF ); +} /** \brief eeconfig read backlight * diff --git a/tmk_core/common/eeconfig.h b/tmk_core/common/eeconfig.h index 4606427aaf..3f7e3357c4 100644 --- a/tmk_core/common/eeconfig.h +++ b/tmk_core/common/eeconfig.h @@ -45,7 +45,8 @@ along with this program. If not, see . #define EECONFIG_HAPTIC (uint32_t *)24 #define EECONFIG_RGB_MATRIX (uint32_t *)28 #define EECONFIG_RGB_MATRIX_SPEED (uint8_t *)32 - +// TODO: Combine these into a single word and single block of EEPROM +#define EECONFIG_KEYMAP_UPPER_BYTE (uint8_t *)33 /* debug bit */ #define EECONFIG_DEBUG_ENABLE (1<<0) #define EECONFIG_DEBUG_MATRIX (1<<1) @@ -62,6 +63,7 @@ along with this program. If not, see . #define EECONFIG_KEYMAP_SWAP_BACKSLASH_BACKSPACE (1<<6) #define EECONFIG_KEYMAP_NKRO (1<<7) +#define EECONFIG_KEYMAP_LOWER_BYTE EECONFIG_KEYMAP bool eeconfig_is_enabled(void); bool eeconfig_is_disabled(void); @@ -81,8 +83,8 @@ void eeconfig_update_debug(uint8_t val); uint8_t eeconfig_read_default_layer(void); void eeconfig_update_default_layer(uint8_t val); -uint8_t eeconfig_read_keymap(void); -void eeconfig_update_keymap(uint8_t val); +uint16_t eeconfig_read_keymap(void); +void eeconfig_update_keymap(uint16_t val); #ifdef BACKLIGHT_ENABLE uint8_t eeconfig_read_backlight(void); -- cgit v1.2.3 From aa074cf592d367b86803a21fb53e185743cccab9 Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Thu, 22 Aug 2019 00:22:32 -0700 Subject: Fixup Bootmagic code (#6386) --- quantum/keycode_config.c | 11 +++++++++++ quantum/quantum.c | 16 ++++++---------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/quantum/keycode_config.c b/quantum/keycode_config.c index 73fe15861d..bfd40d045c 100644 --- a/quantum/keycode_config.c +++ b/quantum/keycode_config.c @@ -18,6 +18,11 @@ extern keymap_config_t keymap_config; +/** \brief keycode_config + * + * This function is used to check a specific keycode against the bootmagic config, + * and will return the corrected keycode, when appropriate. + */ uint16_t keycode_config(uint16_t keycode) { switch (keycode) { @@ -109,6 +114,12 @@ uint16_t keycode_config(uint16_t keycode) { } } +/** \brief mod_config + * + * This function checks the mods passed to it against the bootmagic config, + * and will remove or replace mods, based on that. + */ + uint8_t mod_config(uint8_t mod) { if (keymap_config.swap_lalt_lgui) { if ((mod & MOD_RGUI) == MOD_LGUI) { diff --git a/quantum/quantum.c b/quantum/quantum.c index b87fedbf70..c5a44d1074 100644 --- a/quantum/quantum.c +++ b/quantum/quantum.c @@ -609,15 +609,13 @@ bool process_record_quantum(keyrecord_t *record) { keymap_config.nkro = true; break; case MAGIC_SWAP_ALT_GUI: - keymap_config.swap_lalt_lgui = true; - keymap_config.swap_ralt_rgui = true; + keymap_config.swap_lalt_lgui = keymap_config.swap_ralt_rgui = true; #ifdef AUDIO_ENABLE PLAY_SONG(ag_swap_song); #endif break; case MAGIC_SWAP_CTL_GUI: - keymap_config.swap_lctl_lgui = true; - keymap_config.swap_rctl_rgui = true; + keymap_config.swap_lctl_lgui = keymap_config.swap_rctl_rgui = true; #ifdef AUDIO_ENABLE PLAY_SONG(cg_swap_song); #endif @@ -653,22 +651,20 @@ bool process_record_quantum(keyrecord_t *record) { keymap_config.nkro = false; break; case MAGIC_UNSWAP_ALT_GUI: - keymap_config.swap_lalt_lgui = false; - keymap_config.swap_ralt_rgui = false; + keymap_config.swap_lalt_lgui = keymap_config.swap_ralt_rgui = false; #ifdef AUDIO_ENABLE PLAY_SONG(ag_norm_song); #endif break; case MAGIC_UNSWAP_CTL_GUI: - keymap_config.swap_lctl_lgui = false; - keymap_config.swap_rctl_rgui = false; + keymap_config.swap_lctl_lgui = keymap_config.swap_rctl_rgui = false; #ifdef AUDIO_ENABLE PLAY_SONG(cg_norm_song); #endif break; case MAGIC_TOGGLE_ALT_GUI: keymap_config.swap_lalt_lgui = !keymap_config.swap_lalt_lgui; - keymap_config.swap_ralt_rgui = !keymap_config.swap_ralt_rgui; + keymap_config.swap_ralt_rgui = keymap_config.swap_lalt_lgui; #ifdef AUDIO_ENABLE if (keymap_config.swap_ralt_rgui) { PLAY_SONG(ag_swap_song); @@ -679,7 +675,7 @@ bool process_record_quantum(keyrecord_t *record) { break; case MAGIC_TOGGLE_CTL_GUI: keymap_config.swap_lctl_lgui = !keymap_config.swap_lctl_lgui; - keymap_config.swap_rctl_rgui = !keymap_config.swap_rctl_rgui; + keymap_config.swap_rctl_rgui = keymap_config.swap_lctl_lgui; #ifdef AUDIO_ENABLE if (keymap_config.swap_rctl_rgui) { PLAY_SONG(cg_swap_song); -- cgit v1.2.3 From ef5cdd2262d340c5cc0e4c0011d81950e637eeb9 Mon Sep 17 00:00:00 2001 From: Drashna Jael're Date: Mon, 26 Aug 2019 21:39:15 -0700 Subject: Increment EEPROM Magic Number due to EEPROM init issues Specifically, the magic value may be initialized, but the range added for the CTRL-GUI feature is not --- tmk_core/common/eeconfig.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmk_core/common/eeconfig.h b/tmk_core/common/eeconfig.h index 3f7e3357c4..bde188dfdb 100644 --- a/tmk_core/common/eeconfig.h +++ b/tmk_core/common/eeconfig.h @@ -22,7 +22,7 @@ along with this program. If not, see . #include -#define EECONFIG_MAGIC_NUMBER (uint16_t)0xFEEE +#define EECONFIG_MAGIC_NUMBER (uint16_t)0xFEEF #define EECONFIG_MAGIC_NUMBER_OFF (uint16_t)0xFFFF /* EEPROM parameter address */ -- cgit v1.2.3 From ac52955ff26e783cf74a449f824dffb3bf209ee0 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/config_common.h | 10 ++++++++++ quantum/quantum.h | 15 +++++++-------- quantum/split_common/serial.c | 31 +++++++++++++------------------ 3 files changed, 30 insertions(+), 26 deletions(-) diff --git a/quantum/config_common.h b/quantum/config_common.h index bc4d9ec1af..ae72701da1 100644 --- a/quantum/config_common.h +++ b/quantum/config_common.h @@ -132,6 +132,16 @@ #define F7 PINDEF(F, 7) #endif + #ifndef __ASSEMBLER__ + #define _PIN_ADDRESS(p, offset) _SFR_IO8(ADDRESS_BASE + (p >> PORT_SHIFTER) + offset) + // Port X Input Pins Address + #define PINx_ADDRESS(p) _PIN_ADDRESS(p, 0) + // Port X Data Direction Register, 0:input 1:output + #define DDRx_ADDRESS(p) _PIN_ADDRESS(p, 1) + // Port X Data Register + #define PORTx_ADDRESS(p) _PIN_ADDRESS(p, 2) + #endif + #elif defined(PROTOCOL_CHIBIOS) // Defines mapping for Proton C replacement #ifdef CONVERT_TO_PROTON_C diff --git a/quantum/quantum.h b/quantum/quantum.h index 7ac862c994..777aaca7fc 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; diff --git a/quantum/split_common/serial.c b/quantum/split_common/serial.c index 1315377a34..322ab8030b 100644 --- a/quantum/split_common/serial.c +++ b/quantum/split_common/serial.c @@ -29,36 +29,32 @@ #endif #endif + #define setPinInputHigh(pin) (DDRx_ADDRESS(pin) &= ~_BV((pin) & 0xF), \ + PORTx_ADDRESS(pin) |= _BV((pin) & 0xF)) + #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 readPin(pin) ((bool)(PINx_ADDRESS(pin) & _BV((pin) & 0xF))) + #if SOFT_SERIAL_PIN >= D0 && SOFT_SERIAL_PIN <= D3 - #define SERIAL_PIN_DDR DDRD - #define SERIAL_PIN_PORT PORTD - #define SERIAL_PIN_INPUT PIND #if SOFT_SERIAL_PIN == D0 - #define SERIAL_PIN_MASK _BV(PD0) #define EIMSK_BIT _BV(INT0) #define EICRx_BIT (~(_BV(ISC00) | _BV(ISC01))) #define SERIAL_PIN_INTERRUPT INT0_vect #elif SOFT_SERIAL_PIN == D1 - #define SERIAL_PIN_MASK _BV(PD1) #define EIMSK_BIT _BV(INT1) #define EICRx_BIT (~(_BV(ISC10) | _BV(ISC11))) #define SERIAL_PIN_INTERRUPT INT1_vect #elif SOFT_SERIAL_PIN == D2 - #define SERIAL_PIN_MASK _BV(PD2) #define EIMSK_BIT _BV(INT2) #define EICRx_BIT (~(_BV(ISC20) | _BV(ISC21))) #define SERIAL_PIN_INTERRUPT INT2_vect #elif SOFT_SERIAL_PIN == D3 - #define SERIAL_PIN_MASK _BV(PD3) #define EIMSK_BIT _BV(INT3) #define EICRx_BIT (~(_BV(ISC30) | _BV(ISC31))) #define SERIAL_PIN_INTERRUPT INT3_vect #endif #elif SOFT_SERIAL_PIN == E6 - #define SERIAL_PIN_DDR DDRE - #define SERIAL_PIN_PORT PORTE - #define SERIAL_PIN_INPUT PINE - #define SERIAL_PIN_MASK _BV(PE6) #define EIMSK_BIT _BV(INT6) #define EICRx_BIT (~(_BV(ISC60) | _BV(ISC61))) #define SERIAL_PIN_INTERRUPT INT6_vect @@ -200,33 +196,32 @@ void serial_delay_half2(void) { inline static void serial_output(void) ALWAYS_INLINE; inline static void serial_output(void) { - SERIAL_PIN_DDR |= SERIAL_PIN_MASK; + setPinOutput(SOFT_SERIAL_PIN); } // make the serial pin an input with pull-up resistor inline static void serial_input_with_pullup(void) ALWAYS_INLINE; inline static void serial_input_with_pullup(void) { - SERIAL_PIN_DDR &= ~SERIAL_PIN_MASK; - SERIAL_PIN_PORT |= SERIAL_PIN_MASK; + setPinInputHigh(SOFT_SERIAL_PIN); } inline static uint8_t serial_read_pin(void) ALWAYS_INLINE; inline static uint8_t serial_read_pin(void) { - return !!(SERIAL_PIN_INPUT & SERIAL_PIN_MASK); + return !! readPin(SOFT_SERIAL_PIN); } inline static void serial_low(void) ALWAYS_INLINE; inline static void serial_low(void) { - SERIAL_PIN_PORT &= ~SERIAL_PIN_MASK; + writePinLow(SOFT_SERIAL_PIN); } inline static void serial_high(void) ALWAYS_INLINE; inline static void serial_high(void) { - SERIAL_PIN_PORT |= SERIAL_PIN_MASK; + writePinHigh(SOFT_SERIAL_PIN); } void soft_serial_initiator_init(SSTD_t *sstd_table, int sstd_table_size) @@ -245,7 +240,7 @@ void soft_serial_target_init(SSTD_t *sstd_table, int sstd_table_size) // Enable INT0-INT3,INT6 EIMSK |= EIMSK_BIT; -#if SERIAL_PIN_MASK == _BV(PE6) +#if SOFT_SERIAL_PIN == E6 // Trigger on falling edge of INT6 EICRB &= EICRx_BIT; #else -- cgit v1.2.3 From 3d3154b29caa664e00bf83c49d8fd3c774276a3a Mon Sep 17 00:00:00 2001 From: Joel Challis Date: Thu, 22 Aug 2019 15:27:18 +0100 Subject: Relocate pca9555 driver to core (#6563) * Move pca9555 files to central location * Get pca9555 boards compiling * Slight alignment of rules.mk --- drivers/gpio/pca9555.c | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++ drivers/gpio/pca9555.h | 55 +++++++++++++++++++++++++++++++++++ 2 files changed, 133 insertions(+) create mode 100644 drivers/gpio/pca9555.c create mode 100644 drivers/gpio/pca9555.h diff --git a/drivers/gpio/pca9555.c b/drivers/gpio/pca9555.c new file mode 100644 index 0000000000..b0e542d8de --- /dev/null +++ b/drivers/gpio/pca9555.c @@ -0,0 +1,78 @@ +/* Copyright 2019 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#include "i2c_master.h" +#include "pca9555.h" + +#include "debug.h" + +#define SLAVE_TO_ADDR(n) (n << 1) +#define TIMEOUT 100 + +enum { + CMD_INPUT_0 = 0, + CMD_INPUT_1, + CMD_OUTPUT_0, + CMD_OUTPUT_1, + CMD_INVERSION_0, + CMD_INVERSION_1, + CMD_CONFIG_0, + CMD_CONFIG_1, +}; + +void pca9555_init(uint8_t slave_addr) { + static uint8_t s_init = 0; + if (!s_init) { + i2c_init(); + + s_init = 1; + } + + // TODO: could check device connected + // i2c_start(SLAVE_TO_ADDR(slave) | I2C_WRITE); + // i2c_stop(); +} + +void pca9555_set_config(uint8_t slave_addr, uint8_t port, uint8_t conf) { + uint8_t addr = SLAVE_TO_ADDR(slave_addr); + uint8_t cmd = port ? CMD_CONFIG_1 : CMD_CONFIG_0; + + i2c_status_t ret = i2c_writeReg(addr, cmd, &conf, sizeof(conf), TIMEOUT); + if (ret != I2C_STATUS_SUCCESS) { + print("pca9555_set_config::FAILED\n"); + } +} + +void pca9555_set_output(uint8_t slave_addr, uint8_t port, uint8_t conf) { + uint8_t addr = SLAVE_TO_ADDR(slave_addr); + uint8_t cmd = port ? CMD_OUTPUT_1 : CMD_OUTPUT_0; + + i2c_status_t ret = i2c_writeReg(addr, cmd, &conf, sizeof(conf), TIMEOUT); + if (ret != I2C_STATUS_SUCCESS) { + print("pca9555_set_output::FAILED\n"); + } +} + +uint8_t pca9555_readPins(uint8_t slave_addr, uint8_t port) { + uint8_t addr = SLAVE_TO_ADDR(slave_addr); + uint8_t cmd = port ? CMD_INPUT_1 : CMD_INPUT_0; + + uint8_t data = 0; + i2c_status_t ret = i2c_readReg(addr, cmd, &data, sizeof(data), TIMEOUT); + if (ret != I2C_STATUS_SUCCESS) { + print("pca9555_readPins::FAILED\n"); + } + return data; +} diff --git a/drivers/gpio/pca9555.h b/drivers/gpio/pca9555.h new file mode 100644 index 0000000000..ebb97e2f30 --- /dev/null +++ b/drivers/gpio/pca9555.h @@ -0,0 +1,55 @@ +/* Copyright 2019 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#pragma once + +/* + PCA9555 + ,----------. + SDA --| SDA P00 |-- P00 + SCL --| SCL P01 |-- P01 + INT --| INT P02 |-- P02 + | P03 |-- P03 + A0 --| A0 P04 |-- P04 + A1 --| A1 P05 |-- P05 + A2 --| A2 P06 |-- P06 + | P07 |-- P07 + | | + | P10 |-- P10 + | P11 |-- P11 + | P12 |-- P12 + | P13 |-- P13 + | P14 |-- P14 + | P15 |-- P15 + | P16 |-- P16 + | P17 |-- P17 + `----------' +*/ + +#define PCA9555_PORT0 0 +#define PCA9555_PORT1 1 + +#define ALL_OUTPUT 0 +#define ALL_INPUT 0xFF +#define ALL_LOW 0 +#define ALL_HIGH 0xFF + +void pca9555_init(uint8_t slave_addr); + +void pca9555_set_config(uint8_t slave_addr, uint8_t port, uint8_t conf); + +void pca9555_set_output(uint8_t slave_addr, uint8_t port, uint8_t conf); + +uint8_t pca9555_readPins(uint8_t slave_addr, uint8_t port); -- cgit v1.2.3 From 7651b3dd73fc0279dd1928f2ff2eaf39c1d46d42 Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Tue, 20 Aug 2019 15:39:24 -0700 Subject: Add a universal flash command for cli (#6224) * Add universal flash command * Add bootloader info to I:C boards * Add support for ATSAM * Add messages for flash target * Message cleanup * Add USB ASP Flashing target * Make usbasp target more universal * Add phoney target for usbasp * Clarify error message when bootloader isn't matched --- message.mk | 2 ++ tmk_core/arm_atsam.mk | 3 ++ tmk_core/avr.mk | 91 +++++++++++++++++++++++++++++---------------------- tmk_core/chibios.mk | 26 +++++++++++++-- tmk_core/rules.mk | 5 ++- 5 files changed, 83 insertions(+), 44 deletions(-) diff --git a/message.mk b/message.mk index ec9bacbf49..c8d2135d5c 100644 --- a/message.mk +++ b/message.mk @@ -85,3 +85,5 @@ MSG_PYTHON_MISSING = $(WARN_COLOR)WARNING:$(NO_COLOR)\n \ Python 3 is not installed. It will be required by a future version\n\ of qmk_firmware.\n\n\ Please run $(BOLD)util/qmk_install.sh$(NO_COLOR) to install all the dependencies QMK requires.\n\n +MSG_FLASH_BOOTLOADER = $(WARN_COLOR)WARNING:$(NO_COLOR) This board's bootloader is not specified or is not supported by the \":flash\" target at this time.\n\n +MSG_FLASH_ARCH = $(WARN_COLOR)WARNING:$(NO_COLOR) This board's architecture is not supported by the \":flash\" target at this time.\n\n diff --git a/tmk_core/arm_atsam.mk b/tmk_core/arm_atsam.mk index 25a3411f4f..c9b14042f8 100644 --- a/tmk_core/arm_atsam.mk +++ b/tmk_core/arm_atsam.mk @@ -54,3 +54,6 @@ EXTRALIBDIRS = bin: $(BUILD_DIR)/$(TARGET).hex $(OBJCOPY) -Iihex -Obinary $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).bin $(COPY) $(BUILD_DIR)/$(TARGET).bin $(TARGET).bin; + +flash: bin + $(PRINT_OK); $(SILENT) || printf "$(MSG_FLASH_ARCH)" diff --git a/tmk_core/avr.mk b/tmk_core/avr.mk index 5bfd5a9b0d..e5443418b9 100644 --- a/tmk_core/avr.mk +++ b/tmk_core/avr.mk @@ -89,11 +89,11 @@ DEBUG_HOST = localhost #============================================================================ # Autodetect teensy loader ifndef TEENSY_LOADER_CLI - ifneq (, $(shell which teensy-loader-cli 2>/dev/null)) - TEENSY_LOADER_CLI ?= teensy-loader-cli - else - TEENSY_LOADER_CLI ?= teensy_loader_cli - endif + ifneq (, $(shell which teensy-loader-cli 2>/dev/null)) + TEENSY_LOADER_CLI ?= teensy-loader-cli + else + TEENSY_LOADER_CLI ?= teensy_loader_cli + endif endif # Generate a .qmk for the QMK-FF @@ -124,8 +124,12 @@ qmk: $(BUILD_DIR)/$(TARGET).hex program: $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).eep check-size $(PROGRAM_CMD) -teensy: $(BUILD_DIR)/$(TARGET).hex check-size cpfirmware +define EXEC_TEENSY $(TEENSY_LOADER_CLI) -mmcu=$(MCU) -w -v $(BUILD_DIR)/$(TARGET).hex +endef + +teensy: $(BUILD_DIR)/$(TARGET).hex check-size cpfirmware + $(call EXEC_TEENSY) BATCHISP ?= batchisp @@ -137,18 +141,32 @@ flip: $(BUILD_DIR)/$(TARGET).hex check-size DFU_PROGRAMMER ?= dfu-programmer GREP ?= grep -dfu: $(BUILD_DIR)/$(TARGET).hex cpfirmware check-size + +define EXEC_DFU + if [ "$(1)" ]; then \ + echo "Flashing '$(1)' for EE_HANDS split keyboard support." ;\ + fi; \ until $(DFU_PROGRAMMER) $(MCU) get bootloader-version; do\ echo "Error: Bootloader not found. Trying again in 5s." ;\ sleep 5 ;\ - done + done; \ if $(DFU_PROGRAMMER) --version 2>&1 | $(GREP) -q 0.7 ; then\ - $(DFU_PROGRAMMER) $(MCU) erase --force;\ - else\ - $(DFU_PROGRAMMER) $(MCU) erase;\ - fi - $(DFU_PROGRAMMER) $(MCU) flash $(BUILD_DIR)/$(TARGET).hex + $(DFU_PROGRAMMER) $(MCU) erase --force; \ + if [ "$(1)" ]; then \ + $(DFU_PROGRAMMER) $(MCU) flash --eeprom $(QUANTUM_PATH)/split_common/$(1);\ + fi; \ + else \ + $(DFU_PROGRAMMER) $(MCU) erase; \ + if [ "$(1)" ]; then \ + $(DFU_PROGRAMMER) $(MCU) flash-eeprom $(QUANTUM_PATH)/split_common/$(1);\ + fi; \ + fi; \ + $(DFU_PROGRAMMER) $(MCU) flash $(BUILD_DIR)/$(TARGET).hex;\ $(DFU_PROGRAMMER) $(MCU) reset +endef + +dfu: $(BUILD_DIR)/$(TARGET).hex cpfirmware check-size + $(call EXEC_DFU) dfu-start: $(DFU_PROGRAMMER) $(MCU) reset @@ -170,34 +188,10 @@ dfu-ee: $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).eep $(DFU_PROGRAMMER) $(MCU) reset dfu-split-left: $(BUILD_DIR)/$(TARGET).hex cpfirmware check-size - until $(DFU_PROGRAMMER) $(MCU) get bootloader-version; do\ - echo "Error: Bootloader not found. Trying again in 5s." ;\ - sleep 5 ;\ - done - if $(DFU_PROGRAMMER) --version 2>&1 | $(GREP) -q 0.7 ; then\ - $(DFU_PROGRAMMER) $(MCU) erase --force;\ - $(DFU_PROGRAMMER) $(MCU) flash --eeprom $(QUANTUM_PATH)/split_common/eeprom-lefthand.eep;\ - else\ - $(DFU_PROGRAMMER) $(MCU) erase;\ - $(DFU_PROGRAMMER) $(MCU) flash-eeprom $(QUANTUM_PATH)/split_common/eeprom-lefthand.eep;\ - fi - $(DFU_PROGRAMMER) $(MCU) flash $(BUILD_DIR)/$(TARGET).hex - $(DFU_PROGRAMMER) $(MCU) reset + $(call EXEC_DFU,eeprom-lefthand.eep) dfu-split-right: $(BUILD_DIR)/$(TARGET).hex cpfirmware check-size - until $(DFU_PROGRAMMER) $(MCU) get bootloader-version; do\ - echo "Error: Bootloader not found. Trying again in 5s." ;\ - sleep 5 ;\ - done - if $(DFU_PROGRAMMER) --version 2>&1 | $(GREP) -q 0.7 ; then\ - $(DFU_PROGRAMMER) $(MCU) erase --force;\ - $(DFU_PROGRAMMER) $(MCU) flash --eeprom $(QUANTUM_PATH)/split_common/eeprom-righthand.eep;\ - else\ - $(DFU_PROGRAMMER) $(MCU) erase;\ - $(DFU_PROGRAMMER) $(MCU) flash-eeprom $(QUANTUM_PATH)/split_common/eeprom-righthand.eep;\ - fi - $(DFU_PROGRAMMER) $(MCU) flash $(BUILD_DIR)/$(TARGET).hex - $(DFU_PROGRAMMER) $(MCU) reset + $(call EXEC_DFU,eeprom-righthand.eep) define EXEC_AVRDUDE USB= ;\ @@ -245,8 +239,12 @@ avrdude-split-left: $(BUILD_DIR)/$(TARGET).hex check-size cpfirmware avrdude-split-right: $(BUILD_DIR)/$(TARGET).hex check-size cpfirmware $(call EXEC_AVRDUDE,eeprom-righthand.eep) -usbasp: $(BUILD_DIR)/$(TARGET).hex check-size cpfirmware +define EXEC_USBASP avrdude -p $(MCU) -c usbasp -U flash:w:$(BUILD_DIR)/$(TARGET).hex +endef + +usbasp: $(BUILD_DIR)/$(TARGET).hex check-size cpfirmware + $(call EXEC_USBASP) # Convert hex to bin. @@ -323,3 +321,16 @@ production: $(BUILD_DIR)/$(TARGET).hex bootloader cpfirmware @cat $(TARGET)_bootloader.hex >> $(TARGET)_production.hex echo "File sizes:" $(SIZE) $(TARGET).hex $(TARGET)_bootloader.hex $(TARGET)_production.hex + +flash: $(BUILD_DIR)/$(TARGET).hex check-size cpfirmware +ifeq ($(strip $(BOOTLOADER)), caterina) + $(call EXEC_AVRDUDE) +else ifeq ($(strip $(BOOTLOADER)), halfkay) + $(call EXEC_TEENSY) +else ifeq (dfu,$(findstring dfu,$(BOOTLOADER))) + $(call EXEC_DFU) +else ifeq ($(strip $(BOOTLOADER)), USBasp) + $(call EXEC_USBASP) +else + $(PRINT_OK); $(SILENT) || printf "&(MSG_FLASH_BOOTLOADER)" +endif diff --git a/tmk_core/chibios.mk b/tmk_core/chibios.mk index 4aebb47762..eee520467d 100644 --- a/tmk_core/chibios.mk +++ b/tmk_core/chibios.mk @@ -234,9 +234,12 @@ qmk: $(BUILD_DIR)/$(TARGET).bin zip $(TARGET).qmk -urj $(BUILD_DIR)/$(TARGET).json printf "@ $(TARGET).json\n@=info.json\n" | zipnote -w $(TARGET).qmk -dfu-util: $(BUILD_DIR)/$(TARGET).bin cpfirmware sizeafter +define EXEC_DFU_UTIL $(DFU_UTIL) $(DFU_ARGS) -D $(BUILD_DIR)/$(TARGET).bin +endef +dfu-util: $(BUILD_DIR)/$(TARGET).bin cpfirmware sizeafter + $(call EXEC_DFU_UTIL) ifneq ($(strip $(TIME_DELAY)),) TIME_DELAY = $(strip $(TIME_DELAY)) @@ -253,7 +256,7 @@ dfu-util-wait: $(BUILD_DIR)/$(TARGET).bin cpfirmware sizeafter done; \ echo "Flashing $(TARGET).bin" ;\ sleep 1 ;\ - $(DFU_UTIL) $(DFU_ARGS) -D $(BUILD_DIR)/$(TARGET).bin + $(call EXEC_DFU_UTIL) st-link-cli: $(BUILD_DIR)/$(TARGET).hex sizeafter $(ST_LINK_CLI) $(ST_LINK_ARGS) -q -c SWD -p $(BUILD_DIR)/$(TARGET).hex -Rst @@ -268,7 +271,24 @@ ifndef TEENSY_LOADER_CLI endif endif -teensy: $(BUILD_DIR)/$(TARGET).hex cpfirmware sizeafter +define EXEC_TEENSY $(TEENSY_LOADER_CLI) -mmcu=$(MCU_LDSCRIPT) -w -v $(BUILD_DIR)/$(TARGET).hex +endef + +teensy: $(BUILD_DIR)/$(TARGET).hex cpfirmware sizeafter + $(call EXEC_TEENSY) bin: $(BUILD_DIR)/$(TARGET).bin sizeafter + $(COPY) $(BUILD_DIR)/$(TARGET).bin $(TARGET).bin; + + +flash: $(BUILD_DIR)/$(TARGET).bin cpfirmware sizeafter +ifeq ($(strip $(BOOTLOADER)),dfu) + $(call EXEC_DFU_UTIL) +else ifeq ($(strip $(MCU_FAMILY)),KINETIS) + $(call EXEC_TEENSY) +else ifeq ($(strip $(MCU_FAMILY)),STM32) + $(call EXEC_DFU_UTIL) +else + $(PRINT_OK); $(SILENT) || printf "$(MSG_FLASH_BOOTLOADER)" +endif diff --git a/tmk_core/rules.mk b/tmk_core/rules.mk index e51dbfe7c6..31bce33c39 100644 --- a/tmk_core/rules.mk +++ b/tmk_core/rules.mk @@ -433,4 +433,7 @@ $(eval $(foreach OUTPUT,$(OUTPUTS),$(shell mkdir -p $(OUTPUT) 2>/dev/null))) .PHONY : all finish sizebefore sizeafter qmkversion \ gccversion build elf hex eep lss sym coff extcoff \ clean clean_list debug gdb-config show_path \ -program teensy dfu flip dfu-ee flip-ee dfu-start +program teensy dfu flip dfu-ee flip-ee dfu-start \ +flash dfu-split-left dfu-split-right \ +avrdude-split-left avrdude-split-right \ +avrdude-loop usbasp -- cgit v1.2.3 From 592f65d28014d23c88d7632160e7f79029ebce3b Mon Sep 17 00:00:00 2001 From: Joel Challis Date: Fri, 23 Aug 2019 00:08:45 +0100 Subject: Align flashing behaviour of dfu-util (#6578) * Align flashing retry logic of dfu-util * Align bootloader wait messages Co-Authored-By: Drashna Jaelre --- tmk_core/chibios.mk | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/tmk_core/chibios.mk b/tmk_core/chibios.mk index eee520467d..4b5b6d00b5 100644 --- a/tmk_core/chibios.mk +++ b/tmk_core/chibios.mk @@ -235,28 +235,18 @@ qmk: $(BUILD_DIR)/$(TARGET).bin printf "@ $(TARGET).json\n@=info.json\n" | zipnote -w $(TARGET).qmk define EXEC_DFU_UTIL + until $(DFU_UTIL) -l | grep -q "Found DFU"; do\ + echo "Error: Bootloader not found. Trying again in 5s." ;\ + sleep 5 ;\ + done $(DFU_UTIL) $(DFU_ARGS) -D $(BUILD_DIR)/$(TARGET).bin endef dfu-util: $(BUILD_DIR)/$(TARGET).bin cpfirmware sizeafter $(call EXEC_DFU_UTIL) -ifneq ($(strip $(TIME_DELAY)),) - TIME_DELAY = $(strip $(TIME_DELAY)) -else - TIME_DELAY = 10 -endif -dfu-util-wait: $(BUILD_DIR)/$(TARGET).bin cpfirmware sizeafter - echo "Preparing to flash firmware. Please enter bootloader now..." ;\ - COUNTDOWN=$(TIME_DELAY) ;\ - while [[ $$COUNTDOWN -ge 1 ]] ; do \ - echo "Flashing in $$COUNTDOWN ..."; \ - sleep 1 ;\ - ((COUNTDOWN = COUNTDOWN - 1)) ; \ - done; \ - echo "Flashing $(TARGET).bin" ;\ - sleep 1 ;\ - $(call EXEC_DFU_UTIL) +# Legacy alias +dfu-util-wait: dfu-util st-link-cli: $(BUILD_DIR)/$(TARGET).hex sizeafter $(ST_LINK_CLI) $(ST_LINK_ARGS) -q -c SWD -p $(BUILD_DIR)/$(TARGET).hex -Rst -- cgit v1.2.3 From cfbb03645e553a3c5b3cd06dd3a03c244e5e8ee0 Mon Sep 17 00:00:00 2001 From: Joel Challis Date: Sat, 24 Aug 2019 16:35:11 +0100 Subject: Add 'bootloadHID' flash target (#5587) * Add 'bootloadHID' flash target * Prep for flash target * Add :flash support * Align bootloader wait messages Co-Authored-By: Drashna Jaelre * Update template to suggest use of :flash --- quantum/template/ps2avrgb/readme.md | 33 +++++---------------------------- tmk_core/avr.mk | 15 +++++++++++++++ 2 files changed, 20 insertions(+), 28 deletions(-) diff --git a/quantum/template/ps2avrgb/readme.md b/quantum/template/ps2avrgb/readme.md index feec722a52..c01e7bca52 100644 --- a/quantum/template/ps2avrgb/readme.md +++ b/quantum/template/ps2avrgb/readme.md @@ -12,33 +12,10 @@ Make example for this keyboard (after setting up your build environment): make %KEYBOARD%:default -Flashing - -ps2avr(GB) boards use an atmega32a microcontroller and a different bootloader. It is not flashable using the regular QMK methods. - -Windows: -1. Download [HIDBootFlash](http://vusb.wikidot.com/project:hidbootflash). -2. Place your keyboard into reset. -3. Press the `Find Device` button and ensure that your keyboard is found. -4. Press the `Open .hex File` button and locate the `.hex` file you created. -5. Press the `Flash Device` button and wait for the process to complete. - -macOS: -1. Install homebrew by typing the following: - ``` - /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" - ``` -2. Install `crosspack-avr`. - ``` - brew cask install crosspack-avr - ``` -3. Install the following packages: - ``` - brew install python - brew install pyusb - brew install --HEAD`https://raw.githubusercontent.com/robertgzr/homebrew-tap/master/bootloadhid.rb - -4. Place your keyboard into reset. -5. Flash the board by typing `bootloadHID -r` followed by the path to your `.hex` file. +Flashing example for this keyboard ([after setting up the bootloadHID flashing environment](flashing_bootloadhid.md)) + + make %KEYBOARD%:default:flash + +**Reset Key**: Hold down the key located at *LOCATION*, commonly programmed as *KEY* while plugging in the keyboard. See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). diff --git a/tmk_core/avr.mk b/tmk_core/avr.mk index e5443418b9..bdda14a070 100644 --- a/tmk_core/avr.mk +++ b/tmk_core/avr.mk @@ -246,6 +246,19 @@ endef usbasp: $(BUILD_DIR)/$(TARGET).hex check-size cpfirmware $(call EXEC_USBASP) +BOOTLOADHID_PROGRAMMER ?= bootloadHID + +define EXEC_BOOTLOADHID + # bootloadHid executable has no cross platform detect methods + # so keep running bootloadHid if the output contains "The specified device was not found" + until $(BOOTLOADHID_PROGRAMMER) -r $(BUILD_DIR)/$(TARGET).hex 2>&1 | tee /dev/stderr | grep -v "device was not found"; do\ + echo "Error: Bootloader not found. Trying again in 5s." ;\ + sleep 5 ;\ + done +endef + +bootloadHID: $(BUILD_DIR)/$(TARGET).hex check-size cpfirmware + $(call EXEC_BOOTLOADHID) # Convert hex to bin. bin: $(BUILD_DIR)/$(TARGET).hex @@ -331,6 +344,8 @@ else ifeq (dfu,$(findstring dfu,$(BOOTLOADER))) $(call EXEC_DFU) else ifeq ($(strip $(BOOTLOADER)), USBasp) $(call EXEC_USBASP) +else ifeq ($(strip $(BOOTLOADER)), bootloadHID) + $(call EXEC_BOOTLOADHID) else $(PRINT_OK); $(SILENT) || printf "&(MSG_FLASH_BOOTLOADER)" endif -- cgit v1.2.3 From a75e0b2374eb8b5c1c33315f921dc91048445988 Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Mon, 26 Aug 2019 10:16:46 -0700 Subject: Fix Typo in :flash target for missing bootloader (#6615) --- tmk_core/avr.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmk_core/avr.mk b/tmk_core/avr.mk index bdda14a070..775f2a996d 100644 --- a/tmk_core/avr.mk +++ b/tmk_core/avr.mk @@ -347,5 +347,5 @@ else ifeq ($(strip $(BOOTLOADER)), USBasp) else ifeq ($(strip $(BOOTLOADER)), bootloadHID) $(call EXEC_BOOTLOADHID) else - $(PRINT_OK); $(SILENT) || printf "&(MSG_FLASH_BOOTLOADER)" + $(PRINT_OK); $(SILENT) || printf "$(MSG_FLASH_BOOTLOADER)" endif -- cgit v1.2.3 From ca5162b90ec225d453cc817f39bc09d6897aca01 Mon Sep 17 00:00:00 2001 From: skullydazed Date: Sun, 25 Aug 2019 11:58:24 -0700 Subject: Refactor `qmk compile-json` to `qmk compile` (#6592) --- bin/qmk | 2 +- lib/python/qmk/cli/compile.py | 53 ++++++++++++++++++++++++++++++++++ lib/python/qmk/cli/compile/__init__.py | 0 lib/python/qmk/cli/compile/json.py | 44 ---------------------------- 4 files changed, 54 insertions(+), 45 deletions(-) create mode 100755 lib/python/qmk/cli/compile.py delete mode 100644 lib/python/qmk/cli/compile/__init__.py delete mode 100755 lib/python/qmk/cli/compile/json.py diff --git a/bin/qmk b/bin/qmk index dfd31e2006..d4b584b10e 100755 --- a/bin/qmk +++ b/bin/qmk @@ -38,7 +38,7 @@ with open('requirements.txt', 'r') as fd: # Figure out our version command = ['git', 'describe', '--abbrev=6', '--dirty', '--always', '--tags'] -result = subprocess.run(command, universal_newlines=True, capture_output=True) +result = subprocess.run(command, universal_newlines=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) if result.returncode == 0: os.environ['QMK_VERSION'] = 'QMK ' + result.stdout.strip() diff --git a/lib/python/qmk/cli/compile.py b/lib/python/qmk/cli/compile.py new file mode 100755 index 0000000000..7e14ad8fbf --- /dev/null +++ b/lib/python/qmk/cli/compile.py @@ -0,0 +1,53 @@ +"""Compile a QMK Firmware. + +You can compile a keymap already in the repo or using a QMK Configurator export. +""" +import json +import os +import sys +import subprocess +from argparse import FileType + +from milc import cli + +import qmk.keymap +import qmk.path + + +@cli.argument('filename', nargs='?', type=FileType('r'), help='The configurator export to compile') +@cli.argument('-kb', '--keyboard', help='The keyboard to build a firmware for. Ignored when a configurator export is supplied.') +@cli.argument('-km', '--keymap', help='The keymap to build a firmware for. Ignored when a configurator export is supplied.') +@cli.entrypoint('Compile a QMK Firmware.') +def main(cli): + """Compile a QMK Firmware. + + If a Configurator export is supplied this command will create a new keymap, overwriting an existing keymap if one exists. + + FIXME(skullydazed): add code to check and warn if the keymap already exists + + If --keyboard and --keymap are provided this command will build a firmware based on that. + + """ + if cli.args.filename: + # Parse the configurator json + user_keymap = json.load(cli.args.filename) + + # Generate the keymap + keymap_path = qmk.path.keymap(user_keymap['keyboard']) + cli.log.info('Creating {fg_cyan}%s{style_reset_all} keymap in {fg_cyan}%s', user_keymap['keymap'], keymap_path) + qmk.keymap.write(user_keymap['keyboard'], user_keymap['keymap'], user_keymap['layout'], user_keymap['layers']) + cli.log.info('Wrote keymap to {fg_cyan}%s/%s/keymap.c', keymap_path, user_keymap['keymap']) + + # Compile the keymap + command = ['make', ':'.join((user_keymap['keyboard'], user_keymap['keymap']))] + + elif cli.config.general.keyboard and cli.config.general.keymap: + # Generate the make command for a specific keyboard/keymap. + command = ['make', ':'.join((cli.config.general.keyboard, cli.config.general.keymap))] + + else: + cli.log.error('You must supply a configurator export or both `--keyboard` and `--keymap`.') + return False + + cli.log.info('Compiling keymap with {fg_cyan}%s\n\n', ' '.join(command)) + subprocess.run(command) diff --git a/lib/python/qmk/cli/compile/__init__.py b/lib/python/qmk/cli/compile/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/python/qmk/cli/compile/json.py b/lib/python/qmk/cli/compile/json.py deleted file mode 100755 index 89c16b2063..0000000000 --- a/lib/python/qmk/cli/compile/json.py +++ /dev/null @@ -1,44 +0,0 @@ -"""Create a keymap directory from a configurator export. -""" -import json -import os -import sys -import subprocess - -from milc import cli - -import qmk.keymap -import qmk.path - - -@cli.argument('filename', help='Configurator JSON export') -@cli.entrypoint('Compile a QMK Configurator export.') -def main(cli): - """Compile a QMK Configurator export. - - This command creates a new keymap from a configurator export, overwriting an existing keymap if one exists. - - FIXME(skullydazed): add code to check and warn if the keymap already exists - """ - # Error checking - if cli.args.filename == ('-'): - cli.log.error('Reading from STDIN is not (yet) supported.') - exit(1) - if not os.path.exists(qmk.path.normpath(cli.args.filename)): - cli.log.error('JSON file does not exist!') - exit(1) - - # Parse the configurator json - with open(qmk.path.normpath(cli.args.filename), 'r') as fd: - user_keymap = json.load(fd) - - # Generate the keymap - keymap_path = qmk.path.keymap(user_keymap['keyboard']) - cli.log.info('Creating {fg_cyan}%s{style_reset_all} keymap in {fg_cyan}%s', user_keymap['keymap'], keymap_path) - qmk.keymap.write(user_keymap['keyboard'], user_keymap['keymap'], user_keymap['layout'], user_keymap['layers']) - cli.log.info('Wrote keymap to {fg_cyan}%s/%s/keymap.c', keymap_path, user_keymap['keymap']) - - # Compile the keymap - command = ['make', ':'.join((user_keymap['keyboard'], user_keymap['keymap']))] - cli.log.info('Compiling keymap with {fg_cyan}%s\n\n', ' '.join(command)) - subprocess.run(command) -- cgit v1.2.3 From 09c4e8ac5d4916edcaaa821392a4d12aeb6d99a3 Mon Sep 17 00:00:00 2001 From: XScorpion2 Date: Sun, 25 Aug 2019 14:37:55 -0500 Subject: Added OLED Display autoscroll during periods of OLED data inactivity (#6546) * Added OLED Display autoscroll during periods of OLED data inactivity. * Fixing compile errors * Feedback from review --- drivers/oled/oled_driver.c | 40 ++++++++++++++++++++++++----- drivers/oled/oled_driver.h | 19 +++++++++++--- tmk_core/common/timer.h | 11 ++++++++ tmk_core/protocol/usb_hid/override_wiring.c | 7 +++-- 4 files changed, 63 insertions(+), 14 deletions(-) diff --git a/drivers/oled/oled_driver.c b/drivers/oled/oled_driver.c index 2d049963e6..d274a9d120 100644 --- a/drivers/oled/oled_driver.c +++ b/drivers/oled/oled_driver.c @@ -114,8 +114,11 @@ bool oled_active = false; bool oled_scrolling = false; uint8_t oled_rotation = 0; uint8_t oled_rotation_width = 0; -#if !defined(OLED_DISABLE_TIMEOUT) - uint16_t oled_last_activity; +#if OLED_TIMEOUT > 0 + uint32_t oled_timeout; +#endif +#if OLED_SCROLL_TIMEOUT > 0 + uint32_t oled_scroll_timeout; #endif // Internal variables to reduce math instructions @@ -209,6 +212,13 @@ bool oled_init(uint8_t rotation) { return false; } +#if OLED_TIMEOUT > 0 + oled_timeout = timer_read32() + OLED_TIMEOUT; +#endif +#if OLED_SCROLL_TIMEOUT > 0 + oled_scroll_timeout = timer_read32() + OLED_SCROLL_TIMEOUT; +#endif + oled_clear(); oled_initialized = true; oled_active = true; @@ -454,8 +464,8 @@ void oled_write_ln_P(const char *data, bool invert) { #endif // defined(__AVR__) bool oled_on(void) { -#if !defined(OLED_DISABLE_TIMEOUT) - oled_last_activity = timer_read(); +#if OLED_TIMEOUT > 0 + oled_timeout = timer_read32() + OLED_TIMEOUT; #endif static const uint8_t PROGMEM display_on[] = { I2C_CMD, DISPLAY_ON }; @@ -519,6 +529,7 @@ bool oled_scroll_off(void) { return oled_scrolling; } oled_scrolling = false; + oled_dirty = -1; } return !oled_scrolling; } @@ -546,15 +557,32 @@ void oled_task(void) { oled_task_user(); +#if OLED_SCROLL_TIMEOUT > 0 + if (oled_dirty && oled_scrolling) { + oled_scroll_timeout = timer_read32() + OLED_SCROLL_TIMEOUT; + oled_scroll_off(); + } +#endif + // Smart render system, no need to check for dirty oled_render(); // Display timeout check -#if !defined(OLED_DISABLE_TIMEOUT) - if (oled_active && timer_elapsed(oled_last_activity) > OLED_TIMEOUT) { +#if OLED_TIMEOUT > 0 + if (oled_active && timer_expired32(timer_read32(), oled_timeout)) { oled_off(); } #endif + +#if OLED_SCROLL_TIMEOUT > 0 + if (!oled_scrolling && timer_expired32(timer_read32(), oled_scroll_timeout)) { +#ifdef OLED_SCROLL_TIMEOUT_RIGHT + oled_scroll_right(); +#else + oled_scroll_left(); +#endif + } +#endif } __attribute__((weak)) diff --git a/drivers/oled/oled_driver.h b/drivers/oled/oled_driver.h index 59cb4a0b2e..9c6384edce 100644 --- a/drivers/oled/oled_driver.h +++ b/drivers/oled/oled_driver.h @@ -138,10 +138,21 @@ along with this program. If not, see . #define OLED_FONT_HEIGHT 8 #endif -#define OLED_ROTATION_0 0x00 -#define OLED_ROTATION_90 0x01 -#define OLED_ROTATION_180 0x02 -#define OLED_ROTATION_270 0x03 +#if !defined(OLED_TIMEOUT) + #if defined(OLED_DISABLE_TIMEOUT) + #define OLED_TIMEOUT 0 + #else + #define OLED_TIMEOUT 60000 + #endif +#endif + +// OLED Rotation enum values are flags +typedef enum { + OLED_ROTATION_0 = 0, + OLED_ROTATION_90 = 1, + OLED_ROTATION_180 = 2, + OLED_ROTATION_270 = 3, // OLED_ROTATION_90 | OLED_ROTATION_180 +} oled_rotation_t; // Initialize the oled display, rotating the rendered output based on the define passed in. // Returns true if the OLED was initialized successfully diff --git a/tmk_core/common/timer.h b/tmk_core/common/timer.h index fe23f87aec..a8dd85663f 100644 --- a/tmk_core/common/timer.h +++ b/tmk_core/common/timer.h @@ -19,6 +19,7 @@ along with this program. If not, see . #define TIMER_H 1 #include +#include #if defined(__AVR__) #include "avr/timer_avr.h" @@ -46,6 +47,16 @@ uint32_t timer_read32(void); uint16_t timer_elapsed(uint16_t last); uint32_t timer_elapsed32(uint32_t last); +// Utility functions to check if a future time has expired & autmatically handle time wrapping if checked / reset frequently (half of max value) +inline bool timer_expired(uint16_t current, uint16_t last) +{ + return current - last < 0x8000; +} + +inline bool timer_expired32(uint32_t current, uint32_t future) { + return current - future < 0x80000000; +} + #ifdef __cplusplus } #endif diff --git a/tmk_core/protocol/usb_hid/override_wiring.c b/tmk_core/protocol/usb_hid/override_wiring.c index 1e9a94ce26..52f03c300f 100644 --- a/tmk_core/protocol/usb_hid/override_wiring.c +++ b/tmk_core/protocol/usb_hid/override_wiring.c @@ -4,14 +4,13 @@ #define __DELAY_BACKWARD_COMPATIBLE__ #include #include "common/timer.h" -#include "Arduino.h" -unsigned long millis() +unsigned long millis(void) { return timer_read32(); } -unsigned long micros() +unsigned long micros(void) { return timer_read32() * 1000UL; } @@ -23,7 +22,7 @@ void delayMicroseconds(unsigned int us) { _delay_us(us); } -void init() +void init(void) { timer_init(); } -- cgit v1.2.3 From 8b7047a62c148a9e96b15169ba21928908486905 Mon Sep 17 00:00:00 2001 From: Florian Didron Date: Wed, 28 Aug 2019 15:07:47 +0900 Subject: feat: adds some icelandic chars --- quantum/keymap_extras/keymap_nordic.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/quantum/keymap_extras/keymap_nordic.h b/quantum/keymap_extras/keymap_nordic.h index 551a4212b2..5a04b2d607 100644 --- a/quantum/keymap_extras/keymap_nordic.h +++ b/quantum/keymap_extras/keymap_nordic.h @@ -67,4 +67,9 @@ #define NO_BSLS ALGR(KC_MINS) #define NO_MU ALGR(KC_M) +// Icelandic characters +#define NO_TH KC_SLSH //Þ +#define NO_ETH KC_LBRC //Ð +#define NO_UMLT KC_MINS //Ö + #endif -- cgit v1.2.3 From da2ec386d87bd3b108f6d72c5cd20f51e903d7ad Mon Sep 17 00:00:00 2001 From: Florian Didron Date: Tue, 3 Sep 2019 10:05:46 +0900 Subject: chore: set COMMAND_ENABLE = no --- keyboards/planck/ez/rules.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keyboards/planck/ez/rules.mk b/keyboards/planck/ez/rules.mk index c6fb52d2b5..93f8ade95b 100644 --- a/keyboards/planck/ez/rules.mk +++ b/keyboards/planck/ez/rules.mk @@ -13,7 +13,7 @@ BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration MOUSEKEY_ENABLE = yes # Mouse keys EXTRAKEY_ENABLE = yes # Audio control and System control CONSOLE_ENABLE = yes # Console for debug -COMMAND_ENABLE = yes # Commands for debug and configuration +COMMAND_ENABLE = no # Commands for debug and configuration #SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend NKRO_ENABLE = yes # USB Nkey Rollover CUSTOM_MATRIX = no # Custom matrix file -- cgit v1.2.3 From 468290f37331bb74b49639316e36dec267c23bfe Mon Sep 17 00:00:00 2001 From: Florian Didron Date: Tue, 3 Sep 2019 10:20:24 +0900 Subject: chore: set CONSOLE_ENABLE = no --- keyboards/planck/ez/rules.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keyboards/planck/ez/rules.mk b/keyboards/planck/ez/rules.mk index 93f8ade95b..e8a7f3115c 100644 --- a/keyboards/planck/ez/rules.mk +++ b/keyboards/planck/ez/rules.mk @@ -12,7 +12,7 @@ BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration ## (Note that for BOOTMAGIC on Teensy LC you have to use a custom .ld script.) MOUSEKEY_ENABLE = yes # Mouse keys EXTRAKEY_ENABLE = yes # Audio control and System control -CONSOLE_ENABLE = yes # Console for debug +CONSOLE_ENABLE = no # Console for debug COMMAND_ENABLE = no # Commands for debug and configuration #SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend NKRO_ENABLE = yes # USB Nkey Rollover -- cgit v1.2.3 From fc8a27497f0b38568beb87c32591300eda0d13e2 Mon Sep 17 00:00:00 2001 From: Drashna Jael're Date: Thu, 12 Sep 2019 12:14:59 -0700 Subject: Re-Add TAB and Non-US Backslash to special charactcetr range for AutoShift --- quantum/process_keycode/process_auto_shift.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/quantum/process_keycode/process_auto_shift.c b/quantum/process_keycode/process_auto_shift.c index ccec2d3075..5970242263 100644 --- a/quantum/process_keycode/process_auto_shift.c +++ b/quantum/process_keycode/process_auto_shift.c @@ -117,7 +117,9 @@ bool process_auto_shift(uint16_t keycode, keyrecord_t *record) { case KC_1 ... KC_0: #endif #ifndef NO_AUTO_SHIFT_SPECIAL + case KC_TAB: case KC_MINUS ... KC_SLASH: + case KC_NONUS_BSLASH: #endif autoshift_flush(); -- cgit v1.2.3