diff options
| author | fauxpark <fauxpark@gmail.com> | 2019-11-02 13:06:03 +1100 |
|---|---|---|
| committer | Drashna Jaelre <drashna@live.com> | 2019-11-01 19:06:03 -0700 |
| commit | e6cc9cc78d40af1386f9a116d5fcc95c20233110 (patch) | |
| tree | 080b4535f47cc19cbe7d5221d0909b2a9ee76f5c | |
| parent | 1f6cb53fb34867827c487e523f7134bab1acab04 (diff) | |
| download | qmk_firmware-e6cc9cc78d40af1386f9a116d5fcc95c20233110.tar.gz qmk_firmware-e6cc9cc78d40af1386f9a116d5fcc95c20233110.zip | |
Template updates (#7221)
* Template updates
* Flesh out info.json & keymap.c, and turn double spaces section into a list
* Add enum to demonstrate layer naming
* Semicolon
| -rw-r--r-- | quantum/template/avr/readme.md | 6 | ||||
| -rw-r--r-- | quantum/template/avr/rules.mk | 1 | ||||
| -rw-r--r-- | quantum/template/base/info.json | 18 | ||||
| -rw-r--r-- | quantum/template/base/keyboard.c (renamed from quantum/template/avr/keyboard.c) | 25 | ||||
| -rw-r--r-- | quantum/template/base/keyboard.h | 7 | ||||
| -rw-r--r-- | quantum/template/base/keymaps/default/keymap.c | 19 | ||||
| -rw-r--r-- | quantum/template/ps2avrgb/keyboard.c | 52 | ||||
| -rw-r--r-- | quantum/template/ps2avrgb/readme.md | 6 | ||||
| -rw-r--r-- | quantum/template/ps2avrgb/rules.mk | 18 | ||||
| -rwxr-xr-x | util/new_keyboard.sh | 2 |
10 files changed, 69 insertions, 85 deletions
diff --git a/quantum/template/avr/readme.md b/quantum/template/avr/readme.md index 719222d37..0430dd0fc 100644 --- a/quantum/template/avr/readme.md +++ b/quantum/template/avr/readme.md | |||
| @@ -4,9 +4,9 @@ | |||
| 4 | 4 | ||
| 5 | A short description of the keyboard/project | 5 | A short description of the keyboard/project |
| 6 | 6 | ||
| 7 | Keyboard Maintainer: [%YOUR_NAME%](https://github.com/yourusername) | 7 | * Keyboard Maintainer: [%YOUR_NAME%](https://github.com/yourusername) |
| 8 | Hardware Supported: The PCBs, controllers supported | 8 | * Hardware Supported: The PCBs, controllers supported |
| 9 | Hardware Availability: links to where you can find this hardware | 9 | * Hardware Availability: Links to where you can find this hardware |
| 10 | 10 | ||
| 11 | Make example for this keyboard (after setting up your build environment): | 11 | Make example for this keyboard (after setting up your build environment): |
| 12 | 12 | ||
diff --git a/quantum/template/avr/rules.mk b/quantum/template/avr/rules.mk index bb2bd14f9..ea0c83c68 100644 --- a/quantum/template/avr/rules.mk +++ b/quantum/template/avr/rules.mk | |||
| @@ -13,6 +13,7 @@ BOOTLOADER = atmel-dfu | |||
| 13 | 13 | ||
| 14 | # If you don't know the bootloader type, then you can specify the | 14 | # If you don't know the bootloader type, then you can specify the |
| 15 | # Boot Section Size in *bytes* by uncommenting out the OPT_DEFS line | 15 | # Boot Section Size in *bytes* by uncommenting out the OPT_DEFS line |
| 16 | # Otherwise, delete this section | ||
| 16 | # Teensy halfKay 512 | 17 | # Teensy halfKay 512 |
| 17 | # Teensy++ halfKay 1024 | 18 | # Teensy++ halfKay 1024 |
| 18 | # Atmel DFU loader 4096 | 19 | # Atmel DFU loader 4096 |
diff --git a/quantum/template/base/info.json b/quantum/template/base/info.json index e69de29bb..b8e8f1f2d 100644 --- a/quantum/template/base/info.json +++ b/quantum/template/base/info.json | |||
| @@ -0,0 +1,18 @@ | |||
| 1 | { | ||
| 2 | "keyboard_name": "%KEYBOARD%", | ||
| 3 | "url": "", | ||
| 4 | "maintainer": "%YOUR_NAME%", | ||
| 5 | "width": 3, | ||
| 6 | "height": 2, | ||
| 7 | "layouts": { | ||
| 8 | "LAYOUT": { | ||
| 9 | "layout": [ | ||
| 10 | {"label":"k00", "x":0, "y":0}, | ||
| 11 | {"label":"k01", "x":1, "y":0}, | ||
| 12 | {"label":"k02", "x":2, "y":0}, | ||
| 13 | {"label":"k10", "x":0, "y":1, "w":1.5}, | ||
| 14 | {"label":"k12", "x":1.5, "y":1, "w":1.5} | ||
| 15 | ] | ||
| 16 | } | ||
| 17 | } | ||
| 18 | } | ||
diff --git a/quantum/template/avr/keyboard.c b/quantum/template/base/keyboard.c index e852a42c4..55e4fffd3 100644 --- a/quantum/template/avr/keyboard.c +++ b/quantum/template/base/keyboard.c | |||
| @@ -13,6 +13,7 @@ | |||
| 13 | * You should have received a copy of the GNU General Public License | 13 | * You should have received a copy of the GNU General Public License |
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 | */ | 15 | */ |
| 16 | |||
| 16 | #include "%KEYBOARD%.h" | 17 | #include "%KEYBOARD%.h" |
| 17 | 18 | ||
| 18 | // Optional override functions below. | 19 | // Optional override functions below. |
| @@ -20,32 +21,30 @@ | |||
| 20 | // These are only required if you want to perform custom actions. | 21 | // These are only required if you want to perform custom actions. |
| 21 | 22 | ||
| 22 | /* | 23 | /* |
| 23 | |||
| 24 | void matrix_init_kb(void) { | 24 | void matrix_init_kb(void) { |
| 25 | // put your keyboard start-up code here | 25 | // put your keyboard start-up code here |
| 26 | // runs once when the firmware starts up | 26 | // runs once when the firmware starts up |
| 27 | 27 | ||
| 28 | matrix_init_user(); | 28 | matrix_init_user(); |
| 29 | } | 29 | } |
| 30 | 30 | ||
| 31 | void matrix_scan_kb(void) { | 31 | void matrix_scan_kb(void) { |
| 32 | // put your looping keyboard code here | 32 | // put your looping keyboard code here |
| 33 | // runs every cycle (a lot) | 33 | // runs every cycle (a lot) |
| 34 | 34 | ||
| 35 | matrix_scan_user(); | 35 | matrix_scan_user(); |
| 36 | } | 36 | } |
| 37 | 37 | ||
| 38 | bool process_record_kb(uint16_t keycode, keyrecord_t *record) { | 38 | bool process_record_kb(uint16_t keycode, keyrecord_t *record) { |
| 39 | // put your per-action keyboard code here | 39 | // put your per-action keyboard code here |
| 40 | // runs for every action, just before processing by the firmware | 40 | // runs for every action, just before processing by the firmware |
| 41 | 41 | ||
| 42 | return process_record_user(keycode, record); | 42 | return process_record_user(keycode, record); |
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | void led_set_kb(uint8_t usb_led) { | 45 | void led_set_kb(uint8_t usb_led) { |
| 46 | // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here | 46 | // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here |
| 47 | 47 | ||
| 48 | led_set_user(usb_led); | 48 | led_set_user(usb_led); |
| 49 | } | 49 | } |
| 50 | |||
| 51 | */ | 50 | */ |
diff --git a/quantum/template/base/keyboard.h b/quantum/template/base/keyboard.h index 2e531b1fd..8a21d9257 100644 --- a/quantum/template/base/keyboard.h +++ b/quantum/template/base/keyboard.h | |||
| @@ -13,11 +13,12 @@ | |||
| 13 | * You should have received a copy of the GNU General Public License | 13 | * You should have received a copy of the GNU General Public License |
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 | */ | 15 | */ |
| 16 | |||
| 16 | #pragma once | 17 | #pragma once |
| 17 | 18 | ||
| 18 | #include "quantum.h" | 19 | #include "quantum.h" |
| 19 | 20 | ||
| 20 | /* This a shortcut to help you visually see your layout. | 21 | /* This is a shortcut to help you visually see your layout. |
| 21 | * | 22 | * |
| 22 | * The first section contains all of the arguments representing the physical | 23 | * The first section contains all of the arguments representing the physical |
| 23 | * layout of the board and position of the keys. | 24 | * layout of the board and position of the keys. |
| @@ -27,9 +28,9 @@ | |||
| 27 | */ | 28 | */ |
| 28 | #define LAYOUT( \ | 29 | #define LAYOUT( \ |
| 29 | k00, k01, k02, \ | 30 | k00, k01, k02, \ |
| 30 | k10, k11 \ | 31 | k10, k12 \ |
| 31 | ) \ | 32 | ) \ |
| 32 | { \ | 33 | { \ |
| 33 | { k00, k01, k02 }, \ | 34 | { k00, k01, k02 }, \ |
| 34 | { k10, KC_NO, k11 }, \ | 35 | { k10, KC_NO, k12 } \ |
| 35 | } | 36 | } |
diff --git a/quantum/template/base/keymaps/default/keymap.c b/quantum/template/base/keymaps/default/keymap.c index 3508055b7..4d5bac7b2 100644 --- a/quantum/template/base/keymaps/default/keymap.c +++ b/quantum/template/base/keymaps/default/keymap.c | |||
| @@ -15,6 +15,12 @@ | |||
| 15 | */ | 15 | */ |
| 16 | #include QMK_KEYBOARD_H | 16 | #include QMK_KEYBOARD_H |
| 17 | 17 | ||
| 18 | // Defines names for use in layer keycodes and the keymap | ||
| 19 | enum layer_names { | ||
| 20 | _BASE, | ||
| 21 | _FN | ||
| 22 | }; | ||
| 23 | |||
| 18 | // Defines the keycodes used by our macros in process_record_user | 24 | // Defines the keycodes used by our macros in process_record_user |
| 19 | enum custom_keycodes { | 25 | enum custom_keycodes { |
| 20 | QMKBEST = SAFE_RANGE, | 26 | QMKBEST = SAFE_RANGE, |
| @@ -22,10 +28,15 @@ enum custom_keycodes { | |||
| 22 | }; | 28 | }; |
| 23 | 29 | ||
| 24 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | 30 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { |
| 25 | [0] = LAYOUT( /* Base */ | 31 | /* Base */ |
| 26 | KC_A, KC_1, KC_H, | 32 | [_BASE] = LAYOUT( |
| 27 | KC_TAB, KC_SPC | 33 | KC_A, KC_1, MO(_FN), |
| 34 | KC_TAB, KC_SPC | ||
| 28 | ), | 35 | ), |
| 36 | [_FN] = LAYOUT( | ||
| 37 | QMKBEST, QMKURL, _______, | ||
| 38 | RESET, XXXXXXX | ||
| 39 | ) | ||
| 29 | }; | 40 | }; |
| 30 | 41 | ||
| 31 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | 42 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { |
| @@ -50,6 +61,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 50 | return true; | 61 | return true; |
| 51 | } | 62 | } |
| 52 | 63 | ||
| 64 | /* | ||
| 53 | void matrix_init_user(void) { | 65 | void matrix_init_user(void) { |
| 54 | 66 | ||
| 55 | } | 67 | } |
| @@ -61,3 +73,4 @@ void matrix_scan_user(void) { | |||
| 61 | void led_set_user(uint8_t usb_led) { | 73 | void led_set_user(uint8_t usb_led) { |
| 62 | 74 | ||
| 63 | } | 75 | } |
| 76 | */ | ||
diff --git a/quantum/template/ps2avrgb/keyboard.c b/quantum/template/ps2avrgb/keyboard.c deleted file mode 100644 index 73cd668f8..000000000 --- a/quantum/template/ps2avrgb/keyboard.c +++ /dev/null | |||
| @@ -1,52 +0,0 @@ | |||
| 1 | /* Copyright %YEAR% %YOUR_NAME% | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #include "%KEYBOARD%.h" | ||
| 18 | |||
| 19 | // Optional override functions below. | ||
| 20 | // You can leave any or all of these undefined. | ||
| 21 | // These are only required if you want to perform custom actions. | ||
| 22 | |||
| 23 | /* | ||
| 24 | |||
| 25 | void matrix_init_kb(void) { | ||
| 26 | // put your keyboard start-up code here | ||
| 27 | // runs once when the firmware starts up | ||
| 28 | |||
| 29 | matrix_init_user(); | ||
| 30 | } | ||
| 31 | |||
| 32 | void matrix_scan_kb(void) { | ||
| 33 | // put your looping keyboard code here | ||
| 34 | // runs every cycle (a lot) | ||
| 35 | |||
| 36 | matrix_scan_user(); | ||
| 37 | } | ||
| 38 | |||
| 39 | bool process_record_kb(uint16_t keycode, keyrecord_t *record) { | ||
| 40 | // put your per-action keyboard code here | ||
| 41 | // runs for every action, just before processing by the firmware | ||
| 42 | |||
| 43 | return process_record_user(keycode, record); | ||
| 44 | } | ||
| 45 | |||
| 46 | void led_set_kb(uint8_t usb_led) { | ||
| 47 | // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here | ||
| 48 | |||
| 49 | led_set_user(usb_led); | ||
| 50 | } | ||
| 51 | |||
| 52 | */ | ||
diff --git a/quantum/template/ps2avrgb/readme.md b/quantum/template/ps2avrgb/readme.md index 3dce0e950..b45ef91c9 100644 --- a/quantum/template/ps2avrgb/readme.md +++ b/quantum/template/ps2avrgb/readme.md | |||
| @@ -4,9 +4,9 @@ | |||
| 4 | 4 | ||
| 5 | A short description of the keyboard/project | 5 | A short description of the keyboard/project |
| 6 | 6 | ||
| 7 | Keyboard Maintainer: [%YOUR_NAME%](https://github.com/yourusername) | 7 | * Keyboard Maintainer: [%YOUR_NAME%](https://github.com/yourusername) |
| 8 | Hardware Supported: The PCBs, controllers supported | 8 | * Hardware Supported: The PCBs, controllers supported |
| 9 | Hardware Availability: links to where you can find this hardware | 9 | * Hardware Availability: links to where you can find this hardware |
| 10 | 10 | ||
| 11 | Make example for this keyboard (after setting up your build environment): | 11 | Make example for this keyboard (after setting up your build environment): |
| 12 | 12 | ||
diff --git a/quantum/template/ps2avrgb/rules.mk b/quantum/template/ps2avrgb/rules.mk index ec57b03dc..b9b81a675 100644 --- a/quantum/template/ps2avrgb/rules.mk +++ b/quantum/template/ps2avrgb/rules.mk | |||
| @@ -11,14 +11,16 @@ MCU = atmega32a | |||
| 11 | # ATmega328P USBasp | 11 | # ATmega328P USBasp |
| 12 | BOOTLOADER = bootloadHID | 12 | BOOTLOADER = bootloadHID |
| 13 | 13 | ||
| 14 | # build options | 14 | # Build Options |
| 15 | BOOTMAGIC_ENABLE = no | 15 | # change yes to no to disable |
| 16 | MOUSEKEY_ENABLE = no | 16 | # |
| 17 | EXTRAKEY_ENABLE = yes | 17 | BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration |
| 18 | CONSOLE_ENABLE = yes | 18 | MOUSEKEY_ENABLE = no # Mouse keys |
| 19 | COMMAND_ENABLE = yes | 19 | EXTRAKEY_ENABLE = yes # Audio control and System control |
| 20 | BACKLIGHT_ENABLE = no | 20 | CONSOLE_ENABLE = yes # Console for debug |
| 21 | RGBLIGHT_ENABLE = yes | 21 | COMMAND_ENABLE = yes # Commands for debug and configuration |
| 22 | BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality | ||
| 23 | RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow | ||
| 22 | WS2812_DRIVER = i2c | 24 | WS2812_DRIVER = i2c |
| 23 | 25 | ||
| 24 | OPT_DEFS = -DDEBUG_LEVEL=0 | 26 | OPT_DEFS = -DDEBUG_LEVEL=0 |
diff --git a/util/new_keyboard.sh b/util/new_keyboard.sh index fe7c1a829..11c6497e2 100755 --- a/util/new_keyboard.sh +++ b/util/new_keyboard.sh | |||
| @@ -86,6 +86,7 @@ replace_year_placeholders() { | |||
| 86 | replace_keyboard_placeholders() { | 86 | replace_keyboard_placeholders() { |
| 87 | local replace_keyboard_filenames=( | 87 | local replace_keyboard_filenames=( |
| 88 | "${keyboard_dir}/config.h" | 88 | "${keyboard_dir}/config.h" |
| 89 | "${keyboard_dir}/info.json" | ||
| 89 | "${keyboard_dir}/readme.md" | 90 | "${keyboard_dir}/readme.md" |
| 90 | "${keyboard_dir}/${keyboard_name}.c" | 91 | "${keyboard_dir}/${keyboard_name}.c" |
| 91 | "${keyboard_dir}/keymaps/default/readme.md" | 92 | "${keyboard_dir}/keymaps/default/readme.md" |
| @@ -97,6 +98,7 @@ replace_keyboard_placeholders() { | |||
| 97 | replace_name_placeholders() { | 98 | replace_name_placeholders() { |
| 98 | local replace_name_filenames=( | 99 | local replace_name_filenames=( |
| 99 | "${keyboard_dir}/config.h" | 100 | "${keyboard_dir}/config.h" |
| 101 | "${keyboard_dir}/info.json" | ||
| 100 | "${keyboard_dir}/readme.md" | 102 | "${keyboard_dir}/readme.md" |
| 101 | "${keyboard_dir}/${keyboard_name}.c" | 103 | "${keyboard_dir}/${keyboard_name}.c" |
| 102 | "${keyboard_dir}/${keyboard_name}.h" | 104 | "${keyboard_dir}/${keyboard_name}.h" |
