Skip to content

Commit

Permalink
ARM split - Add support for dfu-util EE_HANDS flashing (qmk#6543)
Browse files Browse the repository at this point in the history
* Initial stab at some fake dfu-util-split-left behaviour

* Apply suggestions from code review

Co-Authored-By: fauxpark <fauxpark@gmail.com>

* Clang format fixes

* Fake eeprom init for both left and right hand
  • Loading branch information
zvecr authored and drashna committed Oct 5, 2019
1 parent a5d07e9 commit 70d4956
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tmk_core/chibios.mk
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,21 @@ dfu-util: $(BUILD_DIR)/$(TARGET).bin cpfirmware sizeafter
# Legacy alias
dfu-util-wait: dfu-util

# TODO: Remove once ARM has a way to configure EECONFIG_HANDEDNESS
# within the emulated eeprom via dfu-util or another tool
ifneq (,$(filter $(MAKECMDGOALS),dfu-util-split-left))
OPT_DEFS += -DINIT_EE_HANDS_LEFT
endif

ifneq (,$(filter $(MAKECMDGOALS),dfu-util-split-right))
OPT_DEFS += -DINIT_EE_HANDS_RIGHT
endif

dfu-util-split-left: dfu-util

dfu-util-split-right: 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

Expand Down
10 changes: 10 additions & 0 deletions tmk_core/common/eeconfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,16 @@ void eeconfig_init_quantum(void) {
eeprom_update_dword(EECONFIG_RGB_MATRIX, 0);
eeprom_update_byte(EECONFIG_RGB_MATRIX_SPEED, 0);

// TODO: Remove once ARM has a way to configure EECONFIG_HANDEDNESS
// within the emulated eeprom via dfu-util or another tool
#if defined INIT_EE_HANDS_LEFT
#pragma message "Faking EE_HANDS for left hand"
eeprom_update_byte(EECONFIG_HANDEDNESS, 1);
#elif defined INIT_EE_HANDS_RIGHT
#pragma message "Faking EE_HANDS for right hand"
eeprom_update_byte(EECONFIG_HANDEDNESS, 0);
#endif

eeconfig_init_kb();
}

Expand Down

0 comments on commit 70d4956

Please sign in to comment.