summaryrefslogtreecommitdiff
path: root/keyboards/gherkin/keymaps/wanleg
diff options
context:
space:
mode:
authorwanleg <32079073+wanleg@users.noreply.github.com>2018-06-29 14:58:38 -0700
committerDrashna Jaelre <drashna@live.com>2018-06-29 14:58:38 -0700
commitb79c324642931a8a06cdd6251032bf66244e1c7e (patch)
tree945f7bf0383471284c83a915e9930304f9cb1efe /keyboards/gherkin/keymaps/wanleg
parent5709e1b60246d3156e495c6c7a22343a4a3b9973 (diff)
downloadqmk_firmware-b79c324642931a8a06cdd6251032bf66244e1c7e.tar.gz
qmk_firmware-b79c324642931a8a06cdd6251032bf66244e1c7e.zip
add QMK DFU make option to gherkin, and bootloader replacement instructions (#3253)
* add QMK DFU make option, bootloader replacement instructions in wanleg readme: update flashing instructions, add bootloader replacement instructions (replace default Caterina with QMK DFU). add make option for QMK DFU * suggested revisions made * formatting changes
Diffstat (limited to 'keyboards/gherkin/keymaps/wanleg')
-rw-r--r--keyboards/gherkin/keymaps/wanleg/config.h70
-rw-r--r--keyboards/gherkin/keymaps/wanleg/keymap.c2
-rw-r--r--keyboards/gherkin/keymaps/wanleg/readme.md93
-rw-r--r--keyboards/gherkin/keymaps/wanleg/rules.mk68
4 files changed, 85 insertions, 148 deletions
diff --git a/keyboards/gherkin/keymaps/wanleg/config.h b/keyboards/gherkin/keymaps/wanleg/config.h
index 84af739b27..98e2b23380 100644
--- a/keyboards/gherkin/keymaps/wanleg/config.h
+++ b/keyboards/gherkin/keymaps/wanleg/config.h
@@ -1,68 +1,24 @@
-#ifndef CONFIG_H
-#define CONFIG_H
+#ifndef CONFIG_USER_H
+#define CONFIG_USER_H
-#include "config_common.h"
-
-/* USB Device descriptor parameter */
-#define VENDOR_ID 0xFEED
-#define PRODUCT_ID 0x6060
-#define DEVICE_VER 0x0001
-#define MANUFACTURER 40 Percent Club
-#define PRODUCT Gherkin
-#define DESCRIPTION A 30 key ortholinear keyboard
-
-/* key matrix size */
-#define MATRIX_ROWS 5
-#define MATRIX_COLS 6
-
-/* key matrix pins */
-#define MATRIX_ROW_PINS { F7, B1, B3, B2, B6 }
-#define MATRIX_COL_PINS { B4, E6, D7, C6, D4, D0 }
-#define UNUSED_PINS
-
-/* COL2ROW or ROW2COL */
-#define DIODE_DIRECTION COL2ROW
-
-/* number of backlight levels */
-#define BACKLIGHT_PIN B5
-#ifdef BACKLIGHT_PIN
-#define BACKLIGHT_LEVELS 3
+#include "../../config.h"
#endif
-/* Set 0 if debouncing isn't needed */
-#define DEBOUNCING_DELAY 5
-
-/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
-#define LOCKING_SUPPORT_ENABLE
-
-/* Locking resynchronize hack */
-#define LOCKING_RESYNC_ENABLE
-
-/* key combination for command */
-#define IS_COMMAND() ( \
- keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
-)
-
-/* prevent stuck modifiers */
#define PREVENT_STUCK_MODIFIERS
-/*tap dance definition */
+//Tap Dance Prerequisite
#define TAPPING_TERM 200
//Mousekeys Settings
-#define MOUSEKEY_INTERVAL 1
+#define MOUSEKEY_INTERVAL 16
#define MOUSEKEY_DELAY 0
-#define MOUSEKEY_TIME_TO_MAX 1
-#define MOUSEKEY_MAX_SPEED 15
+#define MOUSEKEY_TIME_TO_MAX 60
+#define MOUSEKEY_MAX_SPEED 7
#define MOUSEKEY_WHEEL_DELAY 0
-
-#ifdef RGB_DI_PIN
-#define RGBLIGHT_ANIMATIONS
-#define RGBLED_NUM 0
-#define RGBLIGHT_HUE_STEP 8
-#define RGBLIGHT_SAT_STEP 8
-#define RGBLIGHT_VAL_STEP 8
-#endif
-
-#endif
+/* for QMK DFU bootloader */
+/* not required if using default ProMicro bootloader */
+/* set top left key as bootloader mode escape key */
+#define QMK_ESC_OUTPUT B4 // usually COL
+#define QMK_ESC_INPUT F7 // usually ROW
+#define QMK_LED B0 \ No newline at end of file
diff --git a/keyboards/gherkin/keymaps/wanleg/keymap.c b/keyboards/gherkin/keymaps/wanleg/keymap.c
index 95cabe133f..1e534fe6d3 100644
--- a/keyboards/gherkin/keymaps/wanleg/keymap.c
+++ b/keyboards/gherkin/keymaps/wanleg/keymap.c
@@ -153,7 +153,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* .-----------------------------------------------------------------------------------------.
* | Q//ESC | W | E | R | T | Y | U | I | O | P |
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
- * | A | S | D | F | G | H | J | K | L | ENTER |
+ * | A | S | D | F | G | H | J | K | L | SPACE |
* | | | | | | | | | |SFThold |
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
* | Z | X | C | V/NUM | B/ETC | N | M/DIR | ,/GUI | ./ALT | BKSC |
diff --git a/keyboards/gherkin/keymaps/wanleg/readme.md b/keyboards/gherkin/keymaps/wanleg/readme.md
index e147f7ab1d..bfdf56febe 100644
--- a/keyboards/gherkin/keymaps/wanleg/readme.md
+++ b/keyboards/gherkin/keymaps/wanleg/readme.md
@@ -1,9 +1,8 @@
-![Gherkin Wanleg Layout Image](https://i.imgur.com/nCPog2W.png)
-
+![Gherkin Wanleg Layout Image](https://i.imgur.com/nCPog2W.png)
# Gherkin Wanleg Layout
-Here is the layout I came up with to preserve a standard QWERTY layout as much as possible, in as few layers as possible for a 30 key board.
-I originally set up a few Tap Dance keys, but dropped half of them in favor of chorded versions, since in actual use, they tended to impede typing speed more than their current two-key versions.
-I've left them in my layout ready for use if anyone wants to try them out:
+This is the layout I came up with to preserve a standard QWERTY 104 key ANSI layout as much as possible, in as few layers as possible for a 30 key board.
+I originally set up a few Tap Dance keys, but dropped half of them in favor of chorded versions since in actual use, they tended to impede typing speed more than their current two-key versions.
+I've left them in my `keymap.c` ready for use if anyone wants to try them out:
Legend Name | Single Tap | Double Tap | Hold
--- | --- | --- | ---
@@ -13,35 +12,73 @@ Sft//Cp | shift | caps lock | *null*
Q//Esc | KC_Q | escape | *null*
# Gherkin Flashing
-## Linux
-The ProMicro doesn't like dfu-programmer, so we have to use AVRdude. What follows below are instructions for Linux taken from https://deskthority.net/workshop-f7/how-to-use-a-pro-micro-as-a-cheap-controller-converter-like-soarer-s-t8448.html
-
-`ls /dev/tty*`
+## Windows
+1. The standard Gherkin uses a ProMicro (or clone) microcontroller, which has the Caterina bootloader by default.
+2. If you have never flashed your ProMicro with QMK before, you will need to short the RST pin to GND to put it into bootloader mode (you only have 7 seconds to flash once it enters bootloader mode). You may need to touch the RST pin to GND **TWICE** in quick succession if it doesn't flash with just one touch.
+3. Once connected to your computer, you should be able to flash using
+`make gherkin:wanleg:avrdude`
+4. Once you've been able to successfully flash the ProMicro, you should be able to use the `RESET` key for future flashes instead of shorting the RST pin.
-Next, plug in your device and re-run the command, the same as before:
+## Linux
+### First Flash with QMK
+The built-in `:avrdude` QMK target in Linux doesn't work with the default Caterina bootloader on the ProMicro, so we have to use avrdude separately. The instructions below are adapted from https://deskthority.net/workshop-f7/how-to-use-a-pro-micro-as-a-cheap-controller-converter-like-soarer-s-t8448.html
+1. To flash the device, you need to have AVRdude installed. You can do this via your distro's package manager (or compile from source if needed).
+2. Once avrdude has been installed, open a terminal and run
`ls /dev/tty*`
+3. Next, plug in your device and re-run `ls /dev/tty*`
+There should be one more device than was seen previously. Make a note of it. For me, it's `/dev/ttyACM0`.
+4. Navigate to the directory with your `.hex` file in it. Touch the RST pin to GND **TWICE** in quick succession, then run the following within 7 seconds:
+`sudo avrdude -p m32u4 -P YOUR_SERIAL_PORT -c avr109 -U flash:w:YOUR_FILENAME.hex`
+Replace YOUR_SERIAL_PORT with your serial port's device name, and YOUR_FILENAME.hex with the appropriate filename. For me, it looks like this:
+`sudo avrdude -p m32u4 -P /dev/ttyACM0 -c avr109 -U flash:w:gherkin_wanleg.hex`
+If you miss the 7 second window, the ProMicro will leave bootloader mode and the flash will fail. Hit `Control` + `C` to exit the `avrdude` command, connect RST to GND twice quickly, and try the `avrdude` command again.
-There should be one more output device than was seen previously. For me, it's /dev/ttyACM0.
-To flash the device, you need to have AVRdude installed. On Linux, you can do this with your normal package manager.
-Once you have AVRdude set up, navigate to the directory with your .hex file in it. Then, run the following:
-
-`avrdude -p atmega32u4 -P YOUR_SERIAL_PORT -c avr109 -U flash:w:YOUR_FILENAME.hex`
-
-Of course, replace YOUR_SERIAL_PORT with your serial port's device name, and YOUR_FILENAME.hex with the appropriate filename. For me, this line looks like this:
+### Subsequent Flashes with QMK
+1. Re-flashing is similar to the initial flash procedure. Plug in your keyboard, open a terminal and run
+`ls /dev/tty*`
+2. Next, hit the `RESET` key on your keyboard and re-run the `ls /dev/tty*` command to find your keyboard's serial port.
+3. Flash your keyboard with the avrdude command you used for the initial flash within 7 seconds after hitting `RESET`.
-`avrdude -p atmega32u4 -P /dev/ttyACM0 -c avr109 -U flash:w:Soarer_at2usb_v1.12_atmega32u4.hex`
+# ProMicro Bootloader Replacement (Caterina to QMK DFU)
+If you have an Arduino (or clone), you can replace the bootloader for a few extra features (e.g. no more 7 second "flash window", simplified Linux flashing, blinking LED when the ProMicro is in bootloader mode, ability to exit bootloader mode without unplugging your keyboard, among others).
+The instructions below have been adapted from https://www.reddit.com/r/olkb/comments/8sxgzb/replace_pro_micro_bootloader_with_qmk_dfu/)
+## Arduino Setup
+1. Upload the ArduinoISP sketch onto your Arduino board (https://www.arduino.cc/en/Tutorial/ArduinoISP).
+2. Wire the Arduino to the ProMicro
-If it says ''device not in sync'' or similar, your device is no longer in bootloader mode. Unplug it, and get it back into bootloader mode like you did in the previous step (or short the reset pin), and try again.
-If this still doesn't work, try running the command again as root
+| Arduino | ProMicro |
+| --- | --- |
+| 10 | RST |
+| 11 | 16 |
+| 12 | 14 |
+| 13 | 15 |
+| GND | GND |
+| 5V | VCC |
-`sudo avrdude -p atmega32u4 -P /dev/ttyACM0 -c avr109 -U flash:w:Soarer_at2usb_v1.12_atmega32u4.hex`
+## Make the QMK DFU .hex
+3. In `config.h` add the following. This is already set up in `qmk_firmware/keyboards/gherkin/wanleg`. You only need to do this on other keymaps.
+```
+#define QMK_ESC_OUTPUT B4
+#define QMK_ESC_INPUT F7
+#define QMK_LED B0
+```
+The `QMK_ESC_` lines define where the bootloader escape key is. Refer to the `MATRIX_ROW_PINS` and `MATRIX_COL_PINS` lines in your keyboard's `config.h` to choose your preferred key.
+You hit the bootloader escape key to exit bootloader mode after you've hit the RESET key to enter bootloader mode (e.g. if you change your mind and don't want to flash just then).
+On a Gherkin, B4/F7 corresponds to the top-left corner key.
+`B0` is an indicator light on one of the ProMicro's onboard LEDs. With QMK DFU, it will flash to indicate the ProMicro is in bootloader mode.
+You can add `#define QMK_SPEAKER C6` if you have a speaker hooked up to pin C6. The Gherkin PCB already uses pin C6 in its switch layout, so you cannot use a speaker on a standard Gherkin.
+4. Also, you should add `BOOTLOADER = qmk-dfu` to your `rules.mk` file, so it is flagged properly. Again, this is already set up in `qmk_firmware/keyboards/gherkin/wanleg`.
+5. Once you've made the required edits, it's time to compile the firmware. If you use the `:production` target when compiling, it will produce the usual `.hex` file as well as `_bootloader.hex` and `_production.hex` files. The `_production.hex` will be what we want. This contains the bootloader and the firmware, so we only have to flash once (rather than flash the bootloader, and THEN flash the firmware).
+For example:
+`make gherkin/qmkdfu:wanleg:production`
-## Windows
-1. Install the latest version of AVRdude for Windows from http://savannah.nongnu.org/projects/avrdude/
-Test that it installed correctly by running "avrdude" from Command Prompt. It should display a usage message with version information at the end
-2. Open Device Manager and take a look at your "Ports (COM & LPT)" section
-3. Plug in the Gherkin and short the RESET pin on the microcontroller to Ground to put it into bootloader mode. Take note of the new COM device that shows up. After 8 seconds or so the microcontroller will leave bootloader mode and it will disappear from that section
-4. Open Command Prompt and run the following (substituting "com7" with whatever port you saw earlier)
+## Burn QMK DFU
+6. Navigate to the directory with your `_production.hex` file, and burn it with the following command
+`avrdude -b 19200 -c avrisp -p m32u4 -v -e -U lock:w:0x3F:m -U efuse:w:0xC3:m -U hfuse:w:0xD9:m -U lfuse:w:0x5E:m -U YOUR_production.hex -P comPORT`
+Change `comPORT` to whatever port is used by the Arduino (e.g. `com11` in Windows or `/dev/ttyACM0` in Linux). Use Device Manager in Windows to find the port being used. Use `ls /dev/tty*` in Linux. Change `YOUR_production.hex` to whatever you've created in the previous step.
-`avrdude -p atmega32u4 -P com7 -c avr109 -U flash:w:YOURHEX.hex`
+## Using QMK DFU
+7. Once QMK DFU is burned to your ProMicro, you can then flash subsequent hex files with
+`make gherkin:<keymap>:dfu dfu=qmk`
+The `dfu=qmk` conditional will set `BOOTLOADER = qmk-dfu` instead of `BOOTLOADER = caterina`
diff --git a/keyboards/gherkin/keymaps/wanleg/rules.mk b/keyboards/gherkin/keymaps/wanleg/rules.mk
index 06e66c16ed..7f2ff33277 100644
--- a/keyboards/gherkin/keymaps/wanleg/rules.mk
+++ b/keyboards/gherkin/keymaps/wanleg/rules.mk
@@ -1,63 +1,7 @@
-# MCU name
-MCU = atmega32u4
+TAP_DANCE_ENABLE = yes # Enable Tap Dance (comment if not being implemented)
-# 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
-# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
-# automatically to create a 32-bit value in your source code.
-#
-# This will be an integer division of F_USB below, as it is sourced by
-# F_USB after it has run through any CPU prescalers. Note that this value
-# does not *change* the processor frequency - it should merely be updated to
-# reflect the processor speed set externally so that the code can use accurate
-# software delays.
-F_CPU = 16000000
-
-#
-# LUFA specific
-#
-# Target architecture (see library "Board Types" documentation).
-ARCH = AVR8
-
-# Input clock frequency.
-# This will define a symbol, F_USB, in all source code files equal to the
-# input clock frequency (before any prescaling is performed) in Hz. This value may
-# differ from F_CPU if prescaling is used on the latter, and is required as the
-# raw input clock is fed directly to the PLL sections of the AVR for high speed
-# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
-# at the end, this will be done automatically to create a 32-bit value in your
-# source code.
-#
-# If no clock division is performed on the input clock inside the AVR (via the
-# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
-F_USB = $(F_CPU)
-
-# Interrupt driven control endpoint task(+60)
-OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
-
-
-# Boot Section Size in *bytes*
-OPT_DEFS += -DBOOTLOADER_SIZE=4096
-
-# Bootloader
-# This definition is optional, and if your keyboard supports multiple bootloaders of
-# different sizes, comment this out, and the correct address will be loaded
-# automatically (+60). See bootloader.mk for all options.
-BOOTLOADER = caterina
-
-
-# Build Options
-# comment out to disable the options.
-#
-BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
-MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
-EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
-CONSOLE_ENABLE = no # Console for debug(+400)
-COMMAND_ENABLE = no # Commands for debug and configuration
-SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
-NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
-BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
-AUDIO_ENABLE = no
-RGBLIGHT_ENABLE = no
-TAP_DANCE_ENABLE = yes # Enable Tap Dance (comment if not being implemented) \ No newline at end of file
+#If ProMicro has QMK DFU bootloader instead of Caterina,
+#run "make <keyboard>:<keymap> dfu=qmk" when compiling to ensure it is flagged properly after being flashed
+ifeq ($(strip $(dfu)), qmk)
+ BOOTLOADER = qmk-dfu
+endif \ No newline at end of file