]> git.donarmstrong.com Git - qmk_firmware.git/commitdiff
Add avrdude split EE_HANDS flash commands (#5414)
authorDanny <nooges@users.noreply.github.com>
Fri, 15 Mar 2019 21:05:50 +0000 (17:05 -0400)
committerDrashna Jaelre <drashna@live.com>
Fri, 15 Mar 2019 21:05:50 +0000 (14:05 -0700)
* Add EEPROM avrdude flashing commands for setting handedness

* Update docs with info on flashing EEPROM handedness files with commands

docs/config_options.md
tmk_core/avr.mk

index 336feee8fd80e1e91eee8df873e424009bb8b612..a8a106459134bc04b1494b9fe759319e6c849bc0 100644 (file)
@@ -208,9 +208,13 @@ There are a few different ways to set handedness for split keyboards (listed in
 
 1. Set `SPLIT_HAND_PIN`: Reads a pin to determine handedness. If pin is high, it's the left side, if low, the half is determined to be the right side
 2. Set `EE_HANDS` and flash `eeprom-lefthand.eep`/`eeprom-righthand.eep` to each half
+   * For boards with DFU bootloader you can use `:dfu-split-left`/`:dfu-split-right` to flash these EEPROM files
+   * For boards with Caterina bootloader (like stock Pro Micros), use `:avrdude-split-left`/`:avrdude-split-right`
 3. Set `MASTER_RIGHT`: Half that is plugged into the USB port is determined to be the master and right half (inverse of the default)
 4. Default: The side that is plugged into the USB port is the master half and is assumed to be the left half. The slave side is the right half
 
+#### Defines for handedness
+
 * `#define SPLIT_HAND_PIN B7`
   * For using high/low pin to determine handedness, low = right hand, high = left hand. Replace `B7` with the pin you are using. This is optional, and if you leave `SPLIT_HAND_PIN` undefined, then you can still use the EE_HANDS method or MASTER_LEFT / MASTER_RIGHT defines like the stock Let's Split uses.
 
index 79fdf4de537160cd898deffc22d8f16c70dfad2a..bf3e269fdf3ce9eb594d4bac1bd0e7cda4388bdf 100644 (file)
@@ -223,7 +223,11 @@ define EXEC_AVRDUDE
                        printf "Waiting for $$USB to become writable."; \
                        while [ ! -w "$$USB" ]; do sleep 0.5; printf "."; done; echo ""; \
                fi; \
-               avrdude -p $(MCU) -c avr109 -P $$USB -U flash:w:$(BUILD_DIR)/$(TARGET).hex; \
+               if [ -z "$(1)" ]; then \
+                       avrdude -p $(MCU) -c avr109 -P $$USB -U flash:w:$(BUILD_DIR)/$(TARGET).hex; \
+               else \
+                       avrdude -p $(MCU) -c avr109 -P $$USB -U flash:w:$(BUILD_DIR)/$(TARGET).hex -U eeprom:w:$(QUANTUM_PATH)/split_common/$(1); \
+               fi \
        fi
 endef
 
@@ -232,9 +236,15 @@ avrdude: $(BUILD_DIR)/$(TARGET).hex check-size cpfirmware
 
 avrdude-loop: $(BUILD_DIR)/$(TARGET).hex check-size cpfirmware
        while true; do \
-           $(call EXEC_AVRDUDE) ; \
+               $(call EXEC_AVRDUDE) ; \
        done
 
+avrdude-split-left: $(BUILD_DIR)/$(TARGET).hex check-size cpfirmware
+       $(call EXEC_AVRDUDE,eeprom-lefthand.eep)
+
+avrdude-split-right: $(BUILD_DIR)/$(TARGET).hex check-size cpfirmware
+       $(call EXEC_AVRDUDE,eeprom-righthand.eep)
+
 # Convert hex to bin.
 bin: $(BUILD_DIR)/$(TARGET).hex
        $(OBJCOPY) -Iihex -Obinary $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).bin