From 7b018f097db2d219908f74eb7a406ae5f7f93f46 Mon Sep 17 00:00:00 2001
From: Nick Brassel
Date: Wed, 22 Dec 2021 05:44:47 +1100
Subject: Use the PR title rather than parsing the commit message. (#15537)
---
lib/python/qmk/cli/generate/develop_pr_list.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'lib/python/qmk/cli')
diff --git a/lib/python/qmk/cli/generate/develop_pr_list.py b/lib/python/qmk/cli/generate/develop_pr_list.py
index 07e46752a6..fab0262773 100755
--- a/lib/python/qmk/cli/generate/develop_pr_list.py
+++ b/lib/python/qmk/cli/generate/develop_pr_list.py
@@ -97,7 +97,7 @@ def generate_develop_pr_list(cli):
match = git_expr.search(line)
if match:
pr_info = _get_pr_info(cache, gh, match.group("pr"))
- commit_info = {'hash': match.group("hash"), 'title': match.group("title"), 'pr_num': int(match.group("pr")), 'pr_labels': [label.name for label in pr_info.labels.items]}
+ commit_info = {'hash': match.group("hash"), 'title': pr_info['title'], 'pr_num': int(match.group("pr")), 'pr_labels': [label.name for label in pr_info.labels.items]}
_categorise_commit(commit_info)
def _dump_commit_list(name, collection):
--
cgit v1.2.3
From c72ed7c02473dec4da6cb263c1e0fb2ca4856b94 Mon Sep 17 00:00:00 2001
From: Ryan
Date: Mon, 17 Jan 2022 08:44:34 +1100
Subject: CLI: Parse USB device version BCD (#14580)
* CLI: Parse USB device version BCD
* Apply suggestions---
data/mappings/info_config.json | 2 ++
data/schemas/definitions.jsonschema | 10 +++++++---
data/schemas/keyboard.jsonschema | 3 ++-
docs/reference_info_json.md | 6 ++++--
keyboards/40percentclub/25/config.h | 6 +++---
keyboards/40percentclub/5x5/config.h | 6 +++---
keyboards/40percentclub/6lit/config.h | 6 +++---
keyboards/40percentclub/foobar/config.h | 6 +++---
keyboards/40percentclub/half_n_half/config.h | 6 +++---
keyboards/boston_meetup/2019/config.h | 2 +-
keyboards/capsunlocked/cu80/v2_ansi/info.json | 2 +-
keyboards/capsunlocked/cu80/v2_iso/info.json | 2 +-
keyboards/clueboard/17/info.json | 2 +-
keyboards/clueboard/2x1800/2019/info.json | 2 +-
keyboards/clueboard/60/info.json | 2 +-
keyboards/clueboard/66/rev1/info.json | 2 +-
keyboards/clueboard/66/rev2/info.json | 2 +-
keyboards/clueboard/66/rev3/info.json | 2 +-
keyboards/clueboard/66/rev4/info.json | 2 +-
keyboards/clueboard/66_hotswap/gen1/info.json | 2 +-
keyboards/clueboard/66_hotswap/prototype/info.json | 2 +-
keyboards/clueboard/card/info.json | 2 +-
keyboards/clueboard/info.json | 2 +-
keyboards/coarse/ixora/config.h | 2 +-
keyboards/coarse/vinta/config.h | 2 +-
keyboards/cybergear/macro25/info.json | 2 +-
keyboards/dyz/dyz60/info.json | 2 +-
keyboards/ez_maker/directpins/promicro/info.json | 2 +-
keyboards/ez_maker/directpins/proton_c/info.json | 2 +-
keyboards/ez_maker/directpins/teensy_2/info.json | 2 +-
keyboards/ez_maker/directpins/teensy_2pp/info.json | 2 +-
keyboards/ez_maker/directpins/teensy_32/info.json | 2 +-
keyboards/ez_maker/directpins/teensy_lc/info.json | 2 +-
keyboards/forever65/info.json | 2 +-
keyboards/frooastboard/info.json | 2 +-
keyboards/handwired/qc60/config.h | 2 +-
keyboards/lets_split_eh/config.h | 2 +-
keyboards/ramonimbao/squishytkl/config.h | 2 +-
keyboards/spacetime/config.h | 2 +-
keyboards/tempo_turtle/bradpad/info.json | 2 +-
lib/python/qmk/cli/generate/config_h.py | 6 ++++++
lib/python/qmk/info.py | 21 +++++++++++++++++++++
42 files changed, 88 insertions(+), 52 deletions(-)
(limited to 'lib/python/qmk/cli')
diff --git a/data/mappings/info_config.json b/data/mappings/info_config.json
index 3cb64dd3a2..cfe8807d43 100644
--- a/data/mappings/info_config.json
+++ b/data/mappings/info_config.json
@@ -15,6 +15,8 @@
"COMBO_TERM": {"info_key": "combo.term", "value_type": "int"},
"DEBOUNCE": {"info_key": "debounce", "value_type": "int"},
"DEVICE_VER": {"info_key": "usb.device_ver", "value_type": "hex"},
+ # TODO: Replace ^^^ with vvv
+ #"DEVICE_VER": {"info_key": "usb.device_version", "value_type": "bcd_version"},
"DESCRIPTION": {"info_key": "keyboard_folder", "to_json": false},
"DIODE_DIRECTION": {"info_key": "diode_direction"},
"FORCE_NKRO": {"info_key": "usb.force_nkro", "value_type": "bool"},
diff --git a/data/schemas/definitions.jsonschema b/data/schemas/definitions.jsonschema
index 822f237073..3f92e289a7 100644
--- a/data/schemas/definitions.jsonschema
+++ b/data/schemas/definitions.jsonschema
@@ -20,6 +20,10 @@
"type": "string",
"pattern": "^0x[0-9A-F]{4}$"
},
+ "bcd_version": {
+ "type": "string",
+ "pattern": "^[0-9]{1,2}\\.[0-9]\\.[0-9]$"
+ },
"text_identifier": {
"type": "string",
"minLength": 1,
@@ -70,13 +74,13 @@
"signed_int": {
"type": "number",
"multipleOf": 1
- }
+ },
"signed_int_8": {
"type": "number",
"min": -127,
"max": 127,
"multipleOf": 1
- }
+ },
"string_array": {
"type": "array",
"items": {
@@ -97,7 +101,7 @@
"type": "number",
"min": 0,
"multipleOf": 1
- }
+ },
"unsigned_int_8": {
"type": "number",
"min": 0,
diff --git a/data/schemas/keyboard.jsonschema b/data/schemas/keyboard.jsonschema
index 94bbbe7e85..f7b05d6655 100644
--- a/data/schemas/keyboard.jsonschema
+++ b/data/schemas/keyboard.jsonschema
@@ -320,7 +320,8 @@
"type": "object",
"additionalProperties": false,
"properties": {
- "device_ver": {"$ref": "qmk.definitions.v1#/hex_number_4d"},
+ "device_ver": {"$ref": "qmk.definitions.v1#/hex_number_4d"}, # Deprecated
+ "device_version": {"$ref": "qmk.definitions.v1#/bcd_version"},
"force_nkro": {"type": "boolean"},
"pid": {"$ref": "qmk.definitions.v1#/hex_number_4d"},
"vid": {"$ref": "qmk.definitions.v1#/hex_number_4d"},
diff --git a/docs/reference_info_json.md b/docs/reference_info_json.md
index b2e6cae28e..3cc807c179 100644
--- a/docs/reference_info_json.md
+++ b/docs/reference_info_json.md
@@ -172,7 +172,7 @@ The following animations can be enabled:
### USB
-Every USB keyboard needs to have its USB parmaters defined. At a minimum you need to set vid, pid, and device version.
+Every USB keyboard needs to have its USB parameters defined. At a minimum you need to set the Vendor ID, Product ID, and device version.
Example:
@@ -181,7 +181,9 @@ Example:
"usb": {
"vid": "0xC1ED",
"pid": "0x23B0",
- "device_ver": "0x0001"
+ "device_version": "1.0.0"
}
}
```
+
+The device version is a BCD (binary coded decimal) value, in the format `MMmr`, so the below value would look like `0x0100` in the generated code. This also means the maximum valid values for each part are `99.9.9`, despite it being a hexadecimal value under the hood.
diff --git a/keyboards/40percentclub/25/config.h b/keyboards/40percentclub/25/config.h
index 8ff5264671..d478131e95 100644
--- a/keyboards/40percentclub/25/config.h
+++ b/keyboards/40percentclub/25/config.h
@@ -19,9 +19,9 @@
#include "config_common.h"
/* USB Device descriptor parameter */
-#define VENDOR_ID 0x4025
-#define PRODUCT_ID 0x0A0C
-#define DEVICE_VER 0x0F25
+#define VENDOR_ID 0x4025 // 40%
+#define PRODUCT_ID 0x0F25
+#define DEVICE_VER 0x0100
#define MANUFACTURER di0ib
#define PRODUCT The 5x5 Keyboard
diff --git a/keyboards/40percentclub/5x5/config.h b/keyboards/40percentclub/5x5/config.h
index c9a83de737..c3bb5d6380 100644
--- a/keyboards/40percentclub/5x5/config.h
+++ b/keyboards/40percentclub/5x5/config.h
@@ -5,9 +5,9 @@
#include "config_common.h"
/* USB Device descriptor parameter */
-#define VENDOR_ID 0x4025
-#define PRODUCT_ID 0x0A0C
-#define DEVICE_VER 0x05B5
+#define VENDOR_ID 0x4025 // 40%
+#define PRODUCT_ID 0x05B5
+#define DEVICE_VER 0x0100
#define MANUFACTURER di0ib
#define PRODUCT The 5x5 Keyboard
diff --git a/keyboards/40percentclub/6lit/config.h b/keyboards/40percentclub/6lit/config.h
index f5c0ea3040..ae4ee1bad8 100644
--- a/keyboards/40percentclub/6lit/config.h
+++ b/keyboards/40percentclub/6lit/config.h
@@ -19,9 +19,9 @@
#include "config_common.h"
/* USB Device descriptor parameter */
-#define VENDOR_ID 0x4025
-#define PRODUCT_ID 0x0A0C
-#define DEVICE_VER 0x0F61
+#define VENDOR_ID 0x4025 // 40%
+#define PRODUCT_ID 0x0F61
+#define DEVICE_VER 0x0100
#define MANUFACTURER di0ib
#define PRODUCT The 6lit Macropad
diff --git a/keyboards/40percentclub/foobar/config.h b/keyboards/40percentclub/foobar/config.h
index a65b6e51bf..1e91d3bd10 100644
--- a/keyboards/40percentclub/foobar/config.h
+++ b/keyboards/40percentclub/foobar/config.h
@@ -19,9 +19,9 @@
#include "config_common.h"
/* USB Device descriptor parameter */
-#define VENDOR_ID 0x4025
-#define PRODUCT_ID 0x0A0C
-#define DEVICE_VER 0x0F00
+#define VENDOR_ID 0x4025 // 40%
+#define PRODUCT_ID 0x0F00
+#define DEVICE_VER 0x0100
#define MANUFACTURER di0ib
#define PRODUCT The foobar Keyboard
diff --git a/keyboards/40percentclub/half_n_half/config.h b/keyboards/40percentclub/half_n_half/config.h
index f79f83839c..0c819031da 100644
--- a/keyboards/40percentclub/half_n_half/config.h
+++ b/keyboards/40percentclub/half_n_half/config.h
@@ -20,9 +20,9 @@ along with this program. If not, see .
#include "config_common.h"
/* USB Device descriptor parameter */
-#define VENDOR_ID 0x4025
-#define PRODUCT_ID 0x0A0C
-#define DEVICE_VER 0x4A1F
+#define VENDOR_ID 0x4025 // 40%
+#define PRODUCT_ID 0x4A1F
+#define DEVICE_VER 0x0100
#define MANUFACTURER di0ib
#define PRODUCT half_n_half
diff --git a/keyboards/boston_meetup/2019/config.h b/keyboards/boston_meetup/2019/config.h
index 80896242e0..138dedab57 100644
--- a/keyboards/boston_meetup/2019/config.h
+++ b/keyboards/boston_meetup/2019/config.h
@@ -1,7 +1,7 @@
#pragma once
/* USB Device descriptor parameter */
-#define DEVICE_VER 0x07E3
+#define DEVICE_VER 0x2019
#undef MATRIX_ROWS
#undef MATRIX_COLS
diff --git a/keyboards/capsunlocked/cu80/v2_ansi/info.json b/keyboards/capsunlocked/cu80/v2_ansi/info.json
index f0317de36d..7615d9f029 100644
--- a/keyboards/capsunlocked/cu80/v2_ansi/info.json
+++ b/keyboards/capsunlocked/cu80/v2_ansi/info.json
@@ -37,7 +37,7 @@
},
"url": "https://caps-unlocked.com/cu80-round-2/",
"usb": {
- "device_ver": "0x0001",
+ "device_version": "0.0.1",
"pid": "0x0081",
"vid": "0x4355"
},
diff --git a/keyboards/capsunlocked/cu80/v2_iso/info.json b/keyboards/capsunlocked/cu80/v2_iso/info.json
index c332156069..43f074f170 100644
--- a/keyboards/capsunlocked/cu80/v2_iso/info.json
+++ b/keyboards/capsunlocked/cu80/v2_iso/info.json
@@ -37,7 +37,7 @@
},
"url": "https://caps-unlocked.com/cu80-round-2/",
"usb": {
- "device_ver": "0x0001",
+ "device_version": "0.0.1",
"pid": "0x0080",
"vid": "0x4355"
},
diff --git a/keyboards/clueboard/17/info.json b/keyboards/clueboard/17/info.json
index fb12f7dcce..5ea4937e50 100644
--- a/keyboards/clueboard/17/info.json
+++ b/keyboards/clueboard/17/info.json
@@ -32,7 +32,7 @@
},
"url": "",
"usb": {
- "device_ver": "0x0001",
+ "device_version": "0.0.1",
"pid": "0x2312",
"vid": "0xC1ED"
},
diff --git a/keyboards/clueboard/2x1800/2019/info.json b/keyboards/clueboard/2x1800/2019/info.json
index a877cae8b0..886f3878bf 100644
--- a/keyboards/clueboard/2x1800/2019/info.json
+++ b/keyboards/clueboard/2x1800/2019/info.json
@@ -24,7 +24,7 @@
"rows": ["C0", "C1", "C2", "C3", "C7", "F7", "B1", "F2", "F3", "F4", "F5", "F6", "C6"]
},
"usb": {
- "device_ver": "0x0001",
+ "device_version": "0.0.1",
"pid": "0x23A0",
"vid": "0xC1ED"
},
diff --git a/keyboards/clueboard/60/info.json b/keyboards/clueboard/60/info.json
index 6e0d90fe1d..16f94644c9 100644
--- a/keyboards/clueboard/60/info.json
+++ b/keyboards/clueboard/60/info.json
@@ -25,7 +25,7 @@
"rows": ["B0", "B1", "B2", "A15", "A10"]
},
"usb": {
- "device_ver": "0x0001",
+ "device_version": "0.0.1",
"pid": "0x2350",
"vid": "0xC1ED"
},
diff --git a/keyboards/clueboard/66/rev1/info.json b/keyboards/clueboard/66/rev1/info.json
index 6ff733b3dd..bc3e1e23b6 100644
--- a/keyboards/clueboard/66/rev1/info.json
+++ b/keyboards/clueboard/66/rev1/info.json
@@ -37,7 +37,7 @@
"saturation_steps": 17
},
"usb": {
- "device_ver": "0x0001",
+ "device_version": "0.0.1",
"pid": "0x2301",
"vid": "0xC1ED"
},
diff --git a/keyboards/clueboard/66/rev2/info.json b/keyboards/clueboard/66/rev2/info.json
index 27d293552d..0cfb690388 100644
--- a/keyboards/clueboard/66/rev2/info.json
+++ b/keyboards/clueboard/66/rev2/info.json
@@ -37,7 +37,7 @@
"saturation_steps": 17
},
"usb": {
- "device_ver": "0x0001",
+ "device_version": "0.0.1",
"pid": "0x2320",
"vid": "0xC1ED"
},
diff --git a/keyboards/clueboard/66/rev3/info.json b/keyboards/clueboard/66/rev3/info.json
index 0f2eada753..208bc22dd1 100644
--- a/keyboards/clueboard/66/rev3/info.json
+++ b/keyboards/clueboard/66/rev3/info.json
@@ -37,7 +37,7 @@
"saturation_steps": 17
},
"usb": {
- "device_ver": "0x0001",
+ "device_version": "0.0.1",
"pid": "0x2370",
"vid": "0xC1ED"
},
diff --git a/keyboards/clueboard/66/rev4/info.json b/keyboards/clueboard/66/rev4/info.json
index b40abf402f..8733216f05 100644
--- a/keyboards/clueboard/66/rev4/info.json
+++ b/keyboards/clueboard/66/rev4/info.json
@@ -36,7 +36,7 @@
"saturation_steps": 17
},
"usb": {
- "device_ver": "0x0001",
+ "device_version": "0.0.1",
"pid": "0x2390",
"vid": "0xC1ED"
},
diff --git a/keyboards/clueboard/66_hotswap/gen1/info.json b/keyboards/clueboard/66_hotswap/gen1/info.json
index cf6288b545..2b42bf22e8 100644
--- a/keyboards/clueboard/66_hotswap/gen1/info.json
+++ b/keyboards/clueboard/66_hotswap/gen1/info.json
@@ -25,7 +25,7 @@
"rows": ["B11", "A6", "A3", "A2", "A1", "B5", "B6", "C15", "C14", "C13"]
},
"usb": {
- "device_ver": "0x0001",
+ "device_version": "0.0.1",
"pid": "0x2391",
"vid": "0xC1ED"
},
diff --git a/keyboards/clueboard/66_hotswap/prototype/info.json b/keyboards/clueboard/66_hotswap/prototype/info.json
index d3f81851f4..4940af8439 100644
--- a/keyboards/clueboard/66_hotswap/prototype/info.json
+++ b/keyboards/clueboard/66_hotswap/prototype/info.json
@@ -37,7 +37,7 @@
"saturation_steps": 17
},
"usb": {
- "device_ver": "0x0001",
+ "device_version": "0.0.1",
"pid": "0x2390",
"vid": "0xC1ED"
},
diff --git a/keyboards/clueboard/card/info.json b/keyboards/clueboard/card/info.json
index 24088b2c41..62ccd9ced0 100644
--- a/keyboards/clueboard/card/info.json
+++ b/keyboards/clueboard/card/info.json
@@ -32,7 +32,7 @@
"saturation_steps": 17
},
"usb": {
- "device_ver": "0x0001",
+ "device_version": "0.0.1",
"pid": "0x2330",
"vid": "0xC1ED"
},
diff --git a/keyboards/clueboard/info.json b/keyboards/clueboard/info.json
index 47514f280b..4421643e10 100644
--- a/keyboards/clueboard/info.json
+++ b/keyboards/clueboard/info.json
@@ -2,7 +2,7 @@
"manufacturer": "Clueboard",
"maintainer": "skullydazed",
"usb": {
- "device_ver": "0x0001",
+ "device_version": "0.0.1",
"vid": "0xC1ED"
}
}
diff --git a/keyboards/coarse/ixora/config.h b/keyboards/coarse/ixora/config.h
index ec7dfa705b..13246e9226 100644
--- a/keyboards/coarse/ixora/config.h
+++ b/keyboards/coarse/ixora/config.h
@@ -5,7 +5,7 @@
/* USB Device descriptor parameter */
#define VENDOR_ID 0xFEED
#define PRODUCT_ID 0x0C61
-#define DEVICE_VER 0x00C6
+#define DEVICE_VER 0x0100
#define MANUFACTURER PeiorisBoards
#define PRODUCT Ixora Rev1
diff --git a/keyboards/coarse/vinta/config.h b/keyboards/coarse/vinta/config.h
index d08994ae67..4e35b3461a 100644
--- a/keyboards/coarse/vinta/config.h
+++ b/keyboards/coarse/vinta/config.h
@@ -5,7 +5,7 @@
/* USB Device descriptor parameter */
#define VENDOR_ID 0xFEED
#define PRODUCT_ID 0x0C61
-#define DEVICE_VER 0x00C6
+#define DEVICE_VER 0x0100
#define MANUFACTURER PeiorisBoards
#define PRODUCT Vinta R1
diff --git a/keyboards/cybergear/macro25/info.json b/keyboards/cybergear/macro25/info.json
index a029ae1ce3..75078962bf 100644
--- a/keyboards/cybergear/macro25/info.json
+++ b/keyboards/cybergear/macro25/info.json
@@ -5,7 +5,7 @@
"usb": {
"vid": "0x1209",
"pid": "0x69A1",
- "device_ver": "0x0001"
+ "device_version": "0.0.1",
},
"diode_direction": "COL2ROW",
"layouts": {
diff --git a/keyboards/dyz/dyz60/info.json b/keyboards/dyz/dyz60/info.json
index 24ff257554..d946f9b97b 100644
--- a/keyboards/dyz/dyz60/info.json
+++ b/keyboards/dyz/dyz60/info.json
@@ -20,7 +20,7 @@
"usb": {
"vid": "0xD772",
"pid": "0x000A",
- "device_ver": "0x0001"
+ "device_version": "0.0.1"
},
"layouts": {
"LAYOUT_all": {
diff --git a/keyboards/ez_maker/directpins/promicro/info.json b/keyboards/ez_maker/directpins/promicro/info.json
index 419450385c..264ee350c8 100644
--- a/keyboards/ez_maker/directpins/promicro/info.json
+++ b/keyboards/ez_maker/directpins/promicro/info.json
@@ -26,7 +26,7 @@
},
"processor": "atmega32u4",
"usb": {
- "device_ver": "0x0001",
+ "device_version": "0.0.1",
"pid": "0x2320",
"vid": "0xFEED"
},
diff --git a/keyboards/ez_maker/directpins/proton_c/info.json b/keyboards/ez_maker/directpins/proton_c/info.json
index e3d000424a..d35fe9a90a 100644
--- a/keyboards/ez_maker/directpins/proton_c/info.json
+++ b/keyboards/ez_maker/directpins/proton_c/info.json
@@ -32,7 +32,7 @@
]
},
"usb": {
- "device_ver": "0x0001",
+ "device_version": "0.0.1",
"pid": "0x2321",
"vid": "0xFEED"
},
diff --git a/keyboards/ez_maker/directpins/teensy_2/info.json b/keyboards/ez_maker/directpins/teensy_2/info.json
index 0c8fa672a9..731d089322 100644
--- a/keyboards/ez_maker/directpins/teensy_2/info.json
+++ b/keyboards/ez_maker/directpins/teensy_2/info.json
@@ -28,7 +28,7 @@
]
},
"usb": {
- "device_ver": "0x0001",
+ "device_version": "0.0.1",
"pid": "0x2322",
"vid": "0xFEED"
},
diff --git a/keyboards/ez_maker/directpins/teensy_2pp/info.json b/keyboards/ez_maker/directpins/teensy_2pp/info.json
index e12544a5ef..214d4bdadc 100644
--- a/keyboards/ez_maker/directpins/teensy_2pp/info.json
+++ b/keyboards/ez_maker/directpins/teensy_2pp/info.json
@@ -35,7 +35,7 @@
]
},
"usb": {
- "device_ver": "0x0001",
+ "device_version": "0.0.1",
"pid": "0x2323",
"vid": "0xFEED"
},
diff --git a/keyboards/ez_maker/directpins/teensy_32/info.json b/keyboards/ez_maker/directpins/teensy_32/info.json
index e0c024ec94..851f9e67d1 100644
--- a/keyboards/ez_maker/directpins/teensy_32/info.json
+++ b/keyboards/ez_maker/directpins/teensy_32/info.json
@@ -27,7 +27,7 @@
]
},
"usb": {
- "device_ver": "0x0001",
+ "device_version": "0.0.1",
"pid": "0x2324",
"vid": "0xFEED"
},
diff --git a/keyboards/ez_maker/directpins/teensy_lc/info.json b/keyboards/ez_maker/directpins/teensy_lc/info.json
index bf93c41fab..8f64145e45 100644
--- a/keyboards/ez_maker/directpins/teensy_lc/info.json
+++ b/keyboards/ez_maker/directpins/teensy_lc/info.json
@@ -27,7 +27,7 @@
]
},
"usb": {
- "device_ver": "0x0001",
+ "device_version": "0.0.1",
"pid": "0x2325",
"vid": "0xFEED"
},
diff --git a/keyboards/forever65/info.json b/keyboards/forever65/info.json
index 9f5a3539e3..b50a2cf406 100644
--- a/keyboards/forever65/info.json
+++ b/keyboards/forever65/info.json
@@ -12,7 +12,7 @@
"usb": {
"vid": "0x4E53",
"pid": "0x0F65",
- "device_ver": "0x0001"
+ "device_version": "0.0.1"
},
"features": {
"bootmagic": true,
diff --git a/keyboards/frooastboard/info.json b/keyboards/frooastboard/info.json
index ca99cf594a..4217439b5e 100644
--- a/keyboards/frooastboard/info.json
+++ b/keyboards/frooastboard/info.json
@@ -37,6 +37,6 @@
"usb": {
"vid": "0x4642",
"pid": "0x6F21",
- "device_ver": "0x0001"
+ "device_version": "0.0.1"
}
}
diff --git a/keyboards/handwired/qc60/config.h b/keyboards/handwired/qc60/config.h
index 0c27755910..db3d88dcf4 100644
--- a/keyboards/handwired/qc60/config.h
+++ b/keyboards/handwired/qc60/config.h
@@ -5,7 +5,7 @@
/* USB Device descriptor parameter */
#define VENDOR_ID 0xFEED
#define PRODUCT_ID 0x0C60
-#define DEVICE_VER 0x00C6
+#define DEVICE_VER 0x0100
#define MANUFACTURER PeiorisBoards
#define PRODUCT QC60
diff --git a/keyboards/lets_split_eh/config.h b/keyboards/lets_split_eh/config.h
index 7527c6b3d2..787b9783b8 100644
--- a/keyboards/lets_split_eh/config.h
+++ b/keyboards/lets_split_eh/config.h
@@ -22,7 +22,7 @@ along with this program. If not, see .
/* USB Device descriptor parameter */
#define VENDOR_ID 0xFEED
#define PRODUCT_ID 0xE401
-#define DEVICE_VER 0x0E41
+#define DEVICE_VER 0x0100
#define MANUFACTURER That-Canadian
#define PRODUCT Lets Split Eh?
diff --git a/keyboards/ramonimbao/squishytkl/config.h b/keyboards/ramonimbao/squishytkl/config.h
index 3e0812bb12..ebebc35bb4 100644
--- a/keyboards/ramonimbao/squishytkl/config.h
+++ b/keyboards/ramonimbao/squishytkl/config.h
@@ -22,7 +22,7 @@ along with this program. If not, see .
/* USB Device descriptor parameter */
#define VENDOR_ID 0xB16B
#define PRODUCT_ID 0x00B1
-#define DEVICE_VER 0xE500
+#define DEVICE_VER 0x0100
#define MANUFACTURER Ramon Imbao
#define PRODUCT SquishyTKL
diff --git a/keyboards/spacetime/config.h b/keyboards/spacetime/config.h
index 3afcee1735..7dfca576a0 100644
--- a/keyboards/spacetime/config.h
+++ b/keyboards/spacetime/config.h
@@ -22,7 +22,7 @@ along with this program. If not, see .
/* USB Device descriptor parameter */
#define VENDOR_ID 0xFEED
#define PRODUCT_ID 0x0A0C
-#define DEVICE_VER 0x4A1F
+#define DEVICE_VER 0x0100
#define MANUFACTURER Kyle Terry
#define PRODUCT spacetime
diff --git a/keyboards/tempo_turtle/bradpad/info.json b/keyboards/tempo_turtle/bradpad/info.json
index d32cc2c665..e1caeeeb88 100644
--- a/keyboards/tempo_turtle/bradpad/info.json
+++ b/keyboards/tempo_turtle/bradpad/info.json
@@ -10,7 +10,7 @@
"usb":{
"vid":"0x7474",
"pid":"0x6270",
- "device_ver":"0x0001"
+ "device_version":"0.0.1"
},
"layouts": {
"LAYOUT": {
diff --git a/lib/python/qmk/cli/generate/config_h.py b/lib/python/qmk/cli/generate/config_h.py
index f16dca1de8..6b1012fae7 100755
--- a/lib/python/qmk/cli/generate/config_h.py
+++ b/lib/python/qmk/cli/generate/config_h.py
@@ -108,6 +108,12 @@ def generate_config_items(kb_info_json, config_h_lines):
config_h_lines.append(f'#ifndef {key}')
config_h_lines.append(f'# define {key} {value}')
config_h_lines.append(f'#endif // {key}')
+ elif key_type == 'bcd_version':
+ (major, minor, revision) = config_value.split('.')
+ config_h_lines.append('')
+ config_h_lines.append(f'#ifndef {config_key}')
+ config_h_lines.append(f'# define {config_key} 0x{major.zfill(2)}{minor}{revision}')
+ config_h_lines.append(f'#endif // {config_key}')
else:
config_h_lines.append('')
config_h_lines.append(f'#ifndef {config_key}')
diff --git a/lib/python/qmk/info.py b/lib/python/qmk/info.py
index 6bdf2cb166..905f10ecc2 100644
--- a/lib/python/qmk/info.py
+++ b/lib/python/qmk/info.py
@@ -387,6 +387,19 @@ def _extract_matrix_info(info_data, config_c):
return info_data
+# TODO: kill off usb.device_ver in favor of usb.device_version
+def _extract_device_version(info_data):
+ if info_data.get('usb'):
+ if info_data['usb'].get('device_version') and not info_data['usb'].get('device_ver'):
+ (major, minor, revision) = info_data['usb']['device_version'].split('.', 3)
+ info_data['usb']['device_ver'] = f'0x{major.zfill(2)}{minor}{revision}'
+ if not info_data['usb'].get('device_version') and info_data['usb'].get('device_ver'):
+ major = int(info_data['usb']['device_ver'][2:4])
+ minor = int(info_data['usb']['device_ver'][4])
+ revision = int(info_data['usb']['device_ver'][5])
+ info_data['usb']['device_version'] = f'{major}.{minor}.{revision}'
+
+
def _extract_config_h(info_data):
"""Pull some keyboard information from existing config.h files
"""
@@ -430,6 +443,13 @@ def _extract_config_h(info_data):
elif key_type == 'int':
dotty_info[info_key] = int(config_c[config_key])
+ elif key_type == 'bcd_version':
+ major = int(config_c[config_key][2:4])
+ minor = int(config_c[config_key][4])
+ revision = int(config_c[config_key][5])
+
+ dotty_info[info_key] = f'{major}.{minor}.{revision}'
+
else:
dotty_info[info_key] = config_c[config_key]
@@ -444,6 +464,7 @@ def _extract_config_h(info_data):
_extract_split_main(info_data, config_c)
_extract_split_transport(info_data, config_c)
_extract_split_right_pins(info_data, config_c)
+ _extract_device_version(info_data)
return info_data
--
cgit v1.2.3
From 6e2b03cf6901a6bbd146c074e8e9d9160358c6d9 Mon Sep 17 00:00:00 2001
From: Nick Brassel
Date: Wed, 2 Feb 2022 15:30:22 +1100
Subject: Fixup multibuild filegen (#16166)
* Add env variable support to multibuild.
* Generate version.h in build-specific location.---
build_keyboard.mk | 7 ++++++-
lib/python/qmk/cli/multibuild.py | 3 ++-
2 files changed, 8 insertions(+), 2 deletions(-)
(limited to 'lib/python/qmk/cli')
diff --git a/build_keyboard.mk b/build_keyboard.mk
index e8c3bfe5fa..a5e20853b3 100644
--- a/build_keyboard.mk
+++ b/build_keyboard.mk
@@ -44,7 +44,6 @@ endif
ifdef SKIP_GIT
VERSION_H_FLAGS := --skip-git
endif
-$(shell $(QMK_BIN) generate-version-h $(VERSION_H_FLAGS) -q -o quantum/version.h)
# Determine which subfolders exist.
KEYBOARD_FOLDER_PATH_1 := $(KEYBOARD)
@@ -166,6 +165,11 @@ generated-files: $(KEYMAP_OUTPUT)/src/config.h $(KEYMAP_OUTPUT)/src/keymap.c
endif
+generated-files: $(KEYMAP_OUTPUT)/src/version.h
+$(KEYMAP_OUTPUT)/src/version.h:
+ [ -d $(KEYMAP_OUTPUT)/src ] || mkdir -p $(KEYMAP_OUTPUT)/src
+ $(QMK_BIN) generate-version-h $(VERSION_H_FLAGS) -q -o $(KEYMAP_OUTPUT)/src/version.h
+
ifeq ($(strip $(CTPC)), yes)
CONVERT_TO_PROTON_C=yes
endif
@@ -393,6 +397,7 @@ VPATH += $(KEYMAP_PATH)
VPATH += $(USER_PATH)
VPATH += $(KEYBOARD_PATHS)
VPATH += $(COMMON_VPATH)
+VPATH += $(KEYMAP_OUTPUT)/src
include common_features.mk
include $(BUILDDEFS_PATH)/generic_features.mk
diff --git a/lib/python/qmk/cli/multibuild.py b/lib/python/qmk/cli/multibuild.py
index 85ed0fa1e9..ad059edff3 100755
--- a/lib/python/qmk/cli/multibuild.py
+++ b/lib/python/qmk/cli/multibuild.py
@@ -32,6 +32,7 @@ def _is_split(keyboard_name):
@cli.argument('-c', '--clean', arg_only=True, action='store_true', help="Remove object files before compiling.")
@cli.argument('-f', '--filter', arg_only=True, action='append', default=[], help="Filter the list of keyboards based on the supplied value in rules.mk. Supported format is 'SPLIT_KEYBOARD=yes'. May be passed multiple times.")
@cli.argument('-km', '--keymap', type=str, default='default', help="The keymap name to build. Default is 'default'.")
+@cli.argument('-e', '--env', arg_only=True, action='append', default=[], help="Set a variable to be passed to make. May be passed multiple times.")
@cli.subcommand('Compile QMK Firmware for all keyboards.', hidden=False if cli.config.user.developer else True)
def multibuild(cli):
"""Compile QMK Firmware against all keyboards.
@@ -68,7 +69,7 @@ def multibuild(cli):
all: {keyboard_safe}_binary
{keyboard_safe}_binary:
@rm -f "{QMK_FIRMWARE}/.build/failed.log.{keyboard_safe}" || true
- +@$(MAKE) -C "{QMK_FIRMWARE}" -f "{QMK_FIRMWARE}/build_keyboard.mk" KEYBOARD="{keyboard_name}" KEYMAP="{cli.args.keymap}" REQUIRE_PLATFORM_KEY= COLOR=true SILENT=false \\
+ +@$(MAKE) -C "{QMK_FIRMWARE}" -f "{QMK_FIRMWARE}/build_keyboard.mk" KEYBOARD="{keyboard_name}" KEYMAP="{cli.args.keymap}" REQUIRE_PLATFORM_KEY= COLOR=true SILENT=false {' '.join(cli.args.env)} \\
>>"{QMK_FIRMWARE}/.build/build.log.{os.getpid()}.{keyboard_safe}" 2>&1 \\
|| cp "{QMK_FIRMWARE}/.build/build.log.{os.getpid()}.{keyboard_safe}" "{QMK_FIRMWARE}/.build/failed.log.{os.getpid()}.{keyboard_safe}"
@{{ grep '\[ERRORS\]' "{QMK_FIRMWARE}/.build/build.log.{os.getpid()}.{keyboard_safe}" >/dev/null 2>&1 && printf "Build %-64s \e[1;31m[ERRORS]\e[0m\\n" "{keyboard_name}:{cli.args.keymap}" ; }} \\
--
cgit v1.2.3
From db43e450771f4eefe27821a88cc86df46c1006c1 Mon Sep 17 00:00:00 2001
From: Nick Brassel
Date: Fri, 4 Feb 2022 07:36:02 +1100
Subject: Ensure `version.h` is recreated each build. (#16188)
---
build_keyboard.mk | 11 +++++------
lib/python/qmk/cli/generate/version_h.py | 3 +++
2 files changed, 8 insertions(+), 6 deletions(-)
(limited to 'lib/python/qmk/cli')
diff --git a/build_keyboard.mk b/build_keyboard.mk
index a5e20853b3..80c295d9be 100644
--- a/build_keyboard.mk
+++ b/build_keyboard.mk
@@ -45,6 +45,9 @@ ifdef SKIP_GIT
VERSION_H_FLAGS := --skip-git
endif
+# Generate the board's version.h file.
+$(shell $(QMK_BIN) generate-version-h $(VERSION_H_FLAGS) -q -o $(KEYMAP_OUTPUT)/src/version.h)
+
# Determine which subfolders exist.
KEYBOARD_FOLDER_PATH_1 := $(KEYBOARD)
KEYBOARD_FOLDER_PATH_2 := $(patsubst %/,%,$(dir $(KEYBOARD_FOLDER_PATH_1)))
@@ -165,13 +168,8 @@ generated-files: $(KEYMAP_OUTPUT)/src/config.h $(KEYMAP_OUTPUT)/src/keymap.c
endif
-generated-files: $(KEYMAP_OUTPUT)/src/version.h
-$(KEYMAP_OUTPUT)/src/version.h:
- [ -d $(KEYMAP_OUTPUT)/src ] || mkdir -p $(KEYMAP_OUTPUT)/src
- $(QMK_BIN) generate-version-h $(VERSION_H_FLAGS) -q -o $(KEYMAP_OUTPUT)/src/version.h
-
ifeq ($(strip $(CTPC)), yes)
- CONVERT_TO_PROTON_C=yes
+ CONVERT_TO_PROTON_C=yes
endif
ifeq ($(strip $(CONVERT_TO_PROTON_C)), yes)
@@ -397,6 +395,7 @@ VPATH += $(KEYMAP_PATH)
VPATH += $(USER_PATH)
VPATH += $(KEYBOARD_PATHS)
VPATH += $(COMMON_VPATH)
+VPATH += $(KEYBOARD_OUTPUT)/src
VPATH += $(KEYMAP_OUTPUT)/src
include common_features.mk
diff --git a/lib/python/qmk/cli/generate/version_h.py b/lib/python/qmk/cli/generate/version_h.py
index b8e52588c4..69341e36f0 100644
--- a/lib/python/qmk/cli/generate/version_h.py
+++ b/lib/python/qmk/cli/generate/version_h.py
@@ -20,6 +20,9 @@ def generate_version_h(cli):
version_h = create_version_h(cli.args.skip_git, cli.args.skip_all)
if cli.args.output:
+ cli.args.output.parent.mkdir(parents=True, exist_ok=True)
+ if cli.args.output.exists():
+ cli.args.output.replace(cli.args.output.parent / (cli.args.output.name + '.bak'))
cli.args.output.write_text(version_h)
if not cli.args.quiet:
--
cgit v1.2.3
From 8fd8b2dc92a01b86a8e9ff3c37baeba760312140 Mon Sep 17 00:00:00 2001
From: Nick Brassel
Date: Sat, 5 Feb 2022 07:36:57 +1100
Subject: Skip categorisation of PR if it's only for code formatting. (#16215)
---
lib/python/qmk/cli/generate/develop_pr_list.py | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
(limited to 'lib/python/qmk/cli')
diff --git a/lib/python/qmk/cli/generate/develop_pr_list.py b/lib/python/qmk/cli/generate/develop_pr_list.py
index fab0262773..09236a7c42 100755
--- a/lib/python/qmk/cli/generate/develop_pr_list.py
+++ b/lib/python/qmk/cli/generate/develop_pr_list.py
@@ -12,6 +12,14 @@ fix_expr = re.compile(r'fix', flags=re.IGNORECASE)
clean1_expr = re.compile(r'\[(develop|keyboard|keymap|core|cli|bug|docs|feature)\]', flags=re.IGNORECASE)
clean2_expr = re.compile(r'^(develop|keyboard|keymap|core|cli|bug|docs|feature):', flags=re.IGNORECASE)
+ignored_titles = ["Format code according to conventions"]
+
+
+def _is_ignored(title):
+ for ignore in ignored_titles:
+ if ignore in title:
+ return
+
def _get_pr_info(cache, gh, pr_num):
pull = cache.get(f'pull:{pr_num}')
@@ -81,7 +89,9 @@ def generate_develop_pr_list(cli):
else:
normal_collection.append(info)
- if "dependencies" in commit_info['pr_labels']:
+ if _is_ignored(commit_info['title']):
+ return
+ elif "dependencies" in commit_info['pr_labels']:
fix_or_normal(commit_info, pr_list_bugs, pr_list_dependencies)
elif "core" in commit_info['pr_labels']:
fix_or_normal(commit_info, pr_list_bugs, pr_list_core)
--
cgit v1.2.3
From 2e279f1b889a59156f30524cc83358f64ee53287 Mon Sep 17 00:00:00 2001
From: Joel Challis
Date: Tue, 8 Feb 2022 19:03:30 +0000
Subject: Initial pass at data driven new-keyboard subcommand (#12795)
* Initial pass at a data driven keyboard subcommand
* format
* lint
* Handle bootloader now its mandatory---
data/templates/avr/config.h | 134 ------------
data/templates/avr/readme.md | 27 ---
data/templates/avr/rules.mk | 18 --
data/templates/base/%(KEYBOARD)s.c | 4 -
data/templates/base/%(KEYBOARD)s.h | 22 --
data/templates/base/info.json | 17 --
data/templates/base/keymaps/default/keymap.c | 22 --
data/templates/base/keymaps/default/readme.md | 1 -
data/templates/keyboard/info.json | 24 +++
data/templates/keyboard/readme.md | 27 +++
data/templates/keyboard/rules.mk | 1 +
data/templates/ps2avrgb/config.h | 124 -----------
data/templates/ps2avrgb/readme.md | 28 ---
data/templates/ps2avrgb/rules.mk | 17 --
docs/cli_commands.md | 2 +-
lib/python/qmk/cli/new/keyboard.py | 293 ++++++++++++++++++--------
lib/python/qmk/path.py | 2 +-
util/new_keyboard.sh | 181 ----------------
util/new_keymap.sh | 40 ----
19 files changed, 259 insertions(+), 725 deletions(-)
delete mode 100644 data/templates/avr/config.h
delete mode 100644 data/templates/avr/readme.md
delete mode 100644 data/templates/avr/rules.mk
delete mode 100644 data/templates/base/%(KEYBOARD)s.c
delete mode 100644 data/templates/base/%(KEYBOARD)s.h
delete mode 100644 data/templates/base/info.json
delete mode 100644 data/templates/base/keymaps/default/keymap.c
delete mode 100644 data/templates/base/keymaps/default/readme.md
create mode 100644 data/templates/keyboard/info.json
create mode 100644 data/templates/keyboard/readme.md
create mode 100644 data/templates/keyboard/rules.mk
delete mode 100644 data/templates/ps2avrgb/config.h
delete mode 100644 data/templates/ps2avrgb/readme.md
delete mode 100644 data/templates/ps2avrgb/rules.mk
delete mode 100755 util/new_keyboard.sh
delete mode 100755 util/new_keymap.sh
(limited to 'lib/python/qmk/cli')
diff --git a/data/templates/avr/config.h b/data/templates/avr/config.h
deleted file mode 100644
index 97f7bb6fad..0000000000
--- a/data/templates/avr/config.h
+++ /dev/null
@@ -1,134 +0,0 @@
-// Copyright %(YEAR)s %(YOUR_NAME)s (@%(USER_NAME)s)
-// SPDX-License-Identifier: GPL-2.0-or-later
-
-#pragma once
-
-#include "config_common.h"
-
-/* USB Device descriptor parameter */
-#define VENDOR_ID 0xFEED
-#define PRODUCT_ID 0x0000
-#define DEVICE_VER 0x0001
-#define MANUFACTURER %(USER_NAME)s
-#define PRODUCT %(KEYBOARD)s
-
-/* key matrix size */
-#define MATRIX_ROWS 2
-#define MATRIX_COLS 3
-
-/*
- * Keyboard Matrix Assignments
- *
- * Change this to how you wired your keyboard
- * COLS: AVR pins used for columns, left to right
- * ROWS: AVR pins used for rows, top to bottom
- * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode)
- * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode)
- *
- */
-#define MATRIX_ROW_PINS { D0, D5 }
-#define MATRIX_COL_PINS { F1, F0, B0 }
-#define UNUSED_PINS
-
-/* COL2ROW, ROW2COL */
-#define DIODE_DIRECTION COL2ROW
-
-/*
- * Split Keyboard specific options, make sure you have 'SPLIT_KEYBOARD = yes' in your rules.mk, and define SOFT_SERIAL_PIN.
- */
-#define SOFT_SERIAL_PIN D0 // or D1, D2, D3, E6
-
-//#define LED_NUM_LOCK_PIN B0
-//#define LED_CAPS_LOCK_PIN B1
-//#define LED_SCROLL_LOCK_PIN B2
-//#define LED_COMPOSE_PIN B3
-//#define LED_KANA_PIN B4
-
-//#define BACKLIGHT_PIN B7
-//#define BACKLIGHT_LEVELS 3
-//#define BACKLIGHT_BREATHING
-
-//#define RGB_DI_PIN E2
-//#ifdef RGB_DI_PIN
-//# define RGBLED_NUM 16
-//# define RGBLIGHT_HUE_STEP 8
-//# define RGBLIGHT_SAT_STEP 8
-//# define RGBLIGHT_VAL_STEP 8
-//# define RGBLIGHT_LIMIT_VAL 255 /* The maximum brightness level */
-//# define RGBLIGHT_SLEEP /* If defined, the RGB lighting will be switched off when the host goes to sleep */
-/*== all animations enable ==*/
-//# define RGBLIGHT_ANIMATIONS
-/*== or choose animations ==*/
-//# define RGBLIGHT_EFFECT_BREATHING
-//# define RGBLIGHT_EFFECT_RAINBOW_MOOD
-//# define RGBLIGHT_EFFECT_RAINBOW_SWIRL
-//# define RGBLIGHT_EFFECT_SNAKE
-//# define RGBLIGHT_EFFECT_KNIGHT
-//# define RGBLIGHT_EFFECT_CHRISTMAS
-//# define RGBLIGHT_EFFECT_STATIC_GRADIENT
-//# define RGBLIGHT_EFFECT_RGB_TEST
-//# define RGBLIGHT_EFFECT_ALTERNATING
-/*== customize breathing effect ==*/
-/*==== (DEFAULT) use fixed table instead of exp() and sin() ====*/
-//# define RGBLIGHT_BREATHE_TABLE_SIZE 256 // 256(default) or 128 or 64
-/*==== use exp() and sin() ====*/
-//# define RGBLIGHT_EFFECT_BREATHE_CENTER 1.85 // 1 to 2.7
-//# define RGBLIGHT_EFFECT_BREATHE_MAX 255 // 0 to 255
-//#endif
-
-/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
-#define DEBOUNCE 5
-
-/* define if matrix has ghost (lacks anti-ghosting diodes) */
-//#define MATRIX_HAS_GHOST
-
-/* 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
-
-/* If defined, GRAVE_ESC will always act as ESC when CTRL is held.
- * This is useful for the Windows task manager shortcut (ctrl+shift+esc).
- */
-//#define GRAVE_ESC_CTRL_OVERRIDE
-
-/*
- * Force NKRO
- *
- * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved
- * state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the
- * makefile for this to work.)
- *
- * If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N)
- * until the next keyboard reset.
- *
- * NKRO may prevent your keystrokes from being detected in the BIOS, but it is
- * fully operational during normal computer usage.
- *
- * For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N)
- * or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by
- * bootmagic, NKRO mode will always be enabled until it is toggled again during a
- * power-up.
- *
- */
-//#define FORCE_NKRO
-
-/*
- * Feature disable options
- * These options are also useful to firmware size reduction.
- */
-
-/* disable debug print */
-//#define NO_DEBUG
-
-/* disable print */
-//#define NO_PRINT
-
-/* disable action features */
-//#define NO_ACTION_LAYER
-//#define NO_ACTION_TAPPING
-//#define NO_ACTION_ONESHOT
-
-/* Bootmagic Lite key configuration */
-//#define BOOTMAGIC_LITE_ROW 0
-//#define BOOTMAGIC_LITE_COLUMN 0
diff --git a/data/templates/avr/readme.md b/data/templates/avr/readme.md
deleted file mode 100644
index 207850e065..0000000000
--- a/data/templates/avr/readme.md
+++ /dev/null
@@ -1,27 +0,0 @@
-# %(KEYBOARD)s
-
-
-
-*A short description of the keyboard/project*
-
-* Keyboard Maintainer: [%(YOUR_NAME)s](https://github.com/%(USER_NAME)s)
-* Hardware Supported: *The PCBs, controllers supported*
-* Hardware Availability: *Links to where you can find this hardware*
-
-Make example for this keyboard (after setting up your build environment):
-
- make %(KEYBOARD)s:default
-
-Flashing example for this keyboard:
-
- make %(KEYBOARD)s:default:flash
-
-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).
-
-## Bootloader
-
-Enter the bootloader in 3 ways:
-
-* **Bootmagic reset**: Hold down the key at (0,0) in the matrix (usually the top left key or Escape) and plug in the keyboard
-* **Physical reset button**: Briefly press the button on the back of the PCB - some may have pads you must short instead
-* **Keycode in layout**: Press the key mapped to `RESET` if it is available
diff --git a/data/templates/avr/rules.mk b/data/templates/avr/rules.mk
deleted file mode 100644
index 1275531ef6..0000000000
--- a/data/templates/avr/rules.mk
+++ /dev/null
@@ -1,18 +0,0 @@
-# MCU name
-MCU = atmega32u4
-
-# Bootloader selection
-BOOTLOADER = atmel-dfu
-
-# Build Options
-# change yes to no to disable
-#
-BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite
-MOUSEKEY_ENABLE = yes # Mouse keys
-EXTRAKEY_ENABLE = yes # Audio control and System control
-CONSOLE_ENABLE = no # Console for debug
-COMMAND_ENABLE = no # Commands for debug and configuration
-NKRO_ENABLE = no # Enable N-Key Rollover
-BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
-RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
-AUDIO_ENABLE = no # Audio output
diff --git a/data/templates/base/%(KEYBOARD)s.c b/data/templates/base/%(KEYBOARD)s.c
deleted file mode 100644
index 0c509aff65..0000000000
--- a/data/templates/base/%(KEYBOARD)s.c
+++ /dev/null
@@ -1,4 +0,0 @@
-// Copyright %(YEAR)s %(YOUR_NAME)s (@%(USER_NAME)s)
-// SPDX-License-Identifier: GPL-2.0-or-later
-
-#include "%(KEYBOARD)s.h"
diff --git a/data/templates/base/%(KEYBOARD)s.h b/data/templates/base/%(KEYBOARD)s.h
deleted file mode 100644
index 3e8ca3912d..0000000000
--- a/data/templates/base/%(KEYBOARD)s.h
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright %(YEAR)s %(YOUR_NAME)s (@%(USER_NAME)s)
-// SPDX-License-Identifier: GPL-2.0-or-later
-
-#pragma once
-
-#include "quantum.h"
-
-/* This is a shortcut to help you visually see your layout.
- *
- * The first section contains all of the arguments representing the physical
- * layout of the board and position of the keys.
- *
- * The second converts the arguments into a two-dimensional array which
- * represents the switch matrix.
- */
-#define LAYOUT( \
- k00, k01, k02, \
- k10, k12 \
-) { \
- { k00, k01, k02 }, \
- { k10, KC_NO, k12 } \
-}
diff --git a/data/templates/base/info.json b/data/templates/base/info.json
deleted file mode 100644
index a50ccba7bf..0000000000
--- a/data/templates/base/info.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "keyboard_name": "%(KEYBOARD)s",
- "url": "",
- "maintainer": "%(USER_NAME)s",
- "layouts": {
- "LAYOUT": {
- "layout": [
- {"label": "k00", "x": 0, "y": 0},
- {"label": "k01", "x": 1, "y": 0},
- {"label": "k02", "x": 2, "y": 0},
-
- {"label": "k10", "x": 0, "y": 1, "w": 1.5},
- {"label": "k12", "x": 1.5, "y": 1, "w": 1.5}
- ]
- }
- }
-}
diff --git a/data/templates/base/keymaps/default/keymap.c b/data/templates/base/keymaps/default/keymap.c
deleted file mode 100644
index 3fec3d5120..0000000000
--- a/data/templates/base/keymaps/default/keymap.c
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright %(YEAR)s %(YOUR_NAME)s (@%(USER_NAME)s)
-// SPDX-License-Identifier: GPL-2.0-or-later
-
-#include QMK_KEYBOARD_H
-
-// Defines names for use in layer keycodes and the keymap
-enum layer_names {
- _BASE,
- _FN
-};
-
-const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
- /* Base */
- [_BASE] = LAYOUT(
- KC_A, KC_1, MO(_FN),
- KC_TAB, KC_SPC
- ),
- [_FN] = LAYOUT(
- _______, _______, _______,
- RESET, XXXXXXX
- )
-};
diff --git a/data/templates/base/keymaps/default/readme.md b/data/templates/base/keymaps/default/readme.md
deleted file mode 100644
index 63a0643275..0000000000
--- a/data/templates/base/keymaps/default/readme.md
+++ /dev/null
@@ -1 +0,0 @@
-# The default keymap for %(KEYBOARD)s
diff --git a/data/templates/keyboard/info.json b/data/templates/keyboard/info.json
new file mode 100644
index 0000000000..92718faf3a
--- /dev/null
+++ b/data/templates/keyboard/info.json
@@ -0,0 +1,24 @@
+{
+ "keyboard_name": "%KEYBOARD%",
+ "maintainer": "%USER_NAME%",
+ "processor": "%MCU%",
+ "bootloader": "%BOOTLOADER%",
+ "diode_direction": "COL2ROW",
+ "matrix_pins": {
+ "cols": ["C2"],
+ "rows": ["D1"]
+ },
+ "usb": {
+ "vid": "0xFEED",
+ "pid": "0x0000",
+ "device_ver": "0x0001"
+ },
+ "features": {
+ "bootmagic_lite": true,
+ "command": false,
+ "console": false,
+ "extrakey": true,
+ "mousekey": true,
+ "nkro": true
+ }
+}
\ No newline at end of file
diff --git a/data/templates/keyboard/readme.md b/data/templates/keyboard/readme.md
new file mode 100644
index 0000000000..ca703c53f0
--- /dev/null
+++ b/data/templates/keyboard/readme.md
@@ -0,0 +1,27 @@
+# %KEYBOARD%
+
+
+
+*A short description of the keyboard/project*
+
+* Keyboard Maintainer: [%REAL_NAME%](https://github.com/%USER_NAME%)
+* Hardware Supported: *The PCBs, controllers supported*
+* Hardware Availability: *Links to where you can find this hardware*
+
+Make example for this keyboard (after setting up your build environment):
+
+ make %KEYBOARD%:default
+
+Flashing example for this keyboard:
+
+ make %KEYBOARD%:default:flash
+
+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).
+
+## Bootloader
+
+Enter the bootloader in 3 ways:
+
+* **Bootmagic reset**: Hold down the key at (0,0) in the matrix (usually the top left key or Escape) and plug in the keyboard
+* **Physical reset button**: Briefly press the button on the back of the PCB - some may have pads you must short instead
+* **Keycode in layout**: Press the key mapped to `RESET` if it is available
diff --git a/data/templates/keyboard/rules.mk b/data/templates/keyboard/rules.mk
new file mode 100644
index 0000000000..6e7633bfe0
--- /dev/null
+++ b/data/templates/keyboard/rules.mk
@@ -0,0 +1 @@
+# This file intentionally left blank
diff --git a/data/templates/ps2avrgb/config.h b/data/templates/ps2avrgb/config.h
deleted file mode 100644
index ef29da0de0..0000000000
--- a/data/templates/ps2avrgb/config.h
+++ /dev/null
@@ -1,124 +0,0 @@
-// Copyright %(YEAR)s %(YOUR_NAME)s (@%(USER_NAME)s)
-// SPDX-License-Identifier: GPL-2.0-or-later
-
-#pragma once
-
-#include "config_common.h"
-
-/* USB Device descriptor parameter */
-#define VENDOR_ID 0xFEED
-#define PRODUCT_ID 0x0000
-#define DEVICE_VER 0x0001
-#define MANUFACTURER %(USER_NAME)s
-#define PRODUCT %(KEYBOARD)s
-
-/* key matrix size */
-#define MATRIX_ROWS 8
-#define MATRIX_COLS 15
-
-/*
- * Keyboard Matrix Assignments
- *
- * Change this to how you wired your keyboard
- * COLS: AVR pins used for columns, left to right
- * ROWS: AVR pins used for rows, top to bottom
- * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode)
- * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode)
- *
- */
-#define MATRIX_ROW_PINS { B0, B1, B2, B3, B4, B5, B6, B7 }
-#define MATRIX_COL_PINS { A0, A1, A2, A3, A4, A5, A6, A7, C7, C6, C5, C4, C3, C2, D7 }
-#define UNUSED_PINS
-
-/* COL2ROW, ROW2COL */
-#define DIODE_DIRECTION COL2ROW
-
-//#define LED_NUM_LOCK_PIN D0
-//#define LED_CAPS_LOCK_PIN D1
-//#define LED_SCROLL_LOCK_PIN D6
-
-#define BACKLIGHT_PIN D4
-//#define BACKLIGHT_LEVELS 3
-//#define BACKLIGHT_BREATHING
-
-#define RGBLED_NUM 16
-//#define RGBLIGHT_HUE_STEP 8
-//#define RGBLIGHT_SAT_STEP 8
-//#define RGBLIGHT_VAL_STEP 8
-//#define RGBLIGHT_LIMIT_VAL 255 /* The maximum brightness level */
-//#define RGBLIGHT_SLEEP /* If defined, the RGB lighting will be switched off when the host goes to sleep */
-/*== all animations enable ==*/
-//#define RGBLIGHT_ANIMATIONS
-/*== or choose animations ==*/
-//#define RGBLIGHT_EFFECT_BREATHING
-//#define RGBLIGHT_EFFECT_RAINBOW_MOOD
-//#define RGBLIGHT_EFFECT_RAINBOW_SWIRL
-//#define RGBLIGHT_EFFECT_SNAKE
-//#define RGBLIGHT_EFFECT_KNIGHT
-//#define RGBLIGHT_EFFECT_CHRISTMAS
-//#define RGBLIGHT_EFFECT_STATIC_GRADIENT
-//#define RGBLIGHT_EFFECT_RGB_TEST
-//#define RGBLIGHT_EFFECT_ALTERNATING
-/*== customize breathing effect ==*/
-/*==== (DEFAULT) use fixed table instead of exp() and sin() ====*/
-//#define RGBLIGHT_BREATHE_TABLE_SIZE 256 // 256(default) or 128 or 64
-/*==== use exp() and sin() ====*/
-//#define RGBLIGHT_EFFECT_BREATHE_CENTER 1.85 // 1 to 2.7
-//#define RGBLIGHT_EFFECT_BREATHE_MAX 255 // 0 to 255
-
-/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
-#define DEBOUNCE 5
-
-/* define if matrix has ghost (lacks anti-ghosting diodes) */
-//#define MATRIX_HAS_GHOST
-
-/* 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
-
-/* If defined, GRAVE_ESC will always act as ESC when CTRL is held.
- * This is useful for the Windows task manager shortcut (ctrl+shift+esc).
- */
-//#define GRAVE_ESC_CTRL_OVERRIDE
-
-/*
- * Force NKRO
- *
- * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved
- * state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the
- * makefile for this to work.)
- *
- * If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N)
- * until the next keyboard reset.
- *
- * NKRO may prevent your keystrokes from being detected in the BIOS, but it is
- * fully operational during normal computer usage.
- *
- * For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N)
- * or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by
- * bootmagic, NKRO mode will always be enabled until it is toggled again during a
- * power-up.
- *
- */
-//#define FORCE_NKRO
-
-/*
- * Feature disable options
- * These options are also useful to firmware size reduction.
- */
-
-/* disable debug print */
-//#define NO_DEBUG
-
-/* disable print */
-//#define NO_PRINT
-
-/* disable action features */
-//#define NO_ACTION_LAYER
-//#define NO_ACTION_TAPPING
-//#define NO_ACTION_ONESHOT
-
-/* Bootmagic Lite key configuration */
-//#define BOOTMAGIC_LITE_ROW 0
-//#define BOOTMAGIC_LITE_COLUMN 0
diff --git a/data/templates/ps2avrgb/readme.md b/data/templates/ps2avrgb/readme.md
deleted file mode 100644
index a2ac4495b6..0000000000
--- a/data/templates/ps2avrgb/readme.md
+++ /dev/null
@@ -1,28 +0,0 @@
-# %(KEYBOARD)s
-
-
-
-*A short description of the keyboard/project*
-
-* Keyboard Maintainer: [%(YOUR_NAME)s](https://github.com/yourusername)
-* Hardware Supported: *The PCBs, controllers supported*
-* Hardware Availability: *Links to where you can find this hardware*
-
-Make example for this keyboard (after setting up your build environment):
-
- make %(KEYBOARD)s:default
-
-Flashing example for this keyboard ([after setting up the bootloadHID flashing environment](https://docs.qmk.fm/#/flashing_bootloadhid))
-
- make %(KEYBOARD)s:default:flash
-
-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).
-
-## Bootloader
-
-Enter the bootloader in 3 ways:
-
-* **Bootmagic reset**: Hold down the key at (0,0) in the matrix (usually the top left key or Escape) and plug in the keyboard
-* **BootloadHID reset**: Hold down the key connected to the `A0` and `B0` pins on the MCU if it is known (often top left or bottom left) and plug in the keyboard
-* **Physical reset button**: Briefly press the button on the back of the PCB - some may have pads you must short instead
-* **Keycode in layout**: Press the key mapped to `RESET` if it is available
diff --git a/data/templates/ps2avrgb/rules.mk b/data/templates/ps2avrgb/rules.mk
deleted file mode 100644
index 1bbfa8fa0e..0000000000
--- a/data/templates/ps2avrgb/rules.mk
+++ /dev/null
@@ -1,17 +0,0 @@
-# MCU name
-MCU = atmega32a
-
-# Bootloader selection
-BOOTLOADER = bootloadhid
-
-# Build Options
-# change yes to no to disable
-#
-BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite
-MOUSEKEY_ENABLE = yes # Mouse keys
-EXTRAKEY_ENABLE = yes # Audio control and System control
-CONSOLE_ENABLE = no # Console for debug
-COMMAND_ENABLE = no # Commands for debug and configuration
-BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
-RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
-WS2812_DRIVER = i2c
diff --git a/docs/cli_commands.md b/docs/cli_commands.md
index dfbd4c6a28..93af906b8a 100644
--- a/docs/cli_commands.md
+++ b/docs/cli_commands.md
@@ -310,7 +310,7 @@ Any arguments that are not provided will prompt for input. If `-u` is not passed
**Usage**:
```
-qmk new-keyboard [-kb KEYBOARD] [-t {avr,ps2avrgb}] -u USERNAME
+qmk new-keyboard [-kb KEYBOARD] [-t {atmega32u4,STM32F303,etc}] [-l {60_ansi,75_iso,etc}] -u USERNAME
```
## `qmk new-keymap`
diff --git a/lib/python/qmk/cli/new/keyboard.py b/lib/python/qmk/cli/new/keyboard.py
index 4093b8c90d..59e781a932 100644
--- a/lib/python/qmk/cli/new/keyboard.py
+++ b/lib/python/qmk/cli/new/keyboard.py
@@ -1,15 +1,82 @@
"""This script automates the creation of new keyboard directories using a starter template.
"""
+import re
+import json
+import shutil
from datetime import date
from pathlib import Path
-import re
+from dotty_dict import dotty
-from qmk.commands import git_get_username
-import qmk.path
from milc import cli
from milc.questions import choice, question
-KEYBOARD_TYPES = ['avr', 'ps2avrgb']
+from qmk.commands import git_get_username
+from qmk.json_schema import load_jsonschema
+from qmk.path import keyboard
+from qmk.json_encoders import InfoJSONEncoder
+from qmk.json_schema import deep_update
+
+COMMUNITY = Path('layouts/default/')
+TEMPLATE = Path('data/templates/keyboard/')
+
+MCU2BOOTLOADER = {
+ "MKL26Z64": "halfkay",
+ "MK20DX128": "halfkay",
+ "MK20DX256": "halfkay",
+ "MK66FX1M0": "halfkay",
+ "STM32F042": "stm32-dfu",
+ "STM32F072": "stm32-dfu",
+ "STM32F103": "stm32duino",
+ "STM32F303": "stm32-dfu",
+ "STM32F401": "stm32-dfu",
+ "STM32F405": "stm32-dfu",
+ "STM32F407": "stm32-dfu",
+ "STM32F411": "stm32-dfu",
+ "STM32F446": "stm32-dfu",
+ "STM32G431": "stm32-dfu",
+ "STM32G474": "stm32-dfu",
+ "STM32L412": "stm32-dfu",
+ "STM32L422": "stm32-dfu",
+ "STM32L432": "stm32-dfu",
+ "STM32L433": "stm32-dfu",
+ "STM32L442": "stm32-dfu",
+ "STM32L443": "stm32-dfu",
+ "GD32VF103": "gd32v-dfu",
+ "WB32F3G71": "wb32-dfu",
+ "atmega16u2": "atmel-dfu",
+ "atmega32u2": "atmel-dfu",
+ "atmega16u4": "atmel-dfu",
+ "atmega32u4": "atmel-dfu",
+ "at90usb162": "atmel-dfu",
+ "at90usb646": "atmel-dfu",
+ "at90usb647": "atmel-dfu",
+ "at90usb1286": "atmel-dfu",
+ "at90usb1287": "atmel-dfu",
+ "atmega32a": "bootloadhid",
+ "atmega328p": "usbasploader",
+ "atmega328": "usbasploader",
+}
+
+# defaults
+schema = dotty(load_jsonschema('keyboard'))
+mcu_types = sorted(schema["properties.processor.enum"], key=str.casefold)
+available_layouts = sorted([x.name for x in COMMUNITY.iterdir() if x.is_dir()])
+
+
+def mcu_type(mcu):
+ """Callable for argparse validation.
+ """
+ if mcu not in mcu_types:
+ raise ValueError
+ return mcu
+
+
+def layout_type(layout):
+ """Callable for argparse validation.
+ """
+ if layout not in available_layouts:
+ raise ValueError
+ return layout
def keyboard_name(name):
@@ -27,113 +94,163 @@ def validate_keyboard_name(name):
return bool(regex.match(name))
-@cli.argument('-kb', '--keyboard', help='Specify the name for the new keyboard directory', arg_only=True, type=keyboard_name)
-@cli.argument('-t', '--type', help='Specify the keyboard type', arg_only=True, choices=KEYBOARD_TYPES)
-@cli.argument('-u', '--username', help='Specify your username (default from Git config)', arg_only=True)
-@cli.argument('-n', '--realname', help='Specify your real name if you want to use that. Defaults to username', arg_only=True)
-@cli.subcommand('Creates a new keyboard directory')
-def new_keyboard(cli):
- """Creates a new keyboard.
+def select_default_bootloader(mcu):
+ """Provide sane defaults for bootloader
"""
- cli.log.info('{style_bright}Generating a new QMK keyboard directory{style_normal}')
- cli.echo('')
+ return MCU2BOOTLOADER.get(mcu, "custom")
+
+
+def replace_placeholders(src, dest, tokens):
+ """Replaces the given placeholders in each template file.
+ """
+ content = src.read_text()
+ for key, value in tokens.items():
+ content = content.replace(f'%{key}%', value)
- # Get keyboard name
- new_keyboard_name = None
- while not new_keyboard_name:
- new_keyboard_name = cli.args.keyboard if cli.args.keyboard else question('Keyboard Name:')
- if not validate_keyboard_name(new_keyboard_name):
- cli.log.error('Keyboard names must contain only {fg_cyan}lowercase a-z{fg_reset}, {fg_cyan}0-9{fg_reset}, and {fg_cyan}_{fg_reset}! Please choose a different name.')
+ dest.write_text(content)
- # Exit if passed by arg
- if cli.args.keyboard:
- return False
- new_keyboard_name = None
- continue
+def augment_community_info(src, dest):
+ """Splice in any additional data into info.json
+ """
+ info = json.loads(src.read_text())
+ template = json.loads(dest.read_text())
- keyboard_path = qmk.path.keyboard(new_keyboard_name)
- if keyboard_path.exists():
- cli.log.error(f'Keyboard {{fg_cyan}}{new_keyboard_name}{{fg_reset}} already exists! Please choose a different name.')
+ # merge community with template
+ deep_update(info, template)
- # Exit if passed by arg
- if cli.args.keyboard:
- return False
+ # avoid assumptions on macro name by using the first available
+ first_layout = next(iter(info["layouts"].values()))["layout"]
- new_keyboard_name = None
+ # guess at width and height now its optional
+ width, height = (0, 0)
+ for item in first_layout:
+ width = max(width, int(item["x"]) + 1)
+ height = max(height, int(item["y"]) + 1)
- # Get keyboard type
- keyboard_type = cli.args.type if cli.args.type else choice('Keyboard Type:', KEYBOARD_TYPES, default=0)
+ info["matrix_pins"] = {
+ "cols": ["C2"] * width,
+ "rows": ["D1"] * height,
+ }
- # Get username
- user_name = None
- while not user_name:
- user_name = question('Your GitHub User Name:', default=find_user_name())
+ # assume a 1:1 mapping on matrix to electrical
+ for item in first_layout:
+ item["matrix"] = [int(item["y"]), int(item["x"])]
- if not user_name:
- cli.log.error('You didn\'t provide a username, and we couldn\'t find one set in your QMK or Git configs. Please try again.')
+ # finally write out the updated info.json
+ dest.write_text(json.dumps(info, cls=InfoJSONEncoder))
- # Exit if passed by arg
- if cli.args.username:
- return False
- real_name = None
- while not real_name:
- real_name = question('Your real name:', default=user_name)
+def prompt_keyboard():
+ prompt = """{fg_yellow}Name Your Keyboard Project{style_reset_all}
- keyboard_basename = keyboard_path.name
- replacements = {
- "YEAR": str(date.today().year),
- "KEYBOARD": keyboard_basename,
- "USER_NAME": user_name,
- "YOUR_NAME": real_name,
- }
+For more infomation, see:
+https://docs.qmk.fm/#/hardware_keyboard_guidelines?id=naming-your-keyboardproject
- template_dir = Path('data/templates')
- template_tree(template_dir / 'base', keyboard_path, replacements)
- template_tree(template_dir / keyboard_type, keyboard_path, replacements)
+keyboard Name? """
+
+ return question(prompt, validate=lambda x: not keyboard(x).exists())
- cli.echo('')
- cli.log.info(f'{{fg_green}}Created a new keyboard called {{fg_cyan}}{new_keyboard_name}{{fg_green}}.{{fg_reset}}')
- cli.log.info(f'To start working on things, `cd` into {{fg_cyan}}{keyboard_path}{{fg_reset}},')
- cli.log.info('or open the directory in your preferred text editor.')
+def prompt_user():
+ prompt = """{fg_yellow}Attribution{style_reset_all}
-def find_user_name():
- if cli.args.username:
- return cli.args.username
- elif cli.config.user.name:
- return cli.config.user.name
- else:
- return git_get_username()
+Used for maintainer, copyright, etc
+Your GitHub Username? """
+ return question(prompt, default=git_get_username())
-def template_tree(src: Path, dst: Path, replacements: dict):
- """Recursively copy template and replace placeholders
- Args:
- src (Path)
- The source folder to copy from
- dst (Path)
- The destination folder to copy to
- replacements (dict)
- a dictionary with "key":"value" pairs to replace.
+def prompt_name(def_name):
+ prompt = """{fg_yellow}More Attribution{style_reset_all}
- Raises:
- FileExistsError
- When trying to overwrite existing files
+Used for maintainer, copyright, etc
+
+Your Real Name? """
+ return question(prompt, default=def_name)
+
+
+def prompt_layout():
+ prompt = """{fg_yellow}Pick Base Layout{style_reset_all}
+
+As a starting point, one of the common layouts can be used to bootstrap the process
+
+Default Layout? """
+ # avoid overwhelming user - remove some?
+ filtered_layouts = [x for x in available_layouts if not any(xs in x for xs in ['_split', '_blocker', '_tsangan', '_f13'])]
+ filtered_layouts.append("none of the above")
+
+ return choice(prompt, filtered_layouts, default=len(filtered_layouts) - 1)
+
+
+def prompt_mcu():
+ prompt = """{fg_yellow}What Powers Your Project{style_reset_all}
+
+For more infomation, see:
+https://docs.qmk.fm/#/compatible_microcontrollers
+
+MCU? """
+ # remove any options strictly used for compatibility
+ filtered_mcu = [x for x in mcu_types if not any(xs in x for xs in ['cortex', 'unknown'])]
+
+ return choice(prompt, filtered_mcu, default=filtered_mcu.index("atmega32u4"))
+
+
+@cli.argument('-kb', '--keyboard', help='Specify the name for the new keyboard directory', arg_only=True, type=keyboard_name)
+@cli.argument('-l', '--layout', help='Community layout to bootstrap with', arg_only=True, type=layout_type)
+@cli.argument('-t', '--type', help='Specify the keyboard MCU type', arg_only=True, type=mcu_type)
+@cli.argument('-u', '--username', help='Specify your username (default from Git config)', arg_only=True)
+@cli.argument('-n', '--realname', help='Specify your real name if you want to use that. Defaults to username', arg_only=True)
+@cli.subcommand('Creates a new keyboard directory')
+def new_keyboard(cli):
+ """Creates a new keyboard.
"""
+ cli.log.info('{style_bright}Generating a new QMK keyboard directory{style_normal}')
+ cli.echo('')
+
+ kb_name = cli.args.keyboard if cli.args.keyboard else prompt_keyboard()
+ user_name = cli.args.username if cli.args.username else prompt_user()
+ real_name = cli.args.realname or cli.args.username if cli.args.realname or cli.args.username else prompt_name(user_name)
+ default_layout = cli.args.layout if cli.args.layout else prompt_layout()
+ mcu = cli.args.type if cli.args.type else prompt_mcu()
+ bootloader = select_default_bootloader(mcu)
- dst.mkdir(parents=True, exist_ok=True)
+ if not validate_keyboard_name(kb_name):
+ cli.log.error('Keyboard names must contain only {fg_cyan}lowercase a-z{fg_reset}, {fg_cyan}0-9{fg_reset}, and {fg_cyan}_{fg_reset}! Please choose a different name.')
+ return 1
- for child in src.iterdir():
- if child.is_dir():
- template_tree(child, dst / child.name, replacements=replacements)
+ if keyboard(kb_name).exists():
+ cli.log.error(f'Keyboard {{fg_cyan}}{kb_name}{{fg_reset}} already exists! Please choose a different name.')
+ return 1
- if child.is_file():
- file_name = dst / (child.name % replacements)
+ tokens = {'YEAR': str(date.today().year), 'KEYBOARD': kb_name, 'USER_NAME': user_name, 'REAL_NAME': real_name, 'LAYOUT': default_layout, 'MCU': mcu, 'BOOTLOADER': bootloader}
- with file_name.open(mode='x') as dst_f:
- with child.open() as src_f:
- template = src_f.read()
- dst_f.write(template % replacements)
+ if cli.config.general.verbose:
+ cli.log.info("Creating keyboard with:")
+ for key, value in tokens.items():
+ cli.echo(f" {key.ljust(10)}: {value}")
+
+ # TODO: detach community layout and rename to just "LAYOUT"
+ if default_layout == 'none of the above':
+ default_layout = "ortho_4x4"
+
+ # begin with making the deepest folder in the tree
+ keymaps_path = keyboard(kb_name) / 'keymaps/'
+ keymaps_path.mkdir(parents=True)
+
+ # copy in keymap.c or keymap.json
+ community_keymap = Path(COMMUNITY / f'{default_layout}/default_{default_layout}/')
+ shutil.copytree(community_keymap, keymaps_path / 'default')
+
+ # process template files
+ for file in list(TEMPLATE.iterdir()):
+ replace_placeholders(file, keyboard(kb_name) / file.name, tokens)
+
+ # merge in infos
+ community_info = Path(COMMUNITY / f'{default_layout}/info.json')
+ augment_community_info(community_info, keyboard(kb_name) / community_info.name)
+
+ cli.log.info(f'{{fg_green}}Created a new keyboard called {{fg_cyan}}{kb_name}{{fg_green}}.{{fg_reset}}')
+ cli.log.info(f'To start working on things, `cd` into {{fg_cyan}}keyboards/{kb_name}{{fg_reset}},')
+ cli.log.info('or open the directory in your preferred text editor.')
+ cli.log.info(f"And build with {{fg_yellow}}qmk compile -kb {kb_name} -km default{{fg_reset}}.")
diff --git a/lib/python/qmk/path.py b/lib/python/qmk/path.py
index 72bae59273..dfb8371f84 100644
--- a/lib/python/qmk/path.py
+++ b/lib/python/qmk/path.py
@@ -46,7 +46,7 @@ def keymap(keyboard_name):
"""
keyboard_folder = keyboard(keyboard_name)
- for i in range(MAX_KEYBOARD_SUBFOLDERS):
+ for _ in range(MAX_KEYBOARD_SUBFOLDERS):
if (keyboard_folder / 'keymaps').exists():
return (keyboard_folder / 'keymaps').resolve()
diff --git a/util/new_keyboard.sh b/util/new_keyboard.sh
deleted file mode 100755
index 62e8cb9e13..0000000000
--- a/util/new_keyboard.sh
+++ /dev/null
@@ -1,181 +0,0 @@
-#!/usr/bin/env bash
-
-# This script generates a new keyboard directory under keyboards/,
-# and copies the template files from data/templates/ into it.
-
-# Print an error message with the word "ERROR" in red.
-echo_error() {
- echo -e "[\033[0;91mERROR\033[m]: $1"
-}
-
-# Print a message in bold.
-echo_bold() {
- echo -e "\033[1m$1\033[m"
-}
-
-# Prompt the user for information, showing the default value in brackets.
-prompt() {
- local message="$1"
- local default="$2"
-
- [ -n "$default" ] && message+=" [$default]"
- message+=": "
-
- read -rp "$message" prompt_return
- [ -z "$prompt_return" ] && prompt_return="$default"
-}
-
-# Grab a username from Git config.
-set_git_username() {
- git_username="$(git config --get user.name)"
-}
-
-# Copy the template files to the new keyboard directory.
-copy_templates() {
- mkdir -p "$keyboard_dir"
-
- echo -n "Copying base template files..."
- cp -r "data/templates/base/." "${keyboard_dir}"
- echo " done"
-
- echo -n "Copying $keyboard_type template files..."
- cp -r "data/templates/${keyboard_type}/." "${keyboard_dir}"
- echo " done"
-
- echo -n "Renaming keyboard files..."
- mv "${keyboard_dir}/keyboard.c" "${keyboard_dir}/${keyboard_base_name}.c"
- mv "${keyboard_dir}/keyboard.h" "${keyboard_dir}/${keyboard_base_name}.h"
- echo " done"
-}
-
-# Set the inplace editing parameter for sed.
-# macOS/BSD sed expects a file extension immediately following -i.
-set_sed_i() {
- sed_i=(-i)
-
- case $(uname -a) in
- *Darwin*) sed_i=(-i "")
- esac
-}
-
-# Replace a token with a value in the given list of files.
-replace_placeholders() {
- local replace_token="$1"
- local replace_value="$2"
- shift 2
- local replace_filenames=("$@")
-
- echo -n "Replacing $replace_token with $replace_value..."
- for replace_filename in "${replace_filenames[@]}"; do
- sed "${sed_i[@]}" -e "s/${replace_token}/${replace_value}/g" "$replace_filename"
- done
- echo " done"
-}
-
-# Replace %YEAR% with the current year.
-replace_year_placeholders() {
- local replace_year_filenames=(
- "${keyboard_dir}/config.h"
- "${keyboard_dir}/${keyboard_base_name}.c"
- "${keyboard_dir}/${keyboard_base_name}.h"
- "${keyboard_dir}/keymaps/default/keymap.c"
- )
- replace_placeholders "%YEAR%" "$(date +%Y)" "${replace_year_filenames[@]}"
-}
-
-# Replace %KEYBOARD% with the keyboard name.
-replace_keyboard_placeholders() {
- local replace_keyboard_filenames=(
- "${keyboard_dir}/config.h"
- "${keyboard_dir}/info.json"
- "${keyboard_dir}/readme.md"
- "${keyboard_dir}/${keyboard_base_name}.c"
- "${keyboard_dir}/keymaps/default/readme.md"
- )
- replace_placeholders "%KEYBOARD%" "$keyboard_base_name" "${replace_keyboard_filenames[@]}"
-}
-
-# Replace %YOUR_NAME% with the username.
-replace_name_placeholders() {
- local replace_name_filenames=(
- "${keyboard_dir}/config.h"
- "${keyboard_dir}/info.json"
- "${keyboard_dir}/readme.md"
- "${keyboard_dir}/${keyboard_base_name}.c"
- "${keyboard_dir}/${keyboard_base_name}.h"
- "${keyboard_dir}/keymaps/default/keymap.c"
- )
- replace_placeholders "%YOUR_NAME%" "$username" "${replace_name_filenames[@]}"
-}
-
-# Check if an array contains an element.
-array_contains() {
- local e match="$1"
- shift
- for e; do
- [[ "$e" == "$match" ]] && return 0;
- done
-
- return 1
-}
-
-# If we've been started from util/, we want to be in qmk_firmware/
-[[ "$PWD" == *util ]] && cd ..
-
-# The root qmk_firmware/ directory should have a subdirectory called quantum/
-if [ ! -d "quantum" ]; then
- echo_error "Could not detect the QMK firmware directory!"
- echo_error "Are you sure you're in the right place?"
- exit 1
-fi
-
-echo_bold "########################################"
-echo_bold "# NOTICE #"
-echo_bold "# This script has been deprecated. #"
-echo_bold "# Please use qmk new-keyboard instead. #"
-echo_bold "########################################"
-echo
-echo_bold "Generating a new QMK keyboard directory"
-echo
-
-# Keyboard name is required, so keep prompting until we get one
-while [ -z "$keyboard_name" ]; do
- prompt "Keyboard Name" ""
- keyboard_name=$prompt_return
- keyboard_base_name=$(basename $keyboard_name)
-done
-
-keyboard_dir="keyboards/$keyboard_name"
-
-if [ -d "$keyboard_dir" ]; then
- echo_error "Keyboard $keyboard_name already exists!"
- exit 1
-fi
-
-KEYBOARD_TYPES=("avr" "ps2avrgb")
-
-prompt "Keyboard Type" "avr"
-keyboard_type=$prompt_return
-
-if ! array_contains "$keyboard_type" "${KEYBOARD_TYPES[@]}"; then
- echo_error "Keyboard type must be one of: ${KEYBOARD_TYPES[*]}"
- exit 1
-fi
-
-set_git_username
-prompt "Your Name" "$git_username"
-username=$prompt_return
-
-echo
-
-copy_templates
-set_sed_i
-replace_year_placeholders
-replace_keyboard_placeholders
-[ -n "$username" ] && replace_name_placeholders
-
-echo
-echo_bold "Created a new keyboard called $keyboard_name."
-echo
-echo_bold "To start working on things, cd into keyboards/$keyboard_name,"
-echo_bold "or open the directory in your favourite text editor."
diff --git a/util/new_keymap.sh b/util/new_keymap.sh
deleted file mode 100755
index c483314fdb..0000000000
--- a/util/new_keymap.sh
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/bin/sh
-# Script to make a new keymap for a keyboard of your choosing
-# This script automates the copying of the default keymap into
-# your own keymap
-
-KB_PATH=$(echo "$1" | tr 'A-Z' 'a-z')
-USERNAME=$(echo "$2" | tr 'A-Z' 'a-z')
-
-if [ -z "$KB_PATH" ]; then
- printf "Usage: %s \n" "$0"
- printf "Example: %s 1upkeyboards/1up60hse yourname\n" "$0"
- exit 1
-fi
-
-if [ -z "$USERNAME" ]; then
- printf "Usage: %s \n" "$0"
- printf "Example: %s 1upkeyboards/1up60hse yourname\n" "$0"
- exit 1
-fi
-
-cd "$(dirname "$0")/.."
-
-if [ ! -d "keyboards/$KB_PATH" ]; then
- printf "Error! keyboards/%s does not exist!\n" "$KB_PATH"
- exit 1
-fi
-
-if [ -d "keyboards/$KB_PATH/keymaps/$USERNAME" ]; then
- printf "Error! keyboards/%s/keymaps/%s already exists!\n" "$KB_PATH" "$USERNAME"
- exit 1
-fi
-
-# Recursively copy the chosen keyboard's default keymap
-cp -r keyboards/"$KB_PATH"/keymaps/default keyboards/"$KB_PATH"/keymaps/"$USERNAME"
-
-printf "%s keymap directory created in: qmk_firmware/keyboards/%s/keymaps/\n\n" "$USERNAME" "$KB_PATH"
-
-printf "Compile a firmware file with your new keymap by typing: \n"
-printf " make %s:%s\n" "$KB_PATH" "$USERNAME"
-printf "from the qmk_firmware directory\n"
--
cgit v1.2.3
From f7e7671f691cfd42f322198f04690727f6493d73 Mon Sep 17 00:00:00 2001
From: Joel Challis
Date: Thu, 10 Feb 2022 17:45:51 +0000
Subject: Migrate more makefile utilities to builddefs sub-directory (#16002)
---
Makefile | 6 +-
build_full_test.mk | 36 --
build_json.mk | 17 -
build_keyboard.mk | 469 -----------------------
build_layout.mk | 32 --
build_test.mk | 84 ----
builddefs/build_full_test.mk | 36 ++
builddefs/build_json.mk | 17 +
builddefs/build_keyboard.mk | 469 +++++++++++++++++++++++
builddefs/build_layout.mk | 32 ++
builddefs/build_test.mk | 84 ++++
builddefs/common_features.mk | 801 +++++++++++++++++++++++++++++++++++++++
builddefs/common_rules.mk | 523 +++++++++++++++++++++++++
builddefs/testlist.mk | 19 +
common_features.mk | 801 ---------------------------------------
lib/python/qmk/cli/multibuild.py | 2 +-
lib/python/qmk/commands.py | 2 +-
paths.mk | 4 +-
testlist.mk | 19 -
tmk_core/rules.mk | 523 -------------------------
20 files changed, 1989 insertions(+), 1987 deletions(-)
delete mode 100644 build_full_test.mk
delete mode 100644 build_json.mk
delete mode 100644 build_keyboard.mk
delete mode 100644 build_layout.mk
delete mode 100644 build_test.mk
create mode 100644 builddefs/build_full_test.mk
create mode 100644 builddefs/build_json.mk
create mode 100644 builddefs/build_keyboard.mk
create mode 100644 builddefs/build_layout.mk
create mode 100644 builddefs/build_test.mk
create mode 100644 builddefs/common_features.mk
create mode 100644 builddefs/common_rules.mk
create mode 100644 builddefs/testlist.mk
delete mode 100644 common_features.mk
delete mode 100644 testlist.mk
delete mode 100644 tmk_core/rules.mk
(limited to 'lib/python/qmk/cli')
diff --git a/Makefile b/Makefile
index 22c79880a3..4c2e6a04dc 100644
--- a/Makefile
+++ b/Makefile
@@ -275,7 +275,7 @@ define PARSE_KEYMAP
# Specify the variables that we are passing forward to submake
MAKE_VARS := KEYBOARD=$$(CURRENT_KB) KEYMAP=$$(CURRENT_KM) REQUIRE_PLATFORM_KEY=$$(REQUIRE_PLATFORM_KEY) QMK_BIN=$$(QMK_BIN)
# And the first part of the make command
- MAKE_CMD := $$(MAKE) -r -R -C $(ROOT_DIR) -f build_keyboard.mk $$(MAKE_TARGET)
+ MAKE_CMD := $$(MAKE) -r -R -C $(ROOT_DIR) -f $(BUILDDEFS_PATH)/build_keyboard.mk $$(MAKE_TARGET)
# The message to display
MAKE_MSG := $$(MSG_MAKE_KB)
# We run the command differently, depending on if we want more output or not
@@ -317,7 +317,7 @@ define BUILD_TEST
TEST_NAME := $$(notdir $$(TEST_PATH))
MAKE_TARGET := $2
COMMAND := $1
- MAKE_CMD := $$(MAKE) -r -R -C $(ROOT_DIR) -f build_test.mk $$(MAKE_TARGET)
+ MAKE_CMD := $$(MAKE) -r -R -C $(ROOT_DIR) -f $(BUILDDEFS_PATH)/build_test.mk $$(MAKE_TARGET)
MAKE_VARS := TEST=$$(TEST_NAME) TEST_PATH=$$(TEST_PATH) FULL_TESTS="$$(FULL_TESTS)"
MAKE_MSG := $$(MSG_MAKE_TEST)
$$(eval $$(call BUILD))
@@ -339,7 +339,7 @@ define PARSE_TEST
TESTS :=
TEST_NAME := $$(firstword $$(subst :, ,$$(RULE)))
TEST_TARGET := $$(subst $$(TEST_NAME),,$$(subst $$(TEST_NAME):,,$$(RULE)))
- include $(ROOT_DIR)/testlist.mk
+ include $(BUILDDEFS_PATH)/testlist.mk
ifeq ($$(TEST_NAME),all)
MATCHED_TESTS := $$(TEST_LIST)
else
diff --git a/build_full_test.mk b/build_full_test.mk
deleted file mode 100644
index 4e4b4e4bfd..0000000000
--- a/build_full_test.mk
+++ /dev/null
@@ -1,36 +0,0 @@
-# Copyright 2017 Fred Sundvik
-#
-# 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 .
-
-$(TEST)_INC := \
- tests/test_common/common_config.h
-
-$(TEST)_SRC := \
- $(TMK_COMMON_SRC) \
- $(QUANTUM_SRC) \
- $(SRC) \
- tests/test_common/keymap.c \
- tests/test_common/matrix.c \
- tests/test_common/test_driver.cpp \
- tests/test_common/keyboard_report_util.cpp \
- tests/test_common/test_fixture.cpp \
- tests/test_common/test_keymap_key.cpp \
- tests/test_common/test_logger.cpp \
- $(patsubst $(ROOTDIR)/%,%,$(wildcard $(TEST_PATH)/*.cpp))
-
-$(TEST)_DEFS := $(TMK_COMMON_DEFS) $(OPT_DEFS)
-
-$(TEST)_CONFIG := $(TEST_PATH)/config.h
-
-VPATH += $(TOP_DIR)/tests/test_common
diff --git a/build_json.mk b/build_json.mk
deleted file mode 100644
index 0c034eb2ae..0000000000
--- a/build_json.mk
+++ /dev/null
@@ -1,17 +0,0 @@
-# Look for a json keymap file
-ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_5)/keymap.json)","")
- KEYMAP_JSON := $(MAIN_KEYMAP_PATH_5)/keymap.json
- KEYMAP_PATH := $(MAIN_KEYMAP_PATH_5)
-else ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_4)/keymap.json)","")
- KEYMAP_JSON := $(MAIN_KEYMAP_PATH_4)/keymap.json
- KEYMAP_PATH := $(MAIN_KEYMAP_PATH_4)
-else ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_3)/keymap.json)","")
- KEYMAP_JSON := $(MAIN_KEYMAP_PATH_3)/keymap.json
- KEYMAP_PATH := $(MAIN_KEYMAP_PATH_3)
-else ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_2)/keymap.json)","")
- KEYMAP_JSON := $(MAIN_KEYMAP_PATH_2)/keymap.json
- KEYMAP_PATH := $(MAIN_KEYMAP_PATH_2)
-else ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_1)/keymap.json)","")
- KEYMAP_JSON := $(MAIN_KEYMAP_PATH_1)/keymap.json
- KEYMAP_PATH := $(MAIN_KEYMAP_PATH_1)
-endif
diff --git a/build_keyboard.mk b/build_keyboard.mk
deleted file mode 100644
index f727760465..0000000000
--- a/build_keyboard.mk
+++ /dev/null
@@ -1,469 +0,0 @@
-# Determine what keyboard we are building and setup the build environment.
-#
-# We support folders up to 5 levels deep below `keyboards/`. This file is
-# responsible for determining which folder is being used and doing the
-# corresponding environment setup.
-
-ifndef VERBOSE
-.SILENT:
-endif
-
-.DEFAULT_GOAL := all
-
-include paths.mk
-include $(BUILDDEFS_PATH)/message.mk
-
-# Set the qmk cli to use
-QMK_BIN ?= qmk
-
-# Set the filename for the final firmware binary
-KEYBOARD_FILESAFE := $(subst /,_,$(KEYBOARD))
-TARGET ?= $(KEYBOARD_FILESAFE)_$(KEYMAP)
-KEYBOARD_OUTPUT := $(BUILD_DIR)/obj_$(KEYBOARD_FILESAFE)
-
-# Force expansion
-TARGET := $(TARGET)
-
-ifneq ($(FORCE_LAYOUT),)
- TARGET := $(TARGET)_$(FORCE_LAYOUT)
-endif
-
-# Object files and generated keymap directory
-# To put object files in current directory, use a dot (.), do NOT make
-# this an empty or blank macro!
-KEYMAP_OUTPUT := $(BUILD_DIR)/obj_$(TARGET)
-
-ifdef SKIP_VERSION
- OPT_DEFS += -DSKIP_VERSION
-endif
-
-# Generate the version.h file
-ifdef SKIP_VERSION
-VERSION_H_FLAGS := --skip-all
-endif
-ifdef SKIP_GIT
-VERSION_H_FLAGS := --skip-git
-endif
-
-# Generate the board's version.h file.
-$(shell $(QMK_BIN) generate-version-h $(VERSION_H_FLAGS) -q -o $(KEYMAP_OUTPUT)/src/version.h)
-
-# Determine which subfolders exist.
-KEYBOARD_FOLDER_PATH_1 := $(KEYBOARD)
-KEYBOARD_FOLDER_PATH_2 := $(patsubst %/,%,$(dir $(KEYBOARD_FOLDER_PATH_1)))
-KEYBOARD_FOLDER_PATH_3 := $(patsubst %/,%,$(dir $(KEYBOARD_FOLDER_PATH_2)))
-KEYBOARD_FOLDER_PATH_4 := $(patsubst %/,%,$(dir $(KEYBOARD_FOLDER_PATH_3)))
-KEYBOARD_FOLDER_PATH_5 := $(patsubst %/,%,$(dir $(KEYBOARD_FOLDER_PATH_4)))
-KEYBOARD_FOLDER_1 := $(notdir $(KEYBOARD_FOLDER_PATH_1))
-KEYBOARD_FOLDER_2 := $(notdir $(KEYBOARD_FOLDER_PATH_2))
-KEYBOARD_FOLDER_3 := $(notdir $(KEYBOARD_FOLDER_PATH_3))
-KEYBOARD_FOLDER_4 := $(notdir $(KEYBOARD_FOLDER_PATH_4))
-KEYBOARD_FOLDER_5 := $(notdir $(KEYBOARD_FOLDER_PATH_5))
-KEYBOARD_PATHS :=
-KEYBOARD_PATH_1 := keyboards/$(KEYBOARD_FOLDER_PATH_1)
-KEYBOARD_PATH_2 := keyboards/$(KEYBOARD_FOLDER_PATH_2)
-KEYBOARD_PATH_3 := keyboards/$(KEYBOARD_FOLDER_PATH_3)
-KEYBOARD_PATH_4 := keyboards/$(KEYBOARD_FOLDER_PATH_4)
-KEYBOARD_PATH_5 := keyboards/$(KEYBOARD_FOLDER_PATH_5)
-
-ifneq ("$(wildcard $(KEYBOARD_PATH_5)/)","")
- KEYBOARD_PATHS += $(KEYBOARD_PATH_5)
-endif
-ifneq ("$(wildcard $(KEYBOARD_PATH_4)/)","")
- KEYBOARD_PATHS += $(KEYBOARD_PATH_4)
-endif
-ifneq ("$(wildcard $(KEYBOARD_PATH_3)/)","")
- KEYBOARD_PATHS += $(KEYBOARD_PATH_3)
-endif
-ifneq ("$(wildcard $(KEYBOARD_PATH_2)/)","")
- KEYBOARD_PATHS += $(KEYBOARD_PATH_2)
-endif
-ifneq ("$(wildcard $(KEYBOARD_PATH_1)/)","")
- KEYBOARD_PATHS += $(KEYBOARD_PATH_1)
-endif
-
-
-# Pull in rules.mk files from all our subfolders
-ifneq ("$(wildcard $(KEYBOARD_PATH_5)/rules.mk)","")
- include $(KEYBOARD_PATH_5)/rules.mk
-endif
-ifneq ("$(wildcard $(KEYBOARD_PATH_4)/rules.mk)","")
- include $(KEYBOARD_PATH_4)/rules.mk
-endif
-ifneq ("$(wildcard $(KEYBOARD_PATH_3)/rules.mk)","")
- include $(KEYBOARD_PATH_3)/rules.mk
-endif
-ifneq ("$(wildcard $(KEYBOARD_PATH_2)/rules.mk)","")
- include $(KEYBOARD_PATH_2)/rules.mk
-endif
-ifneq ("$(wildcard $(KEYBOARD_PATH_1)/rules.mk)","")
- include $(KEYBOARD_PATH_1)/rules.mk
-endif
-
-MAIN_KEYMAP_PATH_1 := $(KEYBOARD_PATH_1)/keymaps/$(KEYMAP)
-MAIN_KEYMAP_PATH_2 := $(KEYBOARD_PATH_2)/keymaps/$(KEYMAP)
-MAIN_KEYMAP_PATH_3 := $(KEYBOARD_PATH_3)/keymaps/$(KEYMAP)
-MAIN_KEYMAP_PATH_4 := $(KEYBOARD_PATH_4)/keymaps/$(KEYMAP)
-MAIN_KEYMAP_PATH_5 := $(KEYBOARD_PATH_5)/keymaps/$(KEYMAP)
-
-# Pull in rules from info.json
-INFO_RULES_MK = $(shell $(QMK_BIN) generate-rules-mk --quiet --escape --keyboard $(KEYBOARD) --output $(KEYBOARD_OUTPUT)/src/info_rules.mk)
-include $(INFO_RULES_MK)
-
-# Check for keymap.json first, so we can regenerate keymap.c
-include build_json.mk
-
-# Pull in keymap level rules.mk
-ifeq ("$(wildcard $(KEYMAP_PATH))", "")
- # Look through the possible keymap folders until we find a matching keymap.c
- ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_5)/keymap.c)","")
- -include $(MAIN_KEYMAP_PATH_5)/rules.mk
- KEYMAP_C := $(MAIN_KEYMAP_PATH_5)/keymap.c
- KEYMAP_PATH := $(MAIN_KEYMAP_PATH_5)
- else ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_4)/keymap.c)","")
- -include $(MAIN_KEYMAP_PATH_4)/rules.mk
- KEYMAP_C := $(MAIN_KEYMAP_PATH_4)/keymap.c
- KEYMAP_PATH := $(MAIN_KEYMAP_PATH_4)
- else ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_3)/keymap.c)","")
- -include $(MAIN_KEYMAP_PATH_3)/rules.mk
- KEYMAP_C := $(MAIN_KEYMAP_PATH_3)/keymap.c
- KEYMAP_PATH := $(MAIN_KEYMAP_PATH_3)
- else ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_2)/keymap.c)","")
- -include $(MAIN_KEYMAP_PATH_2)/rules.mk
- KEYMAP_C := $(MAIN_KEYMAP_PATH_2)/keymap.c
- KEYMAP_PATH := $(MAIN_KEYMAP_PATH_2)
- else ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_1)/keymap.c)","")
- -include $(MAIN_KEYMAP_PATH_1)/rules.mk
- KEYMAP_C := $(MAIN_KEYMAP_PATH_1)/keymap.c
- KEYMAP_PATH := $(MAIN_KEYMAP_PATH_1)
- else ifneq ($(LAYOUTS),)
- # If we haven't found a keymap yet fall back to community layouts
- include build_layout.mk
- else
- $(call CATASTROPHIC_ERROR,Invalid keymap,Could not find keymap)
- # this state should never be reached
- endif
-endif
-
-# Have we found a keymap.json?
-ifneq ("$(wildcard $(KEYMAP_JSON))", "")
- KEYMAP_C := $(KEYMAP_OUTPUT)/src/keymap.c
- KEYMAP_H := $(KEYMAP_OUTPUT)/src/config.h
-
- # Load the keymap-level rules.mk if exists
- -include $(KEYMAP_PATH)/rules.mk
-
- # Load any rules.mk content from keymap.json
- INFO_RULES_MK = $(shell $(QMK_BIN) generate-rules-mk --quiet --escape --keyboard $(KEYBOARD) --keymap $(KEYMAP) --output $(KEYMAP_OUTPUT)/src/rules.mk)
- include $(INFO_RULES_MK)
-
-# Add rules to generate the keymap files - indentation here is important
-$(KEYMAP_OUTPUT)/src/keymap.c: $(KEYMAP_JSON)
- $(QMK_BIN) json2c --quiet --output $(KEYMAP_C) $(KEYMAP_JSON)
-
-$(KEYMAP_OUTPUT)/src/config.h: $(KEYMAP_JSON)
- $(QMK_BIN) generate-config-h --quiet --keyboard $(KEYBOARD) --keymap $(KEYMAP) --output $(KEYMAP_H)
-
-generated-files: $(KEYMAP_OUTPUT)/src/config.h $(KEYMAP_OUTPUT)/src/keymap.c
-
-endif
-
-ifeq ($(strip $(CTPC)), yes)
- CONVERT_TO_PROTON_C=yes
-endif
-
-ifeq ($(strip $(CONVERT_TO_PROTON_C)), yes)
- include platforms/chibios/boards/QMK_PROTON_C/convert_to_proton_c.mk
-endif
-
-include $(BUILDDEFS_PATH)/mcu_selection.mk
-
-# Find all the C source files to be compiled in subfolders.
-KEYBOARD_SRC :=
-
-KEYBOARD_C_1 := $(KEYBOARD_PATH_1)/$(KEYBOARD_FOLDER_1).c
-KEYBOARD_C_2 := $(KEYBOARD_PATH_2)/$(KEYBOARD_FOLDER_2).c
-KEYBOARD_C_3 := $(KEYBOARD_PATH_3)/$(KEYBOARD_FOLDER_3).c
-KEYBOARD_C_4 := $(KEYBOARD_PATH_4)/$(KEYBOARD_FOLDER_4).c
-KEYBOARD_C_5 := $(KEYBOARD_PATH_5)/$(KEYBOARD_FOLDER_5).c
-
-ifneq ("$(wildcard $(KEYBOARD_C_5))","")
- KEYBOARD_SRC += $(KEYBOARD_C_5)
-endif
-ifneq ("$(wildcard $(KEYBOARD_C_4))","")
- KEYBOARD_SRC += $(KEYBOARD_C_4)
-endif
-ifneq ("$(wildcard $(KEYBOARD_C_3))","")
- KEYBOARD_SRC += $(KEYBOARD_C_3)
-endif
-ifneq ("$(wildcard $(KEYBOARD_C_2))","")
- KEYBOARD_SRC += $(KEYBOARD_C_2)
-endif
-ifneq ("$(wildcard $(KEYBOARD_C_1))","")
- KEYBOARD_SRC += $(KEYBOARD_C_1)
-endif
-
-# Generate KEYBOARD_name_subname for all levels of the keyboard folder
-KEYBOARD_FILESAFE_1 := $(subst .,,$(subst /,_,$(KEYBOARD_FOLDER_PATH_1)))
-KEYBOARD_FILESAFE_2 := $(subst .,,$(subst /,_,$(KEYBOARD_FOLDER_PATH_2)))
-KEYBOARD_FILESAFE_3 := $(subst .,,$(subst /,_,$(KEYBOARD_FOLDER_PATH_3)))
-KEYBOARD_FILESAFE_4 := $(subst .,,$(subst /,_,$(KEYBOARD_FOLDER_PATH_4)))
-KEYBOARD_FILESAFE_5 := $(subst .,,$(subst /,_,$(KEYBOARD_FOLDER_PATH_5)))
-
-ifneq ("$(wildcard $(KEYBOARD_PATH_5)/)","")
- OPT_DEFS += -DKEYBOARD_$(KEYBOARD_FILESAFE_5)
-endif
-ifneq ("$(wildcard $(KEYBOARD_PATH_4)/)","")
- OPT_DEFS += -DKEYBOARD_$(KEYBOARD_FILESAFE_4)
-endif
-ifneq ("$(wildcard $(KEYBOARD_PATH_3)/)","")
- OPT_DEFS += -DKEYBOARD_$(KEYBOARD_FILESAFE_3)
-endif
-ifneq ("$(wildcard $(KEYBOARD_PATH_2)/)","")
- OPT_DEFS += -DKEYBOARD_$(KEYBOARD_FILESAFE_2)
-endif
-ifneq ("$(wildcard $(KEYBOARD_PATH_1)/)","")
- OPT_DEFS += -DKEYBOARD_$(KEYBOARD_FILESAFE_1)
-endif
-
-# Setup the define for QMK_KEYBOARD_H. This is used inside of keymaps so
-# that the same keymap may be used on multiple keyboards.
-#
-# We grab the most top-level include file that we can. That file should
-# use #ifdef statements to include all the neccesary subfolder includes,
-# as described here:
-#
-# https://docs.qmk.fm/#/feature_layouts?id=tips-for-making-layouts-keyboard-agnostic
-#
-QMK_KEYBOARD_H = $(KEYBOARD_OUTPUT)/src/default_keyboard.h
-ifneq ("$(wildcard $(KEYBOARD_PATH_1)/$(KEYBOARD_FOLDER_1).h)","")
- QMK_KEYBOARD_H = $(KEYBOARD_FOLDER_1).h
-endif
-ifneq ("$(wildcard $(KEYBOARD_PATH_2)/$(KEYBOARD_FOLDER_2).h)","")
- QMK_KEYBOARD_H = $(KEYBOARD_FOLDER_2).h
-endif
-ifneq ("$(wildcard $(KEYBOARD_PATH_3)/$(KEYBOARD_FOLDER_3).h)","")
- QMK_KEYBOARD_H = $(KEYBOARD_FOLDER_3).h
-endif
-ifneq ("$(wildcard $(KEYBOARD_PATH_4)/$(KEYBOARD_FOLDER_4).h)","")
- QMK_KEYBOARD_H = $(KEYBOARD_FOLDER_4).h
-endif
-ifneq ("$(wildcard $(KEYBOARD_PATH_5)/$(KEYBOARD_FOLDER_5).h)","")
- QMK_KEYBOARD_H = $(KEYBOARD_FOLDER_5).h
-endif
-
-# Determine and set parameters based on the keyboard's processor family.
-# We can assume a ChibiOS target When MCU_FAMILY is defined since it's
-# not used for LUFA
-ifdef MCU_FAMILY
- PLATFORM=CHIBIOS
- PLATFORM_KEY=chibios
- FIRMWARE_FORMAT?=bin
- OPT_DEFS += -DMCU_$(MCU_FAMILY)
-else ifdef ARM_ATSAM
- PLATFORM=ARM_ATSAM
- PLATFORM_KEY=arm_atsam
- FIRMWARE_FORMAT=bin
-else
- PLATFORM=AVR
- PLATFORM_KEY=avr
- FIRMWARE_FORMAT?=hex
-endif
-
-# Find all of the config.h files and add them to our CONFIG_H define.
-CONFIG_H :=
-ifneq ("$(wildcard $(KEYBOARD_PATH_5)/config.h)","")
- CONFIG_H += $(KEYBOARD_PATH_5)/config.h
-endif
-ifneq ("$(wildcard $(KEYBOARD_PATH_4)/config.h)","")
- CONFIG_H += $(KEYBOARD_PATH_4)/config.h
-endif
-ifneq ("$(wildcard $(KEYBOARD_PATH_3)/config.h)","")
- CONFIG_H += $(KEYBOARD_PATH_3)/config.h
-endif
-ifneq ("$(wildcard $(KEYBOARD_PATH_2)/config.h)","")
- CONFIG_H += $(KEYBOARD_PATH_2)/config.h
-endif
-ifneq ("$(wildcard $(KEYBOARD_PATH_1)/config.h)","")
- CONFIG_H += $(KEYBOARD_PATH_1)/config.h
-endif
-
-POST_CONFIG_H :=
-ifneq ("$(wildcard $(KEYBOARD_PATH_1)/post_config.h)","")
- POST_CONFIG_H += $(KEYBOARD_PATH_1)/post_config.h
-endif
-ifneq ("$(wildcard $(KEYBOARD_PATH_2)/post_config.h)","")
- POST_CONFIG_H += $(KEYBOARD_PATH_2)/post_config.h
-endif
-ifneq ("$(wildcard $(KEYBOARD_PATH_3)/post_config.h)","")
- POST_CONFIG_H += $(KEYBOARD_PATH_3)/post_config.h
-endif
-ifneq ("$(wildcard $(KEYBOARD_PATH_4)/post_config.h)","")
- POST_CONFIG_H += $(KEYBOARD_PATH_4)/post_config.h
-endif
-ifneq ("$(wildcard $(KEYBOARD_PATH_5)/post_config.h)","")
- POST_CONFIG_H += $(KEYBOARD_PATH_5)/post_config.h
-endif
-
-# Pull in stuff from info.json
-INFO_JSON_FILES :=
-ifneq ("$(wildcard $(KEYBOARD_PATH_1)/info.json)","")
- INFO_JSON_FILES += $(KEYBOARD_PATH_1)/info.json
-endif
-ifneq ("$(wildcard $(KEYBOARD_PATH_2)/info.json)","")
- INFO_JSON_FILES += $(KEYBOARD_PATH_2)/info.json
-endif
-ifneq ("$(wildcard $(KEYBOARD_PATH_3)/info.json)","")
- INFO_JSON_FILES += $(KEYBOARD_PATH_3)/info.json
-endif
-ifneq ("$(wildcard $(KEYBOARD_PATH_4)/info.json)","")
- INFO_JSON_FILES += $(KEYBOARD_PATH_4)/info.json
-endif
-ifneq ("$(wildcard $(KEYBOARD_PATH_5)/info.json)","")
- INFO_JSON_FILES += $(KEYBOARD_PATH_5)/info.json
-endif
-
-CONFIG_H += $(KEYBOARD_OUTPUT)/src/info_config.h $(KEYBOARD_OUTPUT)/src/layouts.h
-
-$(KEYBOARD_OUTPUT)/src/info_config.h: $(INFO_JSON_FILES)
- $(QMK_BIN) generate-config-h --quiet --keyboard $(KEYBOARD) --output $(KEYBOARD_OUTPUT)/src/info_config.h
-
-$(KEYBOARD_OUTPUT)/src/default_keyboard.h: $(INFO_JSON_FILES)
- $(QMK_BIN) generate-keyboard-h --quiet --keyboard $(KEYBOARD) --output $(KEYBOARD_OUTPUT)/src/default_keyboard.h
-
-$(KEYBOARD_OUTPUT)/src/layouts.h: $(INFO_JSON_FILES)
- $(QMK_BIN) generate-layouts --quiet --keyboard $(KEYBOARD) --output $(KEYBOARD_OUTPUT)/src/layouts.h
-
-generated-files: $(KEYBOARD_OUTPUT)/src/info_config.h $(KEYBOARD_OUTPUT)/src/default_keyboard.h $(KEYBOARD_OUTPUT)/src/layouts.h
-
-.INTERMEDIATE : generated-files
-
-# Userspace setup and definitions
-ifeq ("$(USER_NAME)","")
- USER_NAME := $(KEYMAP)
-endif
-USER_PATH := users/$(USER_NAME)
-
-# Pull in user level rules.mk
--include $(USER_PATH)/rules.mk
-ifneq ("$(wildcard $(USER_PATH)/config.h)","")
- CONFIG_H += $(USER_PATH)/config.h
-endif
-ifneq ("$(wildcard $(USER_PATH)/post_config.h)","")
- POST_CONFIG_H += $(USER_PATH)/post_config.h
-endif
-
-# Disable features that a keyboard doesn't support
--include $(BUILDDEFS_PATH)/disable_features.mk
-
-# Pull in post_rules.mk files from all our subfolders
-ifneq ("$(wildcard $(KEYBOARD_PATH_1)/post_rules.mk)","")
- include $(KEYBOARD_PATH_1)/post_rules.mk
-endif
-ifneq ("$(wildcard $(KEYBOARD_PATH_2)/post_rules.mk)","")
- include $(KEYBOARD_PATH_2)/post_rules.mk
-endif
-ifneq ("$(wildcard $(KEYBOARD_PATH_3)/post_rules.mk)","")
- include $(KEYBOARD_PATH_3)/post_rules.mk
-endif
-ifneq ("$(wildcard $(KEYBOARD_PATH_4)/post_rules.mk)","")
- include $(KEYBOARD_PATH_4)/post_rules.mk
-endif
-ifneq ("$(wildcard $(KEYBOARD_PATH_5)/post_rules.mk)","")
- include $(KEYBOARD_PATH_5)/post_rules.mk
-endif
-
-ifneq ("$(wildcard $(KEYMAP_PATH)/config.h)","")
- CONFIG_H += $(KEYMAP_PATH)/config.h
-endif
-ifneq ("$(KEYMAP_H)","")
- CONFIG_H += $(KEYMAP_H)
-endif
-
-# project specific files
-SRC += \
- $(KEYBOARD_SRC) \
- $(KEYMAP_C) \
- $(QUANTUM_SRC) \
- $(QUANTUM_DIR)/main.c \
-
-# Optimize size but this may cause error "relocation truncated to fit"
-#EXTRALDFLAGS = -Wl,--relax
-
-# Search Path
-VPATH += $(KEYMAP_PATH)
-VPATH += $(USER_PATH)
-VPATH += $(KEYBOARD_PATHS)
-VPATH += $(COMMON_VPATH)
-VPATH += $(KEYBOARD_OUTPUT)/src
-VPATH += $(KEYMAP_OUTPUT)/src
-
-include common_features.mk
-include $(BUILDDEFS_PATH)/generic_features.mk
-include $(TMK_PATH)/protocol.mk
-include $(PLATFORM_PATH)/common.mk
-include $(BUILDDEFS_PATH)/bootloader.mk
-
-SRC += $(patsubst %.c,%.clib,$(LIB_SRC))
-SRC += $(patsubst %.c,%.clib,$(QUANTUM_LIB_SRC))
-SRC += $(TMK_COMMON_SRC)
-OPT_DEFS += $(TMK_COMMON_DEFS)
-EXTRALDFLAGS += $(TMK_COMMON_LDFLAGS)
-
-SKIP_COMPILE := no
-ifneq ($(REQUIRE_PLATFORM_KEY),)
- ifneq ($(REQUIRE_PLATFORM_KEY),$(PLATFORM_KEY))
- SKIP_COMPILE := yes
- endif
-endif
-
-include $(PLATFORM_PATH)/$(PLATFORM_KEY)/platform.mk
--include $(PLATFORM_PATH)/$(PLATFORM_KEY)/flash.mk
-
-ifneq ($(strip $(PROTOCOL)),)
- include $(TMK_PATH)/protocol/$(strip $(shell echo $(PROTOCOL) | tr '[:upper:]' '[:lower:]')).mk
-else
- include $(TMK_PATH)/protocol/$(PLATFORM_KEY).mk
-endif
-
-# TODO: remove this bodge?
-PROJECT_DEFS := $(OPT_DEFS)
-PROJECT_INC := $(VPATH) $(EXTRAINCDIRS) $(KEYBOARD_PATHS)
-PROJECT_CONFIG := $(CONFIG_H)
-
-CONFIG_H += $(POST_CONFIG_H)
-ALL_CONFIGS := $(PROJECT_CONFIG) $(CONFIG_H)
-
-OUTPUTS := $(KEYMAP_OUTPUT) $(KEYBOARD_OUTPUT)
-$(KEYMAP_OUTPUT)_SRC := $(SRC)
-$(KEYMAP_OUTPUT)_DEFS := $(OPT_DEFS) \
--DQMK_KEYBOARD=\"$(KEYBOARD)\" -DQMK_KEYBOARD_H=\"$(QMK_KEYBOARD_H)\" \
--DQMK_KEYMAP=\"$(KEYMAP)\" -DQMK_KEYMAP_H=\"$(KEYMAP).h\" -DQMK_KEYMAP_CONFIG_H=\"$(KEYMAP_PATH)/config.h\"
-$(KEYMAP_OUTPUT)_INC := $(VPATH) $(EXTRAINCDIRS)
-$(KEYMAP_OUTPUT)_CONFIG := $(CONFIG_H)
-$(KEYBOARD_OUTPUT)_SRC := $(PLATFORM_SRC)
-$(KEYBOARD_OUTPUT)_DEFS := $(PROJECT_DEFS)
-$(KEYBOARD_OUTPUT)_INC := $(PROJECT_INC)
-$(KEYBOARD_OUTPUT)_CONFIG := $(PROJECT_CONFIG)
-
-# Default target.
-ifeq ($(SKIP_COMPILE),no)
-all: build check-size
-else
-all:
- echo "skipped" >&2
-endif
-
-build: elf cpfirmware
-check-size: build
-check-md5: build
-objs-size: build
-
-include $(BUILDDEFS_PATH)/show_options.mk
-include $(TMK_PATH)/rules.mk
-
-# Ensure we have generated files available for each of the objects
-define GEN_FILES
-$1: generated-files
-endef
-$(foreach O,$(OBJ),$(eval $(call GEN_FILES,$(patsubst %.a,%.o,$(O)))))
diff --git a/build_layout.mk b/build_layout.mk
deleted file mode 100644
index 6166bd847c..0000000000
--- a/build_layout.mk
+++ /dev/null
@@ -1,32 +0,0 @@
-LAYOUTS_PATH := layouts
-LAYOUTS_REPOS := $(patsubst %/,%,$(sort $(dir $(wildcard $(LAYOUTS_PATH)/*/))))
-
-define SEARCH_LAYOUTS_REPO
- LAYOUT_KEYMAP_PATH := $$(LAYOUTS_REPO)/$$(LAYOUT)/$$(KEYMAP)
- LAYOUT_KEYMAP_JSON := $$(LAYOUT_KEYMAP_PATH)/keymap.json
- LAYOUT_KEYMAP_C := $$(LAYOUT_KEYMAP_PATH)/keymap.c
- ifneq ("$$(wildcard $$(LAYOUT_KEYMAP_JSON))","")
- -include $$(LAYOUT_KEYMAP_PATH)/rules.mk
- KEYMAP_JSON := $$(LAYOUT_KEYMAP_JSON)
- KEYMAP_PATH := $$(LAYOUT_KEYMAP_PATH)
- else ifneq ("$$(wildcard $$(LAYOUT_KEYMAP_C))","")
- -include $$(LAYOUT_KEYMAP_PATH)/rules.mk
- KEYMAP_C := $$(LAYOUT_KEYMAP_C)
- KEYMAP_PATH := $$(LAYOUT_KEYMAP_PATH)
- endif
-endef
-
-define SEARCH_LAYOUTS
- $$(foreach LAYOUTS_REPO,$$(LAYOUTS_REPOS),$$(eval $$(call SEARCH_LAYOUTS_REPO)))
-endef
-
-ifneq ($(FORCE_LAYOUT),)
- ifneq (,$(findstring $(FORCE_LAYOUT),$(LAYOUTS)))
- $(info Forcing layout: $(FORCE_LAYOUT))
- LAYOUTS := $(FORCE_LAYOUT)
- else
- $(call CATASTROPHIC_ERROR,Invalid layout,Forced layout does not exist)
- endif
-endif
-
-$(foreach LAYOUT,$(LAYOUTS),$(eval $(call SEARCH_LAYOUTS)))
diff --git a/build_test.mk b/build_test.mk
deleted file mode 100644
index ec6699b4ea..0000000000
--- a/build_test.mk
+++ /dev/null
@@ -1,84 +0,0 @@
-ifndef VERBOSE
-.SILENT:
-endif
-
-.DEFAULT_GOAL := all
-
-include paths.mk
-include $(BUILDDEFS_PATH)/message.mk
-
-TARGET=test/$(TEST)
-
-GTEST_OUTPUT = $(BUILD_DIR)/gtest
-
-TEST_OBJ = $(BUILD_DIR)/test_obj
-
-OUTPUTS := $(TEST_OBJ)/$(TEST) $(GTEST_OUTPUT)
-
-GTEST_INC := \
- $(LIB_PATH)/googletest/googletest/include \
- $(LIB_PATH)/googletest/googlemock/include
-
-GTEST_INTERNAL_INC := \
- $(LIB_PATH)/googletest/googletest \
- $(LIB_PATH)/googletest/googlemock
-
-$(GTEST_OUTPUT)_SRC := \
- googletest/src/gtest-all.cc\
- googlemock/src/gmock-all.cc
-
-$(GTEST_OUTPUT)_DEFS :=
-$(GTEST_OUTPUT)_INC := $(GTEST_INC) $(GTEST_INTERNAL_INC)
-
-LDFLAGS += -lstdc++ -lpthread -shared-libgcc
-CREATE_MAP := no
-
-VPATH += \
- $(LIB_PATH)/googletest \
- $(LIB_PATH)/googlemock \
- $(LIB_PATH)/printf
-
-all: elf
-
-VPATH += $(COMMON_VPATH)
-PLATFORM:=TEST
-PLATFORM_KEY:=test
-BOOTLOADER_TYPE:=none
-
-ifeq ($(strip $(DEBUG)), 1)
-CONSOLE_ENABLE = yes
-endif
-
-ifneq ($(filter $(FULL_TESTS),$(TEST)),)
-include tests/test_common/build.mk
-include $(TEST_PATH)/test.mk
-endif
-
-include common_features.mk
-include $(BUILDDEFS_PATH)/generic_features.mk
-include $(PLATFORM_PATH)/common.mk
-include $(TMK_PATH)/protocol.mk
-include $(QUANTUM_PATH)/debounce/tests/rules.mk
-include $(QUANTUM_PATH)/encoder/tests/rules.mk
-include $(QUANTUM_PATH)/sequencer/tests/rules.mk
-include $(PLATFORM_PATH)/test/rules.mk
-ifneq ($(filter $(FULL_TESTS),$(TEST)),)
-include build_full_test.mk
-endif
-
-$(TEST)_SRC += \
- tests/test_common/main.c \
- $(LIB_PATH)/printf/printf.c \
- $(QUANTUM_PATH)/logging/print.c
-
-$(TEST_OBJ)/$(TEST)_SRC := $($(TEST)_SRC)
-$(TEST_OBJ)/$(TEST)_INC := $($(TEST)_INC) $(VPATH) $(GTEST_INC)
-$(TEST_OBJ)/$(TEST)_DEFS := $($(TEST)_DEFS)
-$(TEST_OBJ)/$(TEST)_CONFIG := $($(TEST)_CONFIG)
-
-include $(PLATFORM_PATH)/$(PLATFORM_KEY)/platform.mk
-include $(TMK_PATH)/rules.mk
-
-
-$(shell mkdir -p $(BUILD_DIR)/test 2>/dev/null)
-$(shell mkdir -p $(TEST_OBJ) 2>/dev/null)
diff --git a/builddefs/build_full_test.mk b/builddefs/build_full_test.mk
new file mode 100644
index 0000000000..4e4b4e4bfd
--- /dev/null
+++ b/builddefs/build_full_test.mk
@@ -0,0 +1,36 @@
+# Copyright 2017 Fred Sundvik
+#
+# 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 .
+
+$(TEST)_INC := \
+ tests/test_common/common_config.h
+
+$(TEST)_SRC := \
+ $(TMK_COMMON_SRC) \
+ $(QUANTUM_SRC) \
+ $(SRC) \
+ tests/test_common/keymap.c \
+ tests/test_common/matrix.c \
+ tests/test_common/test_driver.cpp \
+ tests/test_common/keyboard_report_util.cpp \
+ tests/test_common/test_fixture.cpp \
+ tests/test_common/test_keymap_key.cpp \
+ tests/test_common/test_logger.cpp \
+ $(patsubst $(ROOTDIR)/%,%,$(wildcard $(TEST_PATH)/*.cpp))
+
+$(TEST)_DEFS := $(TMK_COMMON_DEFS) $(OPT_DEFS)
+
+$(TEST)_CONFIG := $(TEST_PATH)/config.h
+
+VPATH += $(TOP_DIR)/tests/test_common
diff --git a/builddefs/build_json.mk b/builddefs/build_json.mk
new file mode 100644
index 0000000000..0c034eb2ae
--- /dev/null
+++ b/builddefs/build_json.mk
@@ -0,0 +1,17 @@
+# Look for a json keymap file
+ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_5)/keymap.json)","")
+ KEYMAP_JSON := $(MAIN_KEYMAP_PATH_5)/keymap.json
+ KEYMAP_PATH := $(MAIN_KEYMAP_PATH_5)
+else ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_4)/keymap.json)","")
+ KEYMAP_JSON := $(MAIN_KEYMAP_PATH_4)/keymap.json
+ KEYMAP_PATH := $(MAIN_KEYMAP_PATH_4)
+else ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_3)/keymap.json)","")
+ KEYMAP_JSON := $(MAIN_KEYMAP_PATH_3)/keymap.json
+ KEYMAP_PATH := $(MAIN_KEYMAP_PATH_3)
+else ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_2)/keymap.json)","")
+ KEYMAP_JSON := $(MAIN_KEYMAP_PATH_2)/keymap.json
+ KEYMAP_PATH := $(MAIN_KEYMAP_PATH_2)
+else ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_1)/keymap.json)","")
+ KEYMAP_JSON := $(MAIN_KEYMAP_PATH_1)/keymap.json
+ KEYMAP_PATH := $(MAIN_KEYMAP_PATH_1)
+endif
diff --git a/builddefs/build_keyboard.mk b/builddefs/build_keyboard.mk
new file mode 100644
index 0000000000..d5efcb4193
--- /dev/null
+++ b/builddefs/build_keyboard.mk
@@ -0,0 +1,469 @@
+# Determine what keyboard we are building and setup the build environment.
+#
+# We support folders up to 5 levels deep below `keyboards/`. This file is
+# responsible for determining which folder is being used and doing the
+# corresponding environment setup.
+
+ifndef VERBOSE
+.SILENT:
+endif
+
+.DEFAULT_GOAL := all
+
+include paths.mk
+include $(BUILDDEFS_PATH)/message.mk
+
+# Set the qmk cli to use
+QMK_BIN ?= qmk
+
+# Set the filename for the final firmware binary
+KEYBOARD_FILESAFE := $(subst /,_,$(KEYBOARD))
+TARGET ?= $(KEYBOARD_FILESAFE)_$(KEYMAP)
+KEYBOARD_OUTPUT := $(BUILD_DIR)/obj_$(KEYBOARD_FILESAFE)
+
+# Force expansion
+TARGET := $(TARGET)
+
+ifneq ($(FORCE_LAYOUT),)
+ TARGET := $(TARGET)_$(FORCE_LAYOUT)
+endif
+
+# Object files and generated keymap directory
+# To put object files in current directory, use a dot (.), do NOT make
+# this an empty or blank macro!
+KEYMAP_OUTPUT := $(BUILD_DIR)/obj_$(TARGET)
+
+ifdef SKIP_VERSION
+ OPT_DEFS += -DSKIP_VERSION
+endif
+
+# Generate the version.h file
+ifdef SKIP_VERSION
+VERSION_H_FLAGS := --skip-all
+endif
+ifdef SKIP_GIT
+VERSION_H_FLAGS := --skip-git
+endif
+
+# Generate the board's version.h file.
+$(shell $(QMK_BIN) generate-version-h $(VERSION_H_FLAGS) -q -o $(KEYMAP_OUTPUT)/src/version.h)
+
+# Determine which subfolders exist.
+KEYBOARD_FOLDER_PATH_1 := $(KEYBOARD)
+KEYBOARD_FOLDER_PATH_2 := $(patsubst %/,%,$(dir $(KEYBOARD_FOLDER_PATH_1)))
+KEYBOARD_FOLDER_PATH_3 := $(patsubst %/,%,$(dir $(KEYBOARD_FOLDER_PATH_2)))
+KEYBOARD_FOLDER_PATH_4 := $(patsubst %/,%,$(dir $(KEYBOARD_FOLDER_PATH_3)))
+KEYBOARD_FOLDER_PATH_5 := $(patsubst %/,%,$(dir $(KEYBOARD_FOLDER_PATH_4)))
+KEYBOARD_FOLDER_1 := $(notdir $(KEYBOARD_FOLDER_PATH_1))
+KEYBOARD_FOLDER_2 := $(notdir $(KEYBOARD_FOLDER_PATH_2))
+KEYBOARD_FOLDER_3 := $(notdir $(KEYBOARD_FOLDER_PATH_3))
+KEYBOARD_FOLDER_4 := $(notdir $(KEYBOARD_FOLDER_PATH_4))
+KEYBOARD_FOLDER_5 := $(notdir $(KEYBOARD_FOLDER_PATH_5))
+KEYBOARD_PATHS :=
+KEYBOARD_PATH_1 := keyboards/$(KEYBOARD_FOLDER_PATH_1)
+KEYBOARD_PATH_2 := keyboards/$(KEYBOARD_FOLDER_PATH_2)
+KEYBOARD_PATH_3 := keyboards/$(KEYBOARD_FOLDER_PATH_3)
+KEYBOARD_PATH_4 := keyboards/$(KEYBOARD_FOLDER_PATH_4)
+KEYBOARD_PATH_5 := keyboards/$(KEYBOARD_FOLDER_PATH_5)
+
+ifneq ("$(wildcard $(KEYBOARD_PATH_5)/)","")
+ KEYBOARD_PATHS += $(KEYBOARD_PATH_5)
+endif
+ifneq ("$(wildcard $(KEYBOARD_PATH_4)/)","")
+ KEYBOARD_PATHS += $(KEYBOARD_PATH_4)
+endif
+ifneq ("$(wildcard $(KEYBOARD_PATH_3)/)","")
+ KEYBOARD_PATHS += $(KEYBOARD_PATH_3)
+endif
+ifneq ("$(wildcard $(KEYBOARD_PATH_2)/)","")
+ KEYBOARD_PATHS += $(KEYBOARD_PATH_2)
+endif
+ifneq ("$(wildcard $(KEYBOARD_PATH_1)/)","")
+ KEYBOARD_PATHS += $(KEYBOARD_PATH_1)
+endif
+
+
+# Pull in rules.mk files from all our subfolders
+ifneq ("$(wildcard $(KEYBOARD_PATH_5)/rules.mk)","")
+ include $(KEYBOARD_PATH_5)/rules.mk
+endif
+ifneq ("$(wildcard $(KEYBOARD_PATH_4)/rules.mk)","")
+ include $(KEYBOARD_PATH_4)/rules.mk
+endif
+ifneq ("$(wildcard $(KEYBOARD_PATH_3)/rules.mk)","")
+ include $(KEYBOARD_PATH_3)/rules.mk
+endif
+ifneq ("$(wildcard $(KEYBOARD_PATH_2)/rules.mk)","")
+ include $(KEYBOARD_PATH_2)/rules.mk
+endif
+ifneq ("$(wildcard $(KEYBOARD_PATH_1)/rules.mk)","")
+ include $(KEYBOARD_PATH_1)/rules.mk
+endif
+
+MAIN_KEYMAP_PATH_1 := $(KEYBOARD_PATH_1)/keymaps/$(KEYMAP)
+MAIN_KEYMAP_PATH_2 := $(KEYBOARD_PATH_2)/keymaps/$(KEYMAP)
+MAIN_KEYMAP_PATH_3 := $(KEYBOARD_PATH_3)/keymaps/$(KEYMAP)
+MAIN_KEYMAP_PATH_4 := $(KEYBOARD_PATH_4)/keymaps/$(KEYMAP)
+MAIN_KEYMAP_PATH_5 := $(KEYBOARD_PATH_5)/keymaps/$(KEYMAP)
+
+# Pull in rules from info.json
+INFO_RULES_MK = $(shell $(QMK_BIN) generate-rules-mk --quiet --escape --keyboard $(KEYBOARD) --output $(KEYBOARD_OUTPUT)/src/info_rules.mk)
+include $(INFO_RULES_MK)
+
+# Check for keymap.json first, so we can regenerate keymap.c
+include $(BUILDDEFS_PATH)/build_json.mk
+
+# Pull in keymap level rules.mk
+ifeq ("$(wildcard $(KEYMAP_PATH))", "")
+ # Look through the possible keymap folders until we find a matching keymap.c
+ ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_5)/keymap.c)","")
+ -include $(MAIN_KEYMAP_PATH_5)/rules.mk
+ KEYMAP_C := $(MAIN_KEYMAP_PATH_5)/keymap.c
+ KEYMAP_PATH := $(MAIN_KEYMAP_PATH_5)
+ else ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_4)/keymap.c)","")
+ -include $(MAIN_KEYMAP_PATH_4)/rules.mk
+ KEYMAP_C := $(MAIN_KEYMAP_PATH_4)/keymap.c
+ KEYMAP_PATH := $(MAIN_KEYMAP_PATH_4)
+ else ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_3)/keymap.c)","")
+ -include $(MAIN_KEYMAP_PATH_3)/rules.mk
+ KEYMAP_C := $(MAIN_KEYMAP_PATH_3)/keymap.c
+ KEYMAP_PATH := $(MAIN_KEYMAP_PATH_3)
+ else ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_2)/keymap.c)","")
+ -include $(MAIN_KEYMAP_PATH_2)/rules.mk
+ KEYMAP_C := $(MAIN_KEYMAP_PATH_2)/keymap.c
+ KEYMAP_PATH := $(MAIN_KEYMAP_PATH_2)
+ else ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_1)/keymap.c)","")
+ -include $(MAIN_KEYMAP_PATH_1)/rules.mk
+ KEYMAP_C := $(MAIN_KEYMAP_PATH_1)/keymap.c
+ KEYMAP_PATH := $(MAIN_KEYMAP_PATH_1)
+ else ifneq ($(LAYOUTS),)
+ # If we haven't found a keymap yet fall back to community layouts
+ include $(BUILDDEFS_PATH)/build_layout.mk
+ else
+ $(call CATASTROPHIC_ERROR,Invalid keymap,Could not find keymap)
+ # this state should never be reached
+ endif
+endif
+
+# Have we found a keymap.json?
+ifneq ("$(wildcard $(KEYMAP_JSON))", "")
+ KEYMAP_C := $(KEYMAP_OUTPUT)/src/keymap.c
+ KEYMAP_H := $(KEYMAP_OUTPUT)/src/config.h
+
+ # Load the keymap-level rules.mk if exists
+ -include $(KEYMAP_PATH)/rules.mk
+
+ # Load any rules.mk content from keymap.json
+ INFO_RULES_MK = $(shell $(QMK_BIN) generate-rules-mk --quiet --escape --keyboard $(KEYBOARD) --keymap $(KEYMAP) --output $(KEYMAP_OUTPUT)/src/rules.mk)
+ include $(INFO_RULES_MK)
+
+# Add rules to generate the keymap files - indentation here is important
+$(KEYMAP_OUTPUT)/src/keymap.c: $(KEYMAP_JSON)
+ $(QMK_BIN) json2c --quiet --output $(KEYMAP_C) $(KEYMAP_JSON)
+
+$(KEYMAP_OUTPUT)/src/config.h: $(KEYMAP_JSON)
+ $(QMK_BIN) generate-config-h --quiet --keyboard $(KEYBOARD) --keymap $(KEYMAP) --output $(KEYMAP_H)
+
+generated-files: $(KEYMAP_OUTPUT)/src/config.h $(KEYMAP_OUTPUT)/src/keymap.c
+
+endif
+
+ifeq ($(strip $(CTPC)), yes)
+ CONVERT_TO_PROTON_C=yes
+endif
+
+ifeq ($(strip $(CONVERT_TO_PROTON_C)), yes)
+ include platforms/chibios/boards/QMK_PROTON_C/convert_to_proton_c.mk
+endif
+
+include $(BUILDDEFS_PATH)/mcu_selection.mk
+
+# Find all the C source files to be compiled in subfolders.
+KEYBOARD_SRC :=
+
+KEYBOARD_C_1 := $(KEYBOARD_PATH_1)/$(KEYBOARD_FOLDER_1).c
+KEYBOARD_C_2 := $(KEYBOARD_PATH_2)/$(KEYBOARD_FOLDER_2).c
+KEYBOARD_C_3 := $(KEYBOARD_PATH_3)/$(KEYBOARD_FOLDER_3).c
+KEYBOARD_C_4 := $(KEYBOARD_PATH_4)/$(KEYBOARD_FOLDER_4).c
+KEYBOARD_C_5 := $(KEYBOARD_PATH_5)/$(KEYBOARD_FOLDER_5).c
+
+ifneq ("$(wildcard $(KEYBOARD_C_5))","")
+ KEYBOARD_SRC += $(KEYBOARD_C_5)
+endif
+ifneq ("$(wildcard $(KEYBOARD_C_4))","")
+ KEYBOARD_SRC += $(KEYBOARD_C_4)
+endif
+ifneq ("$(wildcard $(KEYBOARD_C_3))","")
+ KEYBOARD_SRC += $(KEYBOARD_C_3)
+endif
+ifneq ("$(wildcard $(KEYBOARD_C_2))","")
+ KEYBOARD_SRC += $(KEYBOARD_C_2)
+endif
+ifneq ("$(wildcard $(KEYBOARD_C_1))","")
+ KEYBOARD_SRC += $(KEYBOARD_C_1)
+endif
+
+# Generate KEYBOARD_name_subname for all levels of the keyboard folder
+KEYBOARD_FILESAFE_1 := $(subst .,,$(subst /,_,$(KEYBOARD_FOLDER_PATH_1)))
+KEYBOARD_FILESAFE_2 := $(subst .,,$(subst /,_,$(KEYBOARD_FOLDER_PATH_2)))
+KEYBOARD_FILESAFE_3 := $(subst .,,$(subst /,_,$(KEYBOARD_FOLDER_PATH_3)))
+KEYBOARD_FILESAFE_4 := $(subst .,,$(subst /,_,$(KEYBOARD_FOLDER_PATH_4)))
+KEYBOARD_FILESAFE_5 := $(subst .,,$(subst /,_,$(KEYBOARD_FOLDER_PATH_5)))
+
+ifneq ("$(wildcard $(KEYBOARD_PATH_5)/)","")
+ OPT_DEFS += -DKEYBOARD_$(KEYBOARD_FILESAFE_5)
+endif
+ifneq ("$(wildcard $(KEYBOARD_PATH_4)/)","")
+ OPT_DEFS += -DKEYBOARD_$(KEYBOARD_FILESAFE_4)
+endif
+ifneq ("$(wildcard $(KEYBOARD_PATH_3)/)","")
+ OPT_DEFS += -DKEYBOARD_$(KEYBOARD_FILESAFE_3)
+endif
+ifneq ("$(wildcard $(KEYBOARD_PATH_2)/)","")
+ OPT_DEFS += -DKEYBOARD_$(KEYBOARD_FILESAFE_2)
+endif
+ifneq ("$(wildcard $(KEYBOARD_PATH_1)/)","")
+ OPT_DEFS += -DKEYBOARD_$(KEYBOARD_FILESAFE_1)
+endif
+
+# Setup the define for QMK_KEYBOARD_H. This is used inside of keymaps so
+# that the same keymap may be used on multiple keyboards.
+#
+# We grab the most top-level include file that we can. That file should
+# use #ifdef statements to include all the neccesary subfolder includes,
+# as described here:
+#
+# https://docs.qmk.fm/#/feature_layouts?id=tips-for-making-layouts-keyboard-agnostic
+#
+QMK_KEYBOARD_H = $(KEYBOARD_OUTPUT)/src/default_keyboard.h
+ifneq ("$(wildcard $(KEYBOARD_PATH_1)/$(KEYBOARD_FOLDER_1).h)","")
+ QMK_KEYBOARD_H = $(KEYBOARD_FOLDER_1).h
+endif
+ifneq ("$(wildcard $(KEYBOARD_PATH_2)/$(KEYBOARD_FOLDER_2).h)","")
+ QMK_KEYBOARD_H = $(KEYBOARD_FOLDER_2).h
+endif
+ifneq ("$(wildcard $(KEYBOARD_PATH_3)/$(KEYBOARD_FOLDER_3).h)","")
+ QMK_KEYBOARD_H = $(KEYBOARD_FOLDER_3).h
+endif
+ifneq ("$(wildcard $(KEYBOARD_PATH_4)/$(KEYBOARD_FOLDER_4).h)","")
+ QMK_KEYBOARD_H = $(KEYBOARD_FOLDER_4).h
+endif
+ifneq ("$(wildcard $(KEYBOARD_PATH_5)/$(KEYBOARD_FOLDER_5).h)","")
+ QMK_KEYBOARD_H = $(KEYBOARD_FOLDER_5).h
+endif
+
+# Determine and set parameters based on the keyboard's processor family.
+# We can assume a ChibiOS target When MCU_FAMILY is defined since it's
+# not used for LUFA
+ifdef MCU_FAMILY
+ PLATFORM=CHIBIOS
+ PLATFORM_KEY=chibios
+ FIRMWARE_FORMAT?=bin
+ OPT_DEFS += -DMCU_$(MCU_FAMILY)
+else ifdef ARM_ATSAM
+ PLATFORM=ARM_ATSAM
+ PLATFORM_KEY=arm_atsam
+ FIRMWARE_FORMAT=bin
+else
+ PLATFORM=AVR
+ PLATFORM_KEY=avr
+ FIRMWARE_FORMAT?=hex
+endif
+
+# Find all of the config.h files and add them to our CONFIG_H define.
+CONFIG_H :=
+ifneq ("$(wildcard $(KEYBOARD_PATH_5)/config.h)","")
+ CONFIG_H += $(KEYBOARD_PATH_5)/config.h
+endif
+ifneq ("$(wildcard $(KEYBOARD_PATH_4)/config.h)","")
+ CONFIG_H += $(KEYBOARD_PATH_4)/config.h
+endif
+ifneq ("$(wildcard $(KEYBOARD_PATH_3)/config.h)","")
+ CONFIG_H += $(KEYBOARD_PATH_3)/config.h
+endif
+ifneq ("$(wildcard $(KEYBOARD_PATH_2)/config.h)","")
+ CONFIG_H += $(KEYBOARD_PATH_2)/config.h
+endif
+ifneq ("$(wildcard $(KEYBOARD_PATH_1)/config.h)","")
+ CONFIG_H += $(KEYBOARD_PATH_1)/config.h
+endif
+
+POST_CONFIG_H :=
+ifneq ("$(wildcard $(KEYBOARD_PATH_1)/post_config.h)","")
+ POST_CONFIG_H += $(KEYBOARD_PATH_1)/post_config.h
+endif
+ifneq ("$(wildcard $(KEYBOARD_PATH_2)/post_config.h)","")
+ POST_CONFIG_H += $(KEYBOARD_PATH_2)/post_config.h
+endif
+ifneq ("$(wildcard $(KEYBOARD_PATH_3)/post_config.h)","")
+ POST_CONFIG_H += $(KEYBOARD_PATH_3)/post_config.h
+endif
+ifneq ("$(wildcard $(KEYBOARD_PATH_4)/post_config.h)","")
+ POST_CONFIG_H += $(KEYBOARD_PATH_4)/post_config.h
+endif
+ifneq ("$(wildcard $(KEYBOARD_PATH_5)/post_config.h)","")
+ POST_CONFIG_H += $(KEYBOARD_PATH_5)/post_config.h
+endif
+
+# Pull in stuff from info.json
+INFO_JSON_FILES :=
+ifneq ("$(wildcard $(KEYBOARD_PATH_1)/info.json)","")
+ INFO_JSON_FILES += $(KEYBOARD_PATH_1)/info.json
+endif
+ifneq ("$(wildcard $(KEYBOARD_PATH_2)/info.json)","")
+ INFO_JSON_FILES += $(KEYBOARD_PATH_2)/info.json
+endif
+ifneq ("$(wildcard $(KEYBOARD_PATH_3)/info.json)","")
+ INFO_JSON_FILES += $(KEYBOARD_PATH_3)/info.json
+endif
+ifneq ("$(wildcard $(KEYBOARD_PATH_4)/info.json)","")
+ INFO_JSON_FILES += $(KEYBOARD_PATH_4)/info.json
+endif
+ifneq ("$(wildcard $(KEYBOARD_PATH_5)/info.json)","")
+ INFO_JSON_FILES += $(KEYBOARD_PATH_5)/info.json
+endif
+
+CONFIG_H += $(KEYBOARD_OUTPUT)/src/info_config.h $(KEYBOARD_OUTPUT)/src/layouts.h
+
+$(KEYBOARD_OUTPUT)/src/info_config.h: $(INFO_JSON_FILES)
+ $(QMK_BIN) generate-config-h --quiet --keyboard $(KEYBOARD) --output $(KEYBOARD_OUTPUT)/src/info_config.h
+
+$(KEYBOARD_OUTPUT)/src/default_keyboard.h: $(INFO_JSON_FILES)
+ $(QMK_BIN) generate-keyboard-h --quiet --keyboard $(KEYBOARD) --output $(KEYBOARD_OUTPUT)/src/default_keyboard.h
+
+$(KEYBOARD_OUTPUT)/src/layouts.h: $(INFO_JSON_FILES)
+ $(QMK_BIN) generate-layouts --quiet --keyboard $(KEYBOARD) --output $(KEYBOARD_OUTPUT)/src/layouts.h
+
+generated-files: $(KEYBOARD_OUTPUT)/src/info_config.h $(KEYBOARD_OUTPUT)/src/default_keyboard.h $(KEYBOARD_OUTPUT)/src/layouts.h
+
+.INTERMEDIATE : generated-files
+
+# Userspace setup and definitions
+ifeq ("$(USER_NAME)","")
+ USER_NAME := $(KEYMAP)
+endif
+USER_PATH := users/$(USER_NAME)
+
+# Pull in user level rules.mk
+-include $(USER_PATH)/rules.mk
+ifneq ("$(wildcard $(USER_PATH)/config.h)","")
+ CONFIG_H += $(USER_PATH)/config.h
+endif
+ifneq ("$(wildcard $(USER_PATH)/post_config.h)","")
+ POST_CONFIG_H += $(USER_PATH)/post_config.h
+endif
+
+# Disable features that a keyboard doesn't support
+-include $(BUILDDEFS_PATH)/disable_features.mk
+
+# Pull in post_rules.mk files from all our subfolders
+ifneq ("$(wildcard $(KEYBOARD_PATH_1)/post_rules.mk)","")
+ include $(KEYBOARD_PATH_1)/post_rules.mk
+endif
+ifneq ("$(wildcard $(KEYBOARD_PATH_2)/post_rules.mk)","")
+ include $(KEYBOARD_PATH_2)/post_rules.mk
+endif
+ifneq ("$(wildcard $(KEYBOARD_PATH_3)/post_rules.mk)","")
+ include $(KEYBOARD_PATH_3)/post_rules.mk
+endif
+ifneq ("$(wildcard $(KEYBOARD_PATH_4)/post_rules.mk)","")
+ include $(KEYBOARD_PATH_4)/post_rules.mk
+endif
+ifneq ("$(wildcard $(KEYBOARD_PATH_5)/post_rules.mk)","")
+ include $(KEYBOARD_PATH_5)/post_rules.mk
+endif
+
+ifneq ("$(wildcard $(KEYMAP_PATH)/config.h)","")
+ CONFIG_H += $(KEYMAP_PATH)/config.h
+endif
+ifneq ("$(KEYMAP_H)","")
+ CONFIG_H += $(KEYMAP_H)
+endif
+
+# project specific files
+SRC += \
+ $(KEYBOARD_SRC) \
+ $(KEYMAP_C) \
+ $(QUANTUM_SRC) \
+ $(QUANTUM_DIR)/main.c \
+
+# Optimize size but this may cause error "relocation truncated to fit"
+#EXTRALDFLAGS = -Wl,--relax
+
+# Search Path
+VPATH += $(KEYMAP_PATH)
+VPATH += $(USER_PATH)
+VPATH += $(KEYBOARD_PATHS)
+VPATH += $(COMMON_VPATH)
+VPATH += $(KEYBOARD_OUTPUT)/src
+VPATH += $(KEYMAP_OUTPUT)/src
+
+include $(BUILDDEFS_PATH)/common_features.mk
+include $(BUILDDEFS_PATH)/generic_features.mk
+include $(TMK_PATH)/protocol.mk
+include $(PLATFORM_PATH)/common.mk
+include $(BUILDDEFS_PATH)/bootloader.mk
+
+SRC += $(patsubst %.c,%.clib,$(LIB_SRC))
+SRC += $(patsubst %.c,%.clib,$(QUANTUM_LIB_SRC))
+SRC += $(TMK_COMMON_SRC)
+OPT_DEFS += $(TMK_COMMON_DEFS)
+EXTRALDFLAGS += $(TMK_COMMON_LDFLAGS)
+
+SKIP_COMPILE := no
+ifneq ($(REQUIRE_PLATFORM_KEY),)
+ ifneq ($(REQUIRE_PLATFORM_KEY),$(PLATFORM_KEY))
+ SKIP_COMPILE := yes
+ endif
+endif
+
+include $(PLATFORM_PATH)/$(PLATFORM_KEY)/platform.mk
+-include $(PLATFORM_PATH)/$(PLATFORM_KEY)/flash.mk
+
+ifneq ($(strip $(PROTOCOL)),)
+ include $(TMK_PATH)/protocol/$(strip $(shell echo $(PROTOCOL) | tr '[:upper:]' '[:lower:]')).mk
+else
+ include $(TMK_PATH)/protocol/$(PLATFORM_KEY).mk
+endif
+
+# TODO: remove this bodge?
+PROJECT_DEFS := $(OPT_DEFS)
+PROJECT_INC := $(VPATH) $(EXTRAINCDIRS) $(KEYBOARD_PATHS)
+PROJECT_CONFIG := $(CONFIG_H)
+
+CONFIG_H += $(POST_CONFIG_H)
+ALL_CONFIGS := $(PROJECT_CONFIG) $(CONFIG_H)
+
+OUTPUTS := $(KEYMAP_OUTPUT) $(KEYBOARD_OUTPUT)
+$(KEYMAP_OUTPUT)_SRC := $(SRC)
+$(KEYMAP_OUTPUT)_DEFS := $(OPT_DEFS) \
+-DQMK_KEYBOARD=\"$(KEYBOARD)\" -DQMK_KEYBOARD_H=\"$(QMK_KEYBOARD_H)\" \
+-DQMK_KEYMAP=\"$(KEYMAP)\" -DQMK_KEYMAP_H=\"$(KEYMAP).h\" -DQMK_KEYMAP_CONFIG_H=\"$(KEYMAP_PATH)/config.h\"
+$(KEYMAP_OUTPUT)_INC := $(VPATH) $(EXTRAINCDIRS)
+$(KEYMAP_OUTPUT)_CONFIG := $(CONFIG_H)
+$(KEYBOARD_OUTPUT)_SRC := $(PLATFORM_SRC)
+$(KEYBOARD_OUTPUT)_DEFS := $(PROJECT_DEFS)
+$(KEYBOARD_OUTPUT)_INC := $(PROJECT_INC)
+$(KEYBOARD_OUTPUT)_CONFIG := $(PROJECT_CONFIG)
+
+# Default target.
+ifeq ($(SKIP_COMPILE),no)
+all: build check-size
+else
+all:
+ echo "skipped" >&2
+endif
+
+build: elf cpfirmware
+check-size: build
+check-md5: build
+objs-size: build
+
+include $(BUILDDEFS_PATH)/show_options.mk
+include $(BUILDDEFS_PATH)/common_rules.mk
+
+# Ensure we have generated files available for each of the objects
+define GEN_FILES
+$1: generated-files
+endef
+$(foreach O,$(OBJ),$(eval $(call GEN_FILES,$(patsubst %.a,%.o,$(O)))))
diff --git a/builddefs/build_layout.mk b/builddefs/build_layout.mk
new file mode 100644
index 0000000000..6166bd847c
--- /dev/null
+++ b/builddefs/build_layout.mk
@@ -0,0 +1,32 @@
+LAYOUTS_PATH := layouts
+LAYOUTS_REPOS := $(patsubst %/,%,$(sort $(dir $(wildcard $(LAYOUTS_PATH)/*/))))
+
+define SEARCH_LAYOUTS_REPO
+ LAYOUT_KEYMAP_PATH := $$(LAYOUTS_REPO)/$$(LAYOUT)/$$(KEYMAP)
+ LAYOUT_KEYMAP_JSON := $$(LAYOUT_KEYMAP_PATH)/keymap.json
+ LAYOUT_KEYMAP_C := $$(LAYOUT_KEYMAP_PATH)/keymap.c
+ ifneq ("$$(wildcard $$(LAYOUT_KEYMAP_JSON))","")
+ -include $$(LAYOUT_KEYMAP_PATH)/rules.mk
+ KEYMAP_JSON := $$(LAYOUT_KEYMAP_JSON)
+ KEYMAP_PATH := $$(LAYOUT_KEYMAP_PATH)
+ else ifneq ("$$(wildcard $$(LAYOUT_KEYMAP_C))","")
+ -include $$(LAYOUT_KEYMAP_PATH)/rules.mk
+ KEYMAP_C := $$(LAYOUT_KEYMAP_C)
+ KEYMAP_PATH := $$(LAYOUT_KEYMAP_PATH)
+ endif
+endef
+
+define SEARCH_LAYOUTS
+ $$(foreach LAYOUTS_REPO,$$(LAYOUTS_REPOS),$$(eval $$(call SEARCH_LAYOUTS_REPO)))
+endef
+
+ifneq ($(FORCE_LAYOUT),)
+ ifneq (,$(findstring $(FORCE_LAYOUT),$(LAYOUTS)))
+ $(info Forcing layout: $(FORCE_LAYOUT))
+ LAYOUTS := $(FORCE_LAYOUT)
+ else
+ $(call CATASTROPHIC_ERROR,Invalid layout,Forced layout does not exist)
+ endif
+endif
+
+$(foreach LAYOUT,$(LAYOUTS),$(eval $(call SEARCH_LAYOUTS)))
diff --git a/builddefs/build_test.mk b/builddefs/build_test.mk
new file mode 100644
index 0000000000..7226004aab
--- /dev/null
+++ b/builddefs/build_test.mk
@@ -0,0 +1,84 @@
+ifndef VERBOSE
+.SILENT:
+endif
+
+.DEFAULT_GOAL := all
+
+include paths.mk
+include $(BUILDDEFS_PATH)/message.mk
+
+TARGET=test/$(TEST)
+
+GTEST_OUTPUT = $(BUILD_DIR)/gtest
+
+TEST_OBJ = $(BUILD_DIR)/test_obj
+
+OUTPUTS := $(TEST_OBJ)/$(TEST) $(GTEST_OUTPUT)
+
+GTEST_INC := \
+ $(LIB_PATH)/googletest/googletest/include \
+ $(LIB_PATH)/googletest/googlemock/include
+
+GTEST_INTERNAL_INC := \
+ $(LIB_PATH)/googletest/googletest \
+ $(LIB_PATH)/googletest/googlemock
+
+$(GTEST_OUTPUT)_SRC := \
+ googletest/src/gtest-all.cc\
+ googlemock/src/gmock-all.cc
+
+$(GTEST_OUTPUT)_DEFS :=
+$(GTEST_OUTPUT)_INC := $(GTEST_INC) $(GTEST_INTERNAL_INC)
+
+LDFLAGS += -lstdc++ -lpthread -shared-libgcc
+CREATE_MAP := no
+
+VPATH += \
+ $(LIB_PATH)/googletest \
+ $(LIB_PATH)/googlemock \
+ $(LIB_PATH)/printf
+
+all: elf
+
+VPATH += $(COMMON_VPATH)
+PLATFORM:=TEST
+PLATFORM_KEY:=test
+BOOTLOADER_TYPE:=none
+
+ifeq ($(strip $(DEBUG)), 1)
+CONSOLE_ENABLE = yes
+endif
+
+ifneq ($(filter $(FULL_TESTS),$(TEST)),)
+include tests/test_common/build.mk
+include $(TEST_PATH)/test.mk
+endif
+
+include $(BUILDDEFS_PATH)/common_features.mk
+include $(BUILDDEFS_PATH)/generic_features.mk
+include $(PLATFORM_PATH)/common.mk
+include $(TMK_PATH)/protocol.mk
+include $(QUANTUM_PATH)/debounce/tests/rules.mk
+include $(QUANTUM_PATH)/encoder/tests/rules.mk
+include $(QUANTUM_PATH)/sequencer/tests/rules.mk
+include $(PLATFORM_PATH)/test/rules.mk
+ifneq ($(filter $(FULL_TESTS),$(TEST)),)
+include $(BUILDDEFS_PATH)/build_full_test.mk
+endif
+
+$(TEST)_SRC += \
+ tests/test_common/main.c \
+ $(LIB_PATH)/printf/printf.c \
+ $(QUANTUM_PATH)/logging/print.c
+
+$(TEST_OBJ)/$(TEST)_SRC := $($(TEST)_SRC)
+$(TEST_OBJ)/$(TEST)_INC := $($(TEST)_INC) $(VPATH) $(GTEST_INC)
+$(TEST_OBJ)/$(TEST)_DEFS := $($(TEST)_DEFS)
+$(TEST_OBJ)/$(TEST)_CONFIG := $($(TEST)_CONFIG)
+
+include $(PLATFORM_PATH)/$(PLATFORM_KEY)/platform.mk
+include $(BUILDDEFS_PATH)/common_rules.mk
+
+
+$(shell mkdir -p $(BUILD_DIR)/test 2>/dev/null)
+$(shell mkdir -p $(TEST_OBJ) 2>/dev/null)
diff --git a/builddefs/common_features.mk b/builddefs/common_features.mk
new file mode 100644
index 0000000000..7ff19e8084
--- /dev/null
+++ b/builddefs/common_features.mk
@@ -0,0 +1,801 @@
+# Copyright 2017 Fred Sundvik
+#
+# 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 .
+
+QUANTUM_SRC += \
+ $(QUANTUM_DIR)/quantum.c \
+ $(QUANTUM_DIR)/send_string.c \
+ $(QUANTUM_DIR)/bitwise.c \
+ $(QUANTUM_DIR)/led.c \
+ $(QUANTUM_DIR)/action.c \
+ $(QUANTUM_DIR)/action_layer.c \
+ $(QUANTUM_DIR)/action_tapping.c \
+ $(QUANTUM_DIR)/action_util.c \
+ $(QUANTUM_DIR)/eeconfig.c \
+ $(QUANTUM_DIR)/keyboard.c \
+ $(QUANTUM_DIR)/keymap_common.c \
+ $(QUANTUM_DIR)/keycode_config.c \
+ $(QUANTUM_DIR)/sync_timer.c \
+ $(QUANTUM_DIR)/logging/debug.c \
+ $(QUANTUM_DIR)/logging/sendchar.c \
+
+VPATH += $(QUANTUM_DIR)/logging
+# Fall back to lib/printf if there is no platform provided print
+ifeq ("$(wildcard $(PLATFORM_PATH)/$(PLATFORM_KEY)/printf.mk)","")
+ include $(QUANTUM_PATH)/logging/print.mk
+else
+ include $(PLATFORM_PATH)/$(PLATFORM_KEY)/printf.mk
+endif
+
+ifeq ($(strip $(DEBUG_MATRIX_SCAN_RATE_ENABLE)), yes)
+ OPT_DEFS += -DDEBUG_MATRIX_SCAN_RATE
+ CONSOLE_ENABLE = yes
+else ifeq ($(strip $(DEBUG_MATRIX_SCAN_RATE_ENABLE)), api)
+ OPT_DEFS += -DDEBUG_MATRIX_SCAN_RATE
+endif
+
+AUDIO_ENABLE ?= no
+ifeq ($(strip $(AUDIO_ENABLE)), yes)
+ ifeq ($(PLATFORM),CHIBIOS)
+ AUDIO_DRIVER ?= dac_basic
+ ifeq ($(strip $(AUDIO_DRIVER)), dac_basic)
+ OPT_DEFS += -DAUDIO_DRIVER_DAC
+ else ifeq ($(strip $(AUDIO_DRIVER)), dac_additive)
+ OPT_DEFS += -DAUDIO_DRIVER_DAC
+ ## stm32f2 and above have a usable DAC unit, f1 do not, and need to use pwm instead
+ else ifeq ($(strip $(AUDIO_DRIVER)), pwm_software)
+ OPT_DEFS += -DAUDIO_DRIVER_PWM
+ else ifeq ($(strip $(AUDIO_DRIVER)), pwm_hardware)
+ OPT_DEFS += -DAUDIO_DRIVER_PWM
+ endif
+ else
+ # fallback for all other platforms is pwm
+ AUDIO_DRIVER ?= pwm_hardware
+ OPT_DEFS += -DAUDIO_DRIVER_PWM
+ endif
+ OPT_DEFS += -DAUDIO_ENABLE
+ MUSIC_ENABLE = yes
+ SRC += $(QUANTUM_DIR)/process_keycode/process_audio.c
+ SRC += $(QUANTUM_DIR)/process_keycode/process_clicky.c
+ SRC += $(QUANTUM_DIR)/audio/audio.c ## common audio code, hardware agnostic
+ SRC += $(PLATFORM_PATH)/$(PLATFORM_KEY)/$(DRIVER_DIR)/audio_$(strip $(AUDIO_DRIVER)).c
+ SRC += $(QUANTUM_DIR)/audio/voices.c
+ SRC += $(QUANTUM_DIR)/audio/luts.c
+endif
+
+ifeq ($(strip $(SEQUENCER_ENABLE)), yes)
+ OPT_DEFS += -DSEQUENCER_ENABLE
+ MUSIC_ENABLE = yes
+ SRC += $(QUANTUM_DIR)/sequencer/sequencer.c
+ SRC += $(QUANTUM_DIR)/process_keycode/process_sequencer.c
+endif
+
+ifeq ($(strip $(MIDI_ENABLE)), yes)
+ OPT_DEFS += -DMIDI_ENABLE
+ MUSIC_ENABLE = yes
+ SRC += $(QUANTUM_DIR)/process_keycode/process_midi.c
+endif
+
+MUSIC_ENABLE ?= no
+ifeq ($(MUSIC_ENABLE), yes)
+ SRC += $(QUANTUM_DIR)/process_keycode/process_music.c
+endif
+
+ifeq ($(strip $(STENO_ENABLE)), yes)
+ OPT_DEFS += -DSTENO_ENABLE
+ VIRTSER_ENABLE ?= yes
+ SRC += $(QUANTUM_DIR)/process_keycode/process_steno.c
+endif
+
+ifeq ($(strip $(VIRTSER_ENABLE)), yes)
+ OPT_DEFS += -DVIRTSER_ENABLE
+endif
+
+ifeq ($(strip $(MOUSEKEY_ENABLE)), yes)
+ OPT_DEFS += -DMOUSEKEY_ENABLE
+ MOUSE_ENABLE := yes
+ SRC += $(QUANTUM_DIR)/mousekey.c
+endif
+
+VALID_POINTING_DEVICE_DRIVER_TYPES := adns5050 adns9800 analog_joystick cirque_pinnacle_i2c cirque_pinnacle_spi pmw3360 pmw3389 pimoroni_trackball custom
+ifeq ($(strip $(POINTING_DEVICE_ENABLE)), yes)
+ ifeq ($(filter $(POINTING_DEVICE_DRIVER),$(VALID_POINTING_DEVICE_DRIVER_TYPES)),)
+ $(call CATASTROPHIC_ERROR,Invalid POINTING_DEVICE_DRIVER,POINTING_DEVICE_DRIVER="$(POINTING_DEVICE_DRIVER)" is not a valid pointing device type)
+ else
+ OPT_DEFS += -DPOINTING_DEVICE_ENABLE
+ MOUSE_ENABLE := yes
+ SRC += $(QUANTUM_DIR)/pointing_device.c
+ SRC += $(QUANTUM_DIR)/pointing_device_drivers.c
+ ifneq ($(strip $(POINTING_DEVICE_DRIVER)), custom)
+ SRC += drivers/sensors/$(strip $(POINTING_DEVICE_DRIVER)).c
+ OPT_DEFS += -DPOINTING_DEVICE_DRIVER_$(strip $(shell echo $(POINTING_DEVICE_DRIVER) | tr '[:lower:]' '[:upper:]'))
+ endif
+ OPT_DEFS += -DPOINTING_DEVICE_DRIVER_$(strip $(POINTING_DEVICE_DRIVER))
+ ifeq ($(strip $(POINTING_DEVICE_DRIVER)), adns9800)
+ OPT_DEFS += -DSTM32_SPI -DHAL_USE_SPI=TRUE
+ QUANTUM_LIB_SRC += spi_master.c
+ else ifeq ($(strip $(POINTING_DEVICE_DRIVER)), analog_joystick)
+ OPT_DEFS += -DSTM32_ADC -DHAL_USE_ADC=TRUE
+ LIB_SRC += analog.c
+ else ifeq ($(strip $(POINTING_DEVICE_DRIVER)), cirque_pinnacle_i2c)
+ OPT_DEFS += -DSTM32_I2C -DHAL_USE_I2C=TRUE
+ SRC += drivers/sensors/cirque_pinnacle.c
+ QUANTUM_LIB_SRC += i2c_master.c
+ else ifeq ($(strip $(POINTING_DEVICE_DRIVER)), cirque_pinnacle_spi)
+ OPT_DEFS += -DSTM32_SPI -DHAL_USE_SPI=TRUE
+ SRC += drivers/sensors/cirque_pinnacle.c
+ QUANTUM_LIB_SRC += spi_master.c
+ else ifeq ($(strip $(POINTING_DEVICE_DRIVER)), pimoroni_trackball)
+ OPT_DEFS += -DSTM32_SPI -DHAL_USE_I2C=TRUE
+ QUANTUM_LIB_SRC += i2c_master.c
+ else ifeq ($(strip $(POINTING_DEVICE_DRIVER)), pmw3360)
+ OPT_DEFS += -DSTM32_SPI -DHAL_USE_SPI=TRUE
+ QUANTUM_LIB_SRC += spi_master.c
+ else ifeq ($(strip $(POINTING_DEVICE_DRIVER)), pmw3389)
+ OPT_DEFS += -DSTM32_SPI -DHAL_USE_SPI=TRUE
+ QUANTUM_LIB_SRC += spi_master.c
+ endif
+ endif
+endif
+
+VALID_EEPROM_DRIVER_TYPES := vendor custom transient i2c spi
+EEPROM_DRIVER ?= vendor
+ifeq ($(filter $(EEPROM_DRIVER),$(VALID_EEPROM_DRIVER_TYPES)),)
+ $(call CATASTROPHIC_ERROR,Invalid EEPROM_DRIVER,EEPROM_DRIVER="$(EEPROM_DRIVER)" is not a valid EEPROM driver)
+else
+ OPT_DEFS += -DEEPROM_ENABLE
+ ifeq ($(strip $(EEPROM_DRIVER)), custom)
+ # Custom EEPROM implementation -- only needs to implement init/erase/read_block/write_block
+ OPT_DEFS += -DEEPROM_DRIVER -DEEPROM_CUSTOM
+ COMMON_VPATH += $(DRIVER_PATH)/eeprom
+ SRC += eeprom_driver.c
+ else ifeq ($(strip $(EEPROM_DRIVER)), i2c)
+ # External I2C EEPROM implementation
+ OPT_DEFS += -DEEPROM_DRIVER -DEEPROM_I2C
+ COMMON_VPATH += $(DRIVER_PATH)/eeprom
+ QUANTUM_LIB_SRC += i2c_master.c
+ SRC += eeprom_driver.c eeprom_i2c.c
+ else ifeq ($(strip $(EEPROM_DRIVER)), spi)
+ # External SPI EEPROM implementation
+ OPT_DEFS += -DEEPROM_DRIVER -DEEPROM_SPI
+ COMMON_VPATH += $(DRIVER_PATH)/eeprom
+ QUANTUM_LIB_SRC += spi_master.c
+ SRC += eeprom_driver.c eeprom_spi.c
+ else ifeq ($(strip $(EEPROM_DRIVER)), transient)
+ # Transient EEPROM implementation -- no data storage but provides runtime area for it
+ OPT_DEFS += -DEEPROM_DRIVER -DEEPROM_TRANSIENT
+ COMMON_VPATH += $(DRIVER_PATH)/eeprom
+ SRC += eeprom_driver.c eeprom_transient.c
+ else ifeq ($(strip $(EEPROM_DRIVER)), vendor)
+ # Vendor-implemented EEPROM
+ OPT_DEFS += -DEEPROM_VENDOR
+ ifeq ($(PLATFORM),AVR)
+ # Automatically provided by avr-libc, nothing required
+ else ifeq ($(PLATFORM),CHIBIOS)
+ ifneq ($(filter STM32F3xx_% STM32F1xx_% %_STM32F401xC %_STM32F401xE %_STM32F405xG %_STM32F411xE %_STM32F072xB %_STM32F042x6 %_GD32VF103xB %_GD32VF103x8, $(MCU_SERIES)_$(MCU_LDSCRIPT)),)
+ # Emulated EEPROM
+ OPT_DEFS += -DEEPROM_DRIVER -DEEPROM_STM32_FLASH_EMULATED
+ COMMON_VPATH += $(DRIVER_PATH)/eeprom
+ SRC += eeprom_driver.c
+ SRC += $(PLATFORM_COMMON_DIR)/eeprom_stm32.c
+ SRC += $(PLATFORM_COMMON_DIR)/flash_stm32.c
+ else ifneq ($(filter $(MCU_SERIES),STM32L0xx STM32L1xx),)
+ # True EEPROM on STM32L0xx, L1xx
+ OPT_DEFS += -DEEPROM_DRIVER -DEEPROM_STM32_L0_L1
+ COMMON_VPATH += $(DRIVER_PATH)/eeprom
+ COMMON_VPATH += $(PLATFORM_PATH)/$(PLATFORM_KEY)/$(DRIVER_DIR)/eeprom
+ SRC += eeprom_driver.c
+ SRC += eeprom_stm32_L0_L1.c
+ else ifneq ($(filter $(MCU_SERIES),KL2x K20x),)
+ # Teensy EEPROM implementations
+ OPT_DEFS += -DEEPROM_TEENSY
+ SRC += eeprom_teensy.c
+ else
+ # Fall back to transient, i.e. non-persistent
+ OPT_DEFS += -DEEPROM_DRIVER -DEEPROM_TRANSIENT
+ COMMON_VPATH += $(DRIVER_PATH)/eeprom
+ SRC += eeprom_driver.c eeprom_transient.c
+ endif
+ else ifeq ($(PLATFORM),ARM_ATSAM)
+ # arm_atsam EEPROM
+ OPT_DEFS += -DEEPROM_SAMD
+ SRC += $(PLATFORM_COMMON_DIR)/eeprom_samd.c
+ else ifeq ($(PLATFORM),TEST)
+ # Test harness "EEPROM"
+ OPT_DEFS += -DEEPROM_TEST_HARNESS
+ SRC += $(PLATFORM_COMMON_DIR)/eeprom.c
+ endif
+ endif
+endif
+
+RGBLIGHT_ENABLE ?= no
+VALID_RGBLIGHT_TYPES := WS2812 APA102 custom
+
+ifeq ($(strip $(RGBLIGHT_CUSTOM_DRIVER)), yes)
+ RGBLIGHT_DRIVER ?= custom
+endif
+
+ifeq ($(strip $(RGBLIGHT_ENABLE)), yes)
+ RGBLIGHT_DRIVER ?= WS2812
+
+ ifeq ($(filter $(RGBLIGHT_DRIVER),$(VALID_RGBLIGHT_TYPES)),)
+ $(call CATASTROPHIC_ERROR,Invalid RGBLIGHT_DRIVER,RGBLIGHT_DRIVER="$(RGBLIGHT_DRIVER)" is not a valid RGB type)
+ else
+ COMMON_VPATH += $(QUANTUM_DIR)/rgblight
+ POST_CONFIG_H += $(QUANTUM_DIR)/rgblight/rgblight_post_config.h
+ OPT_DEFS += -DRGBLIGHT_ENABLE
+ SRC += $(QUANTUM_DIR)/color.c
+ SRC += $(QUANTUM_DIR)/rgblight/rgblight.c
+ CIE1931_CURVE := yes
+ RGB_KEYCODES_ENABLE := yes
+ endif
+
+ ifeq ($(strip $(RGBLIGHT_DRIVER)), WS2812)
+ WS2812_DRIVER_REQUIRED := yes
+ endif
+
+ ifeq ($(strip $(RGBLIGHT_DRIVER)), APA102)
+ APA102_DRIVER_REQUIRED := yes
+ endif
+
+ ifeq ($(strip $(RGBLIGHT_DRIVER)), custom)
+ OPT_DEFS += -DRGBLIGHT_CUSTOM_DRIVER
+ endif
+endif
+
+LED_MATRIX_ENABLE ?= no
+VALID_LED_MATRIX_TYPES := IS31FL3731 IS31FL3742A IS31FL3743A IS31FL3745 IS31FL3746A custom
+# TODO: IS31FL3733 IS31FL3737 IS31FL3741
+
+ifeq ($(strip $(LED_MATRIX_ENABLE)), yes)
+ ifeq ($(filter $(LED_MATRIX_DRIVER),$(VALID_LED_MATRIX_TYPES)),)
+ $(call CATASTROPHIC_ERROR,Invalid LED_MATRIX_DRIVER,LED_MATRIX_DRIVER="$(LED_MATRIX_DRIVER)" is not a valid matrix type)
+ endif
+ OPT_DEFS += -DLED_MATRIX_ENABLE
+ifneq (,$(filter $(MCU), atmega16u2 atmega32u2 at90usb162))
+ # ATmegaxxU2 does not have hardware MUL instruction - lib8tion must be told to use software multiplication routines
+ OPT_DEFS += -DLIB8_ATTINY
+endif
+ COMMON_VPATH += $(QUANTUM_DIR)/led_matrix
+ COMMON_VPATH += $(QUANTUM_DIR)/led_matrix/animations
+ COMMON_VPATH += $(QUANTUM_DIR)/led_matrix/animations/runners
+ SRC += $(QUANTUM_DIR)/process_keycode/process_backlight.c
+ SRC += $(QUANTUM_DIR)/led_matrix/led_matrix.c
+ SRC += $(QUANTUM_DIR)/led_matrix/led_matrix_drivers.c
+ SRC += $(LIB_PATH)/lib8tion/lib8tion.c
+ CIE1931_CURVE := yes
+
+ ifeq ($(strip $(LED_MATRIX_DRIVER)), IS31FL3731)
+ OPT_DEFS += -DIS31FL3731 -DSTM32_I2C -DHAL_USE_I2C=TRUE
+ COMMON_VPATH += $(DRIVER_PATH)/led/issi
+ SRC += is31fl3731-simple.c
+ QUANTUM_LIB_SRC += i2c_master.c
+ endif
+
+ ifeq ($(strip $(LED_MATRIX_DRIVER)), IS31FL3742A)
+ OPT_DEFS += -DIS31FLCOMMON -DIS31FL3742A -DSTM32_I2C -DHAL_USE_I2C=TRUE
+ COMMON_VPATH += $(DRIVER_PATH)/led/issi
+ SRC += is31flcommon.c
+ QUANTUM_LIB_SRC += i2c_master.c
+ endif
+
+ ifeq ($(strip $(LED_MATRIX_DRIVER)), IS31FL3743A)
+ OPT_DEFS += -DIS31FLCOMMON -DIS31FL3743A -DSTM32_I2C -DHAL_USE_I2C=TRUE
+ COMMON_VPATH += $(DRIVER_PATH)/led/issi
+ SRC += is31flcommon.c
+ QUANTUM_LIB_SRC += i2c_master.c
+ endif
+
+ ifeq ($(strip $(LED_MATRIX_DRIVER)), IS31FL3745)
+ OPT_DEFS += -DIS31FLCOMMON -DIS31FL3745 -DSTM32_I2C -DHAL_USE_I2C=TRUE
+ COMMON_VPATH += $(DRIVER_PATH)/led/issi
+ SRC += is31flcommon.c
+ QUANTUM_LIB_SRC += i2c_master.c
+ endif
+
+ ifeq ($(strip $(LED_MATRIX_DRIVER)), IS31FL3746A)
+ OPT_DEFS += -DIS31FLCOMMON -DIS31FL3746A -DSTM32_I2C -DHAL_USE_I2C=TRUE
+ COMMON_VPATH += $(DRIVER_PATH)/led/issi
+ SRC += is31flcommon.c
+ QUANTUM_LIB_SRC += i2c_master.c
+ endif
+
+endif
+
+RGB_MATRIX_ENABLE ?= no
+
+VALID_RGB_MATRIX_TYPES := AW20216 IS31FL3731 IS31FL3733 IS31FL3737 IS31FL3741 IS31FL3742A IS31FL3743A IS31FL3745 IS31FL3746A CKLED2001 WS2812 custom
+ifeq ($(strip $(RGB_MATRIX_ENABLE)), yes)
+ ifeq ($(filter $(RGB_MATRIX_DRIVER),$(VALID_RGB_MATRIX_TYPES)),)
+ $(call CATASTROPHIC_ERROR,Invalid RGB_MATRIX_DRIVER,RGB_MATRIX_DRIVER="$(RGB_MATRIX_DRIVER)" is not a valid matrix type)
+ endif
+ OPT_DEFS += -DRGB_MATRIX_ENABLE
+ifneq (,$(filter $(MCU), atmega16u2 atmega32u2 at90usb162))
+ # ATmegaxxU2 does not have hardware MUL instruction - lib8tion must be told to use software multiplication routines
+ OPT_DEFS += -DLIB8_ATTINY
+endif
+ COMMON_VPATH += $(QUANTUM_DIR)/rgb_matrix
+ COMMON_VPATH += $(QUANTUM_DIR)/rgb_matrix/animations
+ COMMON_VPATH += $(QUANTUM_DIR)/rgb_matrix/animations/runners
+ SRC += $(QUANTUM_DIR)/color.c
+ SRC += $(QUANTUM_DIR)/rgb_matrix/rgb_matrix.c
+ SRC += $(QUANTUM_DIR)/rgb_matrix/rgb_matrix_drivers.c
+ SRC += $(LIB_PATH)/lib8tion/lib8tion.c
+ CIE1931_CURVE := yes
+ RGB_KEYCODES_ENABLE := yes
+
+ ifeq ($(strip $(RGB_MATRIX_DRIVER)), AW20216)
+ OPT_DEFS += -DAW20216 -DSTM32_SPI -DHAL_USE_SPI=TRUE
+ COMMON_VPATH += $(DRIVER_PATH)/led
+ SRC += aw20216.c
+ QUANTUM_LIB_SRC += spi_master.c
+ endif
+
+ ifeq ($(strip $(RGB_MATRIX_DRIVER)), IS31FL3731)
+ OPT_DEFS += -DIS31FL3731 -DSTM32_I2C -DHAL_USE_I2C=TRUE
+ COMMON_VPATH += $(DRIVER_PATH)/led/issi
+ SRC += is31fl3731.c
+ QUANTUM_LIB_SRC += i2c_master.c
+ endif
+
+ ifeq ($(strip $(RGB_MATRIX_DRIVER)), IS31FL3733)
+ OPT_DEFS += -DIS31FL3733 -DSTM32_I2C -DHAL_USE_I2C=TRUE
+ COMMON_VPATH += $(DRIVER_PATH)/led/issi
+ SRC += is31fl3733.c
+ QUANTUM_LIB_SRC += i2c_master.c
+ endif
+
+ ifeq ($(strip $(RGB_MATRIX_DRIVER)), IS31FL3737)
+ OPT_DEFS += -DIS31FL3737 -DSTM32_I2C -DHAL_USE_I2C=TRUE
+ COMMON_VPATH += $(DRIVER_PATH)/led/issi
+ SRC += is31fl3737.c
+ QUANTUM_LIB_SRC += i2c_master.c
+ endif
+
+ ifeq ($(strip $(RGB_MATRIX_DRIVER)), IS31FL3741)
+ OPT_DEFS += -DIS31FL3741 -DSTM32_I2C -DHAL_USE_I2C=TRUE
+ COMMON_VPATH += $(DRIVER_PATH)/led/issi
+ SRC += is31fl3741.c
+ QUANTUM_LIB_SRC += i2c_master.c
+ endif
+
+ ifeq ($(strip $(RGB_MATRIX_DRIVER)), IS31FL3742A)
+ OPT_DEFS += -DIS31FLCOMMON -DIS31FL3742A -DSTM32_I2C -DHAL_USE_I2C=TRUE
+ COMMON_VPATH += $(DRIVER_PATH)/led/issi
+ SRC += is31flcommon.c
+ QUANTUM_LIB_SRC += i2c_master.c
+ endif
+
+ ifeq ($(strip $(RGB_MATRIX_DRIVER)), IS31FL3743A)
+ OPT_DEFS += -DIS31FLCOMMON -DIS31FL3743A -DSTM32_I2C -DHAL_USE_I2C=TRUE
+ COMMON_VPATH += $(DRIVER_PATH)/led/issi
+ SRC += is31flcommon.c
+ QUANTUM_LIB_SRC += i2c_master.c
+ endif
+
+ ifeq ($(strip $(RGB_MATRIX_DRIVER)), IS31FL3745)
+ OPT_DEFS += -DIS31FLCOMMON -DIS31FL3745 -DSTM32_I2C -DHAL_USE_I2C=TRUE
+ COMMON_VPATH += $(DRIVER_PATH)/led/issi
+ SRC += is31flcommon.c
+ QUANTUM_LIB_SRC += i2c_master.c
+ endif
+
+ ifeq ($(strip $(RGB_MATRIX_DRIVER)), IS31FL3746A)
+ OPT_DEFS += -DIS31FLCOMMON -DIS31FL3746A -DSTM32_I2C -DHAL_USE_I2C=TRUE
+ COMMON_VPATH += $(DRIVER_PATH)/led/issi
+ SRC += is31flcommon.c
+ QUANTUM_LIB_SRC += i2c_master.c
+ endif
+
+ ifeq ($(strip $(RGB_MATRIX_DRIVER)), CKLED2001)
+ OPT_DEFS += -DCKLED2001 -DSTM32_I2C -DHAL_USE_I2C=TRUE
+ COMMON_VPATH += $(DRIVER_PATH)/led
+ SRC += ckled2001.c
+ QUANTUM_LIB_SRC += i2c_master.c
+ endif
+
+ ifeq ($(strip $(RGB_MATRIX_DRIVER)), WS2812)
+ OPT_DEFS += -DWS2812
+ WS2812_DRIVER_REQUIRED := yes
+ endif
+
+ ifeq ($(strip $(RGB_MATRIX_DRIVER)), APA102)
+ OPT_DEFS += -DAPA102
+ APA102_DRIVER_REQUIRED := yes
+ endif
+
+ ifeq ($(strip $(RGB_MATRIX_CUSTOM_KB)), yes)
+ OPT_DEFS += -DRGB_MATRIX_CUSTOM_KB
+ endif
+
+ ifeq ($(strip $(RGB_MATRIX_CUSTOM_USER)), yes)
+ OPT_DEFS += -DRGB_MATRIX_CUSTOM_USER
+ endif
+endif
+
+ifeq ($(strip $(RGB_KEYCODES_ENABLE)), yes)
+ SRC += $(QUANTUM_DIR)/process_keycode/process_rgb.c
+endif
+
+ifeq ($(strip $(PRINTING_ENABLE)), yes)
+ OPT_DEFS += -DPRINTING_ENABLE
+ SRC += $(QUANTUM_DIR)/process_keycode/process_printer.c
+ QUANTUM_LIB_SRC += uart.c
+endif
+
+VARIABLE_TRACE ?= no
+ifneq ($(strip $(VARIABLE_TRACE)),no)
+ SRC += $(QUANTUM_DIR)/variable_trace.c
+ OPT_DEFS += -DNUM_TRACED_VARIABLES=$(strip $(VARIABLE_TRACE))
+ ifneq ($(strip $(MAX_VARIABLE_TRACE_SIZE)),)
+ OPT_DEFS += -DMAX_VARIABLE_TRACE_SIZE=$(strip $(MAX_VARIABLE_TRACE_SIZE))
+ endif
+endif
+
+ifeq ($(strip $(SLEEP_LED_ENABLE)), yes)
+ SRC += $(PLATFORM_COMMON_DIR)/sleep_led.c
+ OPT_DEFS += -DSLEEP_LED_ENABLE
+
+ NO_SUSPEND_POWER_DOWN := yes
+endif
+
+VALID_BACKLIGHT_TYPES := pwm timer software custom
+
+BACKLIGHT_ENABLE ?= no
+ifeq ($(strip $(CONVERT_TO_PROTON_C)), yes)
+ BACKLIGHT_DRIVER ?= software
+else
+ BACKLIGHT_DRIVER ?= pwm
+endif
+ifeq ($(strip $(BACKLIGHT_ENABLE)), yes)
+ ifeq ($(filter $(BACKLIGHT_DRIVER),$(VALID_BACKLIGHT_TYPES)),)
+ $(call CATASTROPHIC_ERROR,Invalid BACKLIGHT_DRIVER,BACKLIGHT_DRIVER="$(BACKLIGHT_DRIVER)" is not a valid backlight type)
+ endif
+
+ COMMON_VPATH += $(QUANTUM_DIR)/backlight
+ SRC += $(QUANTUM_DIR)/backlight/backlight.c
+ SRC += $(QUANTUM_DIR)/process_keycode/process_backlight.c
+ OPT_DEFS += -DBACKLIGHT_ENABLE
+
+ ifeq ($(strip $(BACKLIGHT_DRIVER)), custom)
+ OPT_DEFS += -DBACKLIGHT_CUSTOM_DRIVER
+ else
+ SRC += $(QUANTUM_DIR)/backlight/backlight_driver_common.c
+ ifeq ($(strip $(BACKLIGHT_DRIVER)), pwm)
+ SRC += $(QUANTUM_DIR)/backlight/backlight_$(PLATFORM_KEY).c
+ else
+ SRC += $(QUANTUM_DIR)/backlight/backlight_$(strip $(BACKLIGHT_DRIVER)).c
+ endif
+ endif
+endif
+
+VALID_WS2812_DRIVER_TYPES := bitbang pwm spi i2c
+
+WS2812_DRIVER ?= bitbang
+ifeq ($(strip $(WS2812_DRIVER_REQUIRED)), yes)
+ ifeq ($(filter $(WS2812_DRIVER),$(VALID_WS2812_DRIVER_TYPES)),)
+ $(call CATASTROPHIC_ERROR,Invalid WS2812_DRIVER,WS2812_DRIVER="$(WS2812_DRIVER)" is not a valid WS2812 driver)
+ endif
+
+ OPT_DEFS += -DWS2812_DRIVER_$(strip $(shell echo $(WS2812_DRIVER) | tr '[:lower:]' '[:upper:]'))
+
+ ifeq ($(strip $(WS2812_DRIVER)), bitbang)
+ SRC += ws2812.c
+ else
+ SRC += ws2812_$(strip $(WS2812_DRIVER)).c
+
+ ifeq ($(strip $(PLATFORM)), CHIBIOS)
+ ifeq ($(strip $(WS2812_DRIVER)), pwm)
+ OPT_DEFS += -DSTM32_DMA_REQUIRED=TRUE
+ endif
+ endif
+ endif
+
+ # add extra deps
+ ifeq ($(strip $(WS2812_DRIVER)), i2c)
+ QUANTUM_LIB_SRC += i2c_master.c
+ endif
+endif
+
+ifeq ($(strip $(APA102_DRIVER_REQUIRED)), yes)
+ COMMON_VPATH += $(DRIVER_PATH)/led
+ SRC += apa102.c
+endif
+
+ifeq ($(strip $(CIE1931_CURVE)), yes)
+ OPT_DEFS += -DUSE_CIE1931_CURVE
+ LED_TABLES := yes
+endif
+
+ifeq ($(strip $(LED_TABLES)), yes)
+ SRC += $(QUANTUM_DIR)/led_tables.c
+endif
+
+ifeq ($(strip $(TERMINAL_ENABLE)), yes)
+ SRC += $(QUANTUM_DIR)/process_keycode/process_terminal.c
+ OPT_DEFS += -DTERMINAL_ENABLE
+ OPT_DEFS += -DUSER_PRINT
+endif
+
+ifeq ($(strip $(VIA_ENABLE)), yes)
+ DYNAMIC_KEYMAP_ENABLE := yes
+ RAW_ENABLE := yes
+ BOOTMAGIC_ENABLE := yes
+ SRC += $(QUANTUM_DIR)/via.c
+ OPT_DEFS += -DVIA_ENABLE
+endif
+
+VALID_MAGIC_TYPES := yes
+BOOTMAGIC_ENABLE ?= no
+ifneq ($(strip $(BOOTMAGIC_ENABLE)), no)
+ ifeq ($(filter $(BOOTMAGIC_ENABLE),$(VALID_MAGIC_TYPES)),)
+ $(call CATASTROPHIC_ERROR,Invalid BOOTMAGIC_ENABLE,BOOTMAGIC_ENABLE="$(BOOTMAGIC_ENABLE)" is not a valid type of magic)
+ endif
+ ifneq ($(strip $(BOOTMAGIC_ENABLE)), no)
+ OPT_DEFS += -DBOOTMAGIC_LITE
+ QUANTUM_SRC += $(QUANTUM_DIR)/bootmagic/bootmagic_lite.c
+ endif
+endif
+COMMON_VPATH += $(QUANTUM_DIR)/bootmagic
+QUANTUM_SRC += $(QUANTUM_DIR)/bootmagic/magic.c
+
+VALID_CUSTOM_MATRIX_TYPES:= yes lite no
+
+CUSTOM_MATRIX ?= no
+
+ifneq ($(strip $(CUSTOM_MATRIX)), yes)
+ ifeq ($(filter $(CUSTOM_MATRIX),$(VALID_CUSTOM_MATRIX_TYPES)),)
+ $(call CATASTROPHIC_ERROR,Invalid CUSTOM_MATRIX,CUSTOM_MATRIX="$(CUSTOM_MATRIX)" is not a valid custom matrix type)
+ endif
+
+ # Include common stuff for all non custom matrix users
+ QUANTUM_SRC += $(QUANTUM_DIR)/matrix_common.c
+
+ # if 'lite' then skip the actual matrix implementation
+ ifneq ($(strip $(CUSTOM_MATRIX)), lite)
+ # Include the standard or split matrix code if needed
+ QUANTUM_SRC += $(QUANTUM_DIR)/matrix.c
+ endif
+endif
+
+# Debounce Modules. Set DEBOUNCE_TYPE=custom if including one manually.
+DEBOUNCE_TYPE ?= sym_defer_g
+ifneq ($(strip $(DEBOUNCE_TYPE)), custom)
+ QUANTUM_SRC += $(QUANTUM_DIR)/debounce/$(strip $(DEBOUNCE_TYPE)).c
+endif
+
+ifeq ($(strip $(SPLIT_KEYBOARD)), yes)
+ POST_CONFIG_H += $(QUANTUM_DIR)/split_common/post_config.h
+ OPT_DEFS += -DSPLIT_KEYBOARD
+ CRC_ENABLE := yes
+
+ # Include files used by all split keyboards
+ QUANTUM_SRC += $(QUANTUM_DIR)/split_common/split_util.c
+
+ # Determine which (if any) transport files are required
+ ifneq ($(strip $(SPLIT_TRANSPORT)), custom)
+ QUANTUM_SRC += $(QUANTUM_DIR)/split_common/transport.c \
+ $(QUANTUM_DIR)/split_common/transactions.c
+
+ OPT_DEFS += -DSPLIT_COMMON_TRANSACTIONS
+
+ # Functions added via QUANTUM_LIB_SRC are only included in the final binary if they're called.
+ # Unused functions are pruned away, which is why we can add multiple drivers here without bloat.
+ ifeq ($(PLATFORM),AVR)
+ ifneq ($(NO_I2C),yes)
+ QUANTUM_LIB_SRC += i2c_master.c \
+ i2c_slave.c
+ endif
+ endif
+
+ SERIAL_DRIVER ?= bitbang
+ OPT_DEFS += -DSERIAL_DRIVER_$(strip $(shell echo $(SERIAL_DRIVER) | tr '[:lower:]' '[:upper:]'))
+ ifeq ($(strip $(SERIAL_DRIVER)), bitbang)
+ QUANTUM_LIB_SRC += serial.c
+ else
+ QUANTUM_LIB_SRC += serial_$(strip $(SERIAL_DRIVER)).c
+ endif
+ endif
+ COMMON_VPATH += $(QUANTUM_PATH)/split_common
+endif
+
+ifeq ($(strip $(CRC_ENABLE)), yes)
+ OPT_DEFS += -DCRC_ENABLE
+ SRC += crc.c
+endif
+
+ifeq ($(strip $(HAPTIC_ENABLE)),yes)
+ COMMON_VPATH += $(DRIVER_PATH)/haptic
+
+ ifneq ($(filter DRV2605L, $(HAPTIC_DRIVER)), )
+ SRC += DRV2605L.c
+ QUANTUM_LIB_SRC += i2c_master.c
+ OPT_DEFS += -DDRV2605L
+ endif
+
+ ifneq ($(filter SOLENOID, $(HAPTIC_DRIVER)), )
+ SRC += solenoid.c
+ OPT_DEFS += -DSOLENOID_ENABLE
+ endif
+endif
+
+ifeq ($(strip $(HD44780_ENABLE)), yes)
+ SRC += platforms/avr/drivers/hd44780.c
+ OPT_DEFS += -DHD44780_ENABLE
+endif
+
+VALID_OLED_DRIVER_TYPES := SSD1306 custom
+OLED_DRIVER ?= SSD1306
+ifeq ($(strip $(OLED_ENABLE)), yes)
+ ifeq ($(filter $(OLED_DRIVER),$(VALID_OLED_DRIVER_TYPES)),)
+ $(call CATASTROPHIC_ERROR,Invalid OLED_DRIVER,OLED_DRIVER="$(OLED_DRIVER)" is not a valid OLED driver)
+ else
+ OPT_DEFS += -DOLED_ENABLE
+ COMMON_VPATH += $(DRIVER_PATH)/oled
+
+ OPT_DEFS += -DOLED_DRIVER_$(strip $(shell echo $(OLED_DRIVER) | tr '[:lower:]' '[:upper:]'))
+ ifeq ($(strip $(OLED_DRIVER)), SSD1306)
+ SRC += ssd1306_sh1106.c
+ QUANTUM_LIB_SRC += i2c_master.c
+ endif
+ endif
+endif
+
+ifeq ($(strip $(ST7565_ENABLE)), yes)
+ OPT_DEFS += -DST7565_ENABLE
+ COMMON_VPATH += $(DRIVER_PATH)/oled # For glcdfont.h
+ COMMON_VPATH += $(DRIVER_PATH)/lcd
+ QUANTUM_LIB_SRC += spi_master.c
+ SRC += st7565.c
+endif
+
+ifeq ($(strip $(UCIS_ENABLE)), yes)
+ OPT_DEFS += -DUCIS_ENABLE
+ UNICODE_COMMON := yes
+ SRC += $(QUANTUM_DIR)/process_keycode/process_ucis.c
+endif
+
+ifeq ($(strip $(UNICODEMAP_ENABLE)), yes)
+ OPT_DEFS += -DUNICODEMAP_ENABLE
+ UNICODE_COMMON := yes
+ SRC += $(QUANTUM_DIR)/process_keycode/process_unicodemap.c
+endif
+
+ifeq ($(strip $(UNICODE_ENABLE)), yes)
+ OPT_DEFS += -DUNICODE_ENABLE
+ UNICODE_COMMON := yes
+ SRC += $(QUANTUM_DIR)/process_keycode/process_unicode.c
+endif
+
+ifeq ($(strip $(UNICODE_COMMON)), yes)
+ OPT_DEFS += -DUNICODE_COMMON_ENABLE
+ SRC += $(QUANTUM_DIR)/process_keycode/process_unicode_common.c
+endif
+
+MAGIC_ENABLE ?= yes
+ifeq ($(strip $(MAGIC_ENABLE)), yes)
+ SRC += $(QUANTUM_DIR)/process_keycode/process_magic.c
+ OPT_DEFS += -DMAGIC_KEYCODE_ENABLE
+endif
+
+ifeq ($(strip $(AUTO_SHIFT_ENABLE)), yes)
+ SRC += $(QUANTUM_DIR)/process_keycode/process_auto_shift.c
+ OPT_DEFS += -DAUTO_SHIFT_ENABLE
+ ifeq ($(strip $(AUTO_SHIFT_MODIFIERS)), yes)
+ OPT_DEFS += -DAUTO_SHIFT_MODIFIERS
+ endif
+endif
+
+ifeq ($(strip $(PS2_MOUSE_ENABLE)), yes)
+ PS2_ENABLE := yes
+ SRC += ps2_mouse.c
+ OPT_DEFS += -DPS2_MOUSE_ENABLE
+ OPT_DEFS += -DMOUSE_ENABLE
+endif
+
+ifeq ($(strip $(PS2_USE_BUSYWAIT)), yes)
+ PS2_ENABLE := yes
+ SRC += ps2_busywait.c
+ SRC += ps2_io_avr.c
+ OPT_DEFS += -DPS2_USE_BUSYWAIT
+endif
+
+ifeq ($(strip $(PS2_USE_INT)), yes)
+ PS2_ENABLE := yes
+ SRC += ps2_interrupt.c
+ SRC += ps2_io.c
+ OPT_DEFS += -DPS2_USE_INT
+endif
+
+ifeq ($(strip $(PS2_USE_USART)), yes)
+ PS2_ENABLE := yes
+ SRC += ps2_usart.c
+ SRC += ps2_io.c
+ OPT_DEFS += -DPS2_USE_USART
+endif
+
+ifeq ($(strip $(PS2_ENABLE)), yes)
+ COMMON_VPATH += $(DRIVER_PATH)/ps2
+ COMMON_VPATH += $(PLATFORM_PATH)/$(PLATFORM_KEY)/$(DRIVER_DIR)/ps2
+ OPT_DEFS += -DPS2_ENABLE
+endif
+
+JOYSTICK_ENABLE ?= no
+VALID_JOYSTICK_TYPES := analog digital
+JOYSTICK_DRIVER ?= analog
+ifeq ($(strip $(JOYSTICK_ENABLE)), yes)
+ ifeq ($(filter $(JOYSTICK_DRIVER),$(VALID_JOYSTICK_TYPES)),)
+ $(call CATASTROPHIC_ERROR,Invalid JOYSTICK_DRIVER,JOYSTICK_DRIVER="$(JOYSTICK_DRIVER)" is not a valid joystick driver)
+ endif
+ OPT_DEFS += -DJOYSTICK_ENABLE
+ SRC += $(QUANTUM_DIR)/process_keycode/process_joystick.c
+ SRC += $(QUANTUM_DIR)/joystick.c
+
+ ifeq ($(strip $(JOYSTICK_DRIVER)), analog)
+ OPT_DEFS += -DANALOG_JOYSTICK_ENABLE
+ SRC += analog.c
+ endif
+ ifeq ($(strip $(JOYSTICK_DRIVER)), digital)
+ OPT_DEFS += -DDIGITAL_JOYSTICK_ENABLE
+ endif
+endif
+
+USBPD_ENABLE ?= no
+VALID_USBPD_DRIVER_TYPES = custom vendor
+USBPD_DRIVER ?= vendor
+ifeq ($(strip $(USBPD_ENABLE)), yes)
+ ifeq ($(filter $(strip $(USBPD_DRIVER)),$(VALID_USBPD_DRIVER_TYPES)),)
+ $(call CATASTROPHIC_ERROR,Invalid USBPD_DRIVER,USBPD_DRIVER="$(USBPD_DRIVER)" is not a valid USBPD driver)
+ else
+ OPT_DEFS += -DUSBPD_ENABLE
+ ifeq ($(strip $(USBPD_DRIVER)), vendor)
+ # Vendor-specific implementations
+ OPT_DEFS += -DUSBPD_VENDOR
+ ifeq ($(strip $(MCU_SERIES)), STM32G4xx)
+ OPT_DEFS += -DUSBPD_STM32G4
+ SRC += usbpd_stm32g4.c
+ else
+ $(call CATASTROPHIC_ERROR,Invalid USBPD_DRIVER,There is no vendor-provided USBPD driver available)
+ endif
+ else ifeq ($(strip $(USBPD_DRIVER)), custom)
+ OPT_DEFS += -DUSBPD_CUSTOM
+ # Board designers can add their own driver to $(SRC)
+ endif
+ endif
+endif
+
+BLUETOOTH_ENABLE ?= no
+VALID_BLUETOOTH_DRIVER_TYPES := BluefruitLE RN42 custom
+ifeq ($(strip $(BLUETOOTH_ENABLE)), yes)
+ ifeq ($(filter $(strip $(BLUETOOTH_DRIVER)),$(VALID_BLUETOOTH_DRIVER_TYPES)),)
+ $(call CATASTROPHIC_ERROR,Invalid BLUETOOTH_DRIVER,BLUETOOTH_DRIVER="$(BLUETOOTH_DRIVER)" is not a valid Bluetooth driver type)
+ endif
+ OPT_DEFS += -DBLUETOOTH_ENABLE
+ NO_USB_STARTUP_CHECK := yes
+ COMMON_VPATH += $(DRIVER_PATH)/bluetooth
+ SRC += outputselect.c
+
+ ifeq ($(strip $(BLUETOOTH_DRIVER)), BluefruitLE)
+ OPT_DEFS += -DBLUETOOTH_BLUEFRUIT_LE
+ SRC += analog.c
+ SRC += $(DRIVER_PATH)/bluetooth/bluefruit_le.cpp
+ QUANTUM_LIB_SRC += spi_master.c
+ endif
+
+ ifeq ($(strip $(BLUETOOTH_DRIVER)), RN42)
+ OPT_DEFS += -DBLUETOOTH_RN42
+ SRC += $(DRIVER_PATH)/bluetooth/rn42.c
+ QUANTUM_LIB_SRC += uart.c
+ endif
+endif
diff --git a/builddefs/common_rules.mk b/builddefs/common_rules.mk
new file mode 100644
index 0000000000..b303a87919
--- /dev/null
+++ b/builddefs/common_rules.mk
@@ -0,0 +1,523 @@
+# Hey Emacs, this is a -*- makefile -*-
+#----------------------------------------------------------------------------
+# WinAVR Makefile Template written by Eric B. Weddington, Jî’šg Wunsch, et al.
+#
+# Released to the Public Domain
+#
+# Additional material for this makefile was written by:
+# Peter Fleury
+# Tim Henigan
+# Colin O'Flynn
+# Reiner Patommel
+# Markus Pfaff
+# Sander Pool
+# Frederik Rouleau
+# Carlos Lamas
+#
+
+# Enable vpath seraching for source files only
+# Without this, output files, could be read from the wrong .build directories
+VPATH_SRC := $(VPATH)
+vpath %.c $(VPATH_SRC)
+vpath %.h $(VPATH_SRC)
+vpath %.cpp $(VPATH_SRC)
+vpath %.cc $(VPATH_SRC)
+vpath %.hpp $(VPATH_SRC)
+vpath %.S $(VPATH_SRC)
+VPATH :=
+
+# Convert all SRC to OBJ
+define OBJ_FROM_SRC
+$(patsubst %.c,$1/%.o,$(patsubst %.cpp,$1/%.o,$(patsubst %.cc,$1/%.o,$(patsubst %.S,$1/%.o,$(patsubst %.clib,$1/%.a,$($1_SRC))))))
+endef
+$(foreach OUTPUT,$(OUTPUTS),$(eval $(OUTPUT)_OBJ +=$(call OBJ_FROM_SRC,$(OUTPUT))))
+
+# Define a list of all objects
+OBJ := $(foreach OUTPUT,$(OUTPUTS),$($(OUTPUT)_OBJ))
+NO_LTO_OBJ := $(filter %.a,$(OBJ))
+
+MASTER_OUTPUT := $(firstword $(OUTPUTS))
+
+
+
+# Output format. (can be srec, ihex, binary)
+FORMAT = ihex
+
+# Optimization level, can be [0, 1, 2, 3, s].
+# 0 = turn off optimization. s = optimize for size.
+# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
+OPT ?= s
+
+# Compiler flag to set the C Standard level.
+# c89 = "ANSI" C
+# gnu89 = c89 plus GCC extensions
+# c99 = ISO C99 standard (not yet fully implemented)
+# gnu99 = c99 plus GCC extensions
+CSTANDARD = -std=gnu99
+
+
+# Place -D or -U options here for C sources
+#CDEFS +=
+
+
+# Place -D or -U options here for ASM sources
+#ADEFS +=
+
+
+# Place -D or -U options here for C++ sources
+#CXXDEFS += -D__STDC_LIMIT_MACROS
+#CXXDEFS += -D__STDC_CONSTANT_MACROS
+#CXXDEFS +=
+
+# Speed up recompilations by opt-in usage of ccache
+USE_CCACHE ?= no
+ifneq ($(USE_CCACHE),no)
+ CC_PREFIX ?= ccache
+endif
+
+#---------------- Compiler Options C ----------------
+# -g*: generate debugging information
+# -O*: optimization level
+# -f...: tuning, see GCC manual and avr-libc documentation
+# -Wall...: warning level
+# -Wa,...: tell GCC to pass this to the assembler.
+ifeq ($(strip $(LTO_ENABLE)), yes)
+ ifeq ($(PLATFORM),CHIBIOS)
+ $(info Enabling LTO on ChibiOS-targeting boards is known to have a high likelihood of failure.)
+ $(info If unsure, set LTO_ENABLE = no.)
+ endif
+ CDEFS += -flto
+ CDEFS += -DLTO_ENABLE
+endif
+
+DEBUG_ENABLE ?= yes
+ifeq ($(strip $(SKIP_DEBUG_INFO)),yes)
+ DEBUG_ENABLE=no
+endif
+
+ifeq ($(strip $(DEBUG_ENABLE)),yes)
+ CFLAGS += -g$(DEBUG)
+endif
+CFLAGS += $(CDEFS)
+CFLAGS += -O$(OPT)
+# add color
+ifeq ($(COLOR),true)
+ifeq ("$(shell echo "int main(){}" | $(CC) -fdiagnostics-color -x c - -o /dev/null 2>&1)", "")
+ CFLAGS+= -fdiagnostics-color
+endif
+endif
+CFLAGS += -Wall
+CFLAGS += -Wstrict-prototypes
+ifneq ($(strip $(ALLOW_WARNINGS)), yes)
+ CFLAGS += -Werror
+endif
+#CFLAGS += -mshort-calls
+#CFLAGS += -fno-unit-at-a-time
+#CFLAGS += -Wundef
+#CFLAGS += -Wunreachable-code
+#CFLAGS += -Wsign-compare
+CFLAGS += $(CSTANDARD)
+
+# This fixes lots of keyboards linking errors but SHOULDN'T BE A FINAL SOLUTION
+# Fixing of multiple variable definitions must be made.
+CFLAGS += -fcommon
+
+#---------------- Compiler Options C++ ----------------
+# -g*: generate debugging information
+# -O*: optimization level
+# -f...: tuning, see GCC manual and avr-libc documentation
+# -Wall...: warning level
+# -Wa,...: tell GCC to pass this to the assembler.
+ifeq ($(strip $(DEBUG_ENABLE)),yes)
+ CXXFLAGS += -g$(DEBUG)
+endif
+CXXFLAGS += $(CXXDEFS)
+CXXFLAGS += -O$(OPT)
+# to supress "warning: only initialized variables can be placed into program memory area"
+CXXFLAGS += -w
+CXXFLAGS += -Wall
+CXXFLAGS += -Wundef
+
+ifneq ($(strip $(ALLOW_WARNINGS)), yes)
+ CXXFLAGS += -Werror
+endif
+#CXXFLAGS += -mshort-calls
+#CXXFLAGS += -fno-unit-at-a-time
+#CXXFLAGS += -Wstrict-prototypes
+#CXXFLAGS += -Wunreachable-code
+#CXXFLAGS += -Wsign-compare
+#CXXFLAGS += $(CSTANDARD)
+
+#---------------- Assembler Options ----------------
+ASFLAGS += $(ADEFS)
+ifeq ($(VERBOSE_AS_CMD),yes)
+ ASFLAGS += -v
+endif
+
+#---------------- Library Options ----------------
+# Minimalistic printf version
+PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
+
+# Floating point printf version (requires MATH_LIB = -lm below)
+PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
+
+# If this is left blank, then it will use the Standard printf version.
+PRINTF_LIB =
+#PRINTF_LIB = $(PRINTF_LIB_MIN)
+#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
+
+
+# Minimalistic scanf version
+SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
+
+# Floating point + %[ scanf version (requires MATH_LIB = -lm below)
+SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
+
+# If this is left blank, then it will use the Standard scanf version.
+SCANF_LIB =
+#SCANF_LIB = $(SCANF_LIB_MIN)
+#SCANF_LIB = $(SCANF_LIB_FLOAT)
+
+
+MATH_LIB = -lm
+CREATE_MAP ?= yes
+
+
+#---------------- Linker Options ----------------
+# -Wl,...: tell GCC to pass this to linker.
+# -Map: create map file
+# --cref: add cross reference to map file
+#
+# Comennt out "--relax" option to avoid a error such:
+# (.vectors+0x30): relocation truncated to fit: R_AVR_13_PCREL against symbol `__vector_12'
+#
+
+ifeq ($(CREATE_MAP),yes)
+ LDFLAGS += -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref
+endif
+ifeq ($(VERBOSE_LD_CMD),yes)
+ LDFLAGS += -v
+endif
+#LDFLAGS += -Wl,--relax
+LDFLAGS += $(EXTMEMOPTS)
+LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
+LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB)
+#LDFLAGS += -T linker_script.x
+# You can give EXTRALDFLAGS at 'make' command line.
+LDFLAGS += $(EXTRALDFLAGS)
+
+#---------------- Assembler Listings ----------------
+# -Wa,...: tell GCC to pass this to the assembler.
+# -adhlns: create listing
+# -gstabs: have the assembler create line number information; note that
+# for use in COFF files, additional information about filenames
+# and function names needs to be present in the assembler source
+# files -- see avr-libc docs [FIXME: not yet described there]
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# dump that will be displayed for a given single line of source input.
+
+ADHLNS_ENABLE ?= no
+ifeq ($(ADHLNS_ENABLE),yes)
+ # Avoid "Options to '-Xassembler' do not match" - only specify assembler options at LTO link time
+ ifeq ($(strip $(LTO_ENABLE)), yes)
+ LDFLAGS += -Wa,-adhlns=$(BUILD_DIR)/$(TARGET).lst
+ else
+ CFLAGS += -Wa,-adhlns=$(@:%.o=%.lst)
+ CXXFLAGS += -Wa,-adhlns=$(@:%.o=%.lst)
+ ifeq ($(strip $(DEBUG_ENABLE)),yes)
+ ASFLAGS = -Wa,-adhlns=$(@:%.o=%.lst),-gstabs,--listing-cont-lines=100
+ else
+ ASFLAGS = -Wa,-adhlns=$(@:%.o=%.lst),--listing-cont-lines=100
+ endif
+ endif
+endif
+
+# Define programs and commands.
+SHELL = sh
+SED = sed
+REMOVE = rm -f
+REMOVEDIR = rmdir
+COPY = cp
+WINSHELL = cmd
+SECHO = $(SILENT) || echo
+MD5SUM ?= md5sum
+ifneq ($(filter Darwin FreeBSD,$(shell uname -s)),)
+ MD5SUM = md5
+endif
+
+# UF2 format settings
+# To produce a UF2 file in your build, add to your keyboard's rules.mk:
+# FIRMWARE_FORMAT = uf2
+UF2CONV = $(TOP_DIR)/util/uf2conv.py
+UF2_FAMILY ?= 0x0
+
+# Compiler flags to generate dependency files.
+#GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d
+GENDEPFLAGS = -MMD -MP -MF $(patsubst %.o,%.td,$@)
+
+
+# Combine all necessary flags and optional flags.
+# Add target processor to flags.
+# You can give extra flags at 'make' command line like: make EXTRAFLAGS=-DFOO=bar
+ALL_CFLAGS = $(MCUFLAGS) $(CFLAGS) $(EXTRAFLAGS)
+ALL_CXXFLAGS = $(MCUFLAGS) -x c++ $(CXXFLAGS) $(EXTRAFLAGS)
+ALL_ASFLAGS = $(MCUFLAGS) -x assembler-with-cpp $(ASFLAGS) $(EXTRAFLAGS)
+
+define NO_LTO
+$(patsubst %.a,%.o,$1): NOLTO_CFLAGS += -fno-lto
+endef
+$(foreach LOBJ, $(NO_LTO_OBJ), $(eval $(call NO_LTO,$(LOBJ))))
+
+MOVE_DEP = mv -f $(patsubst %.o,%.td,$@) $(patsubst %.o,%.d,$@)
+
+# For a ChibiOS build, ensure that the board files have the hook overrides injected
+define BOARDSRC_INJECT_HOOKS
+$(KEYBOARD_OUTPUT)/$(patsubst %.c,%.o,$(patsubst ./%,%,$1)): INIT_HOOK_CFLAGS += -include $(TOP_DIR)/tmk_core/protocol/chibios/init_hooks.h
+endef
+$(foreach LOBJ, $(BOARDSRC), $(eval $(call BOARDSRC_INJECT_HOOKS,$(LOBJ))))
+
+# Add QMK specific flags
+DFU_SUFFIX ?= dfu-suffix
+DFU_SUFFIX_ARGS ?=
+
+
+elf: $(BUILD_DIR)/$(TARGET).elf
+hex: $(BUILD_DIR)/$(TARGET).hex
+uf2: $(BUILD_DIR)/$(TARGET).uf2
+cpfirmware: $(FIRMWARE_FORMAT)
+ $(SILENT) || printf "Copying $(TARGET).$(FIRMWARE_FORMAT) to qmk_firmware folder" | $(AWK_CMD)
+ $(COPY) $(BUILD_DIR)/$(TARGET).$(FIRMWARE_FORMAT) $(TARGET).$(FIRMWARE_FORMAT) && $(PRINT_OK)
+eep: $(BUILD_DIR)/$(TARGET).eep
+lss: $(BUILD_DIR)/$(TARGET).lss
+sym: $(BUILD_DIR)/$(TARGET).sym
+LIBNAME=lib$(TARGET).a
+lib: $(LIBNAME)
+
+# Display size of file, modifying the output so people don't mistakenly grab the hex output
+BINARY_SIZE = $(SIZE) --target=$(FORMAT) $(BUILD_DIR)/$(TARGET).hex | $(SED) -e 's/\.build\/.*$$/$(TARGET).$(FIRMWARE_FORMAT)/g'
+
+sizebefore:
+ @if test -f $(BUILD_DIR)/$(TARGET).hex; then $(SECHO) $(MSG_SIZE_BEFORE); $(SILENT) || $(BINARY_SIZE); \
+ 2>/dev/null; $(SECHO); fi
+
+sizeafter: $(BUILD_DIR)/$(TARGET).hex
+ @if test -f $(BUILD_DIR)/$(TARGET).hex; then $(SECHO); $(SECHO) $(MSG_SIZE_AFTER); $(SILENT) || $(BINARY_SIZE); \
+ 2>/dev/null; $(SECHO); fi
+
+# Display compiler version information.
+gccversion :
+ @$(SILENT) || $(CC) --version
+
+# Create final output files (.hex, .eep) from ELF output file.
+%.hex: %.elf
+ $(eval CMD=$(HEX) $< $@)
+ #@$(SILENT) || printf "$(MSG_EXECUTING) '$(CMD)':\n"
+ @$(SILENT) || printf "$(MSG_FLASH) $@" | $(AWK_CMD)
+ @$(BUILD_CMD)
+
+%.uf2: %.hex
+ $(eval CMD=$(UF2CONV) $(BUILD_DIR)/$(TARGET).hex -o $(BUILD_DIR)/$(TARGET).uf2 -c -f $(UF2_FAMILY) >/dev/null 2>&1)
+ #@$(SILENT) || printf "$(MSG_EXECUTING) '$(CMD)':\n"
+ @$(SILENT) || printf "$(MSG_UF2) $@" | $(AWK_CMD)
+ @$(BUILD_CMD)
+
+%.eep: %.elf
+ $(eval CMD=$(EEP) $< $@ || exit 0)
+ #@$(SILENT) || printf "$(MSG_EXECUTING) '$(CMD)':\n"
+ @$(SILENT) || printf "$(MSG_EEPROM) $@" | $(AWK_CMD)
+ @$(BUILD_CMD)
+
+# Create extended listing file from ELF output file.
+%.lss: %.elf
+ $(eval CMD=$(OBJDUMP) -h -S -z $< > $@)
+ #@$(SILENT) || printf "$(MSG_EXECUTING) '$(CMD)':\n"
+ @$(SILENT) || printf "$(MSG_EXTENDED_LISTING) $@" | $(AWK_CMD)
+ @$(BUILD_CMD)
+
+# Create a symbol table from ELF output file.
+%.sym: %.elf
+ $(eval CMD=$(NM) -n $< > $@ )
+ #@$(SILENT) || printf "$(MSG_EXECUTING) '$(CMD)':\n"
+ @$(SILENT) || printf "$(MSG_SYMBOL_TABLE) $@" | $(AWK_CMD)
+ @$(BUILD_CMD)
+
+%.bin: %.elf
+ $(eval CMD=$(BIN) $< $@ || exit 0)
+ #@$(SILENT) || printf "$(MSG_EXECUTING) '$(CMD)':\n"
+ @$(SILENT) || printf "$(MSG_BIN) $@" | $(AWK_CMD)
+ @$(BUILD_CMD)
+ if [ ! -z "$(DFU_SUFFIX_ARGS)" ]; then \
+ $(DFU_SUFFIX) $(DFU_SUFFIX_ARGS) -a $(BUILD_DIR)/$(TARGET).bin 1>/dev/null ;\
+ fi
+ #$(SILENT) || printf "$(MSG_EXECUTING) '$(DFU_SUFFIX) $(DFU_SUFFIX_ARGS) -a $(BUILD_DIR)/$(TARGET).bin 1>/dev/null':\n" ;\
+ $(COPY) $(BUILD_DIR)/$(TARGET).bin $(TARGET).bin;
+
+BEGIN = gccversion sizebefore
+
+# Link: create ELF output file from object files.
+.SECONDARY : $(BUILD_DIR)/$(TARGET).elf
+.PRECIOUS : $(OBJ)
+# Note the obj.txt depeendency is there to force linking if a source file is deleted
+%.elf: $(OBJ) $(MASTER_OUTPUT)/cflags.txt $(MASTER_OUTPUT)/ldflags.txt $(MASTER_OUTPUT)/obj.txt | $(BEGIN)
+ @$(SILENT) || printf "$(MSG_LINKING) $@" | $(AWK_CMD)
+ $(eval CMD=MAKE=$(MAKE) $(CC) $(ALL_CFLAGS) $(filter-out %.txt,$^) --output $@ $(LDFLAGS))
+ @$(BUILD_CMD)
+
+
+define GEN_OBJRULE
+$1_INCFLAGS := $$(patsubst %,-I%,$$($1_INC))
+ifdef $1_CONFIG
+$1_CONFIG_FLAGS += $$(patsubst %,-include %,$$($1_CONFIG))
+endif
+$1_CFLAGS = $$(ALL_CFLAGS) $$($1_DEFS) $$($1_INCFLAGS) $$($1_CONFIG_FLAGS) $$(NOLTO_CFLAGS)
+$1_CXXFLAGS = $$(ALL_CXXFLAGS) $$($1_DEFS) $$($1_INCFLAGS) $$($1_CONFIG_FLAGS) $$(NOLTO_CFLAGS)
+$1_ASFLAGS = $$(ALL_ASFLAGS) $$($1_DEFS) $$($1_INCFLAGS) $$($1_CONFIG_FLAGS)
+
+# Compile: create object files from C source files.
+$1/%.o : %.c $1/%.d $1/cflags.txt $1/compiler.txt | $(BEGIN)
+ @mkdir -p $$(@D)
+ @$$(SILENT) || printf "$$(MSG_COMPILING) $$<" | $$(AWK_CMD)
+ $$(eval CC_EXEC := $$(CC))
+ ifneq ($$(VERBOSE_C_CMD),)
+ $$(if $$(filter $$(notdir $$(VERBOSE_C_CMD)),$$(notdir $$<)),$$(eval CC_EXEC += -v))
+ endif
+ ifneq ($$(VERBOSE_C_INCLUDE),)
+ $$(if $$(filter $$(notdir $$(VERBOSE_C_INCLUDE)),$$(notdir $$<)),$$(eval CC_EXEC += -H))
+ endif
+ $$(eval CMD := $$(CC_EXEC) -c $$($1_CFLAGS) $$(INIT_HOOK_CFLAGS) $$(GENDEPFLAGS) $$< -o $$@ && $$(MOVE_DEP))
+ @$$(BUILD_CMD)
+ ifneq ($$(DUMP_C_MACROS),)
+ $$(eval CMD := $$(CC) -E -dM $$($1_CFLAGS) $$(INIT_HOOK_CFLAGS) $$(GENDEPFLAGS) $$<)
+ @$$(if $$(filter $$(notdir $$(DUMP_C_MACROS)),$$(notdir $$<)),$$(BUILD_CMD))
+ endif
+
+# Compile: create object files from C++ source files.
+$1/%.o : %.cpp $1/%.d $1/cxxflags.txt $1/compiler.txt | $(BEGIN)
+ @mkdir -p $$(@D)
+ @$$(SILENT) || printf "$$(MSG_COMPILING_CXX) $$<" | $$(AWK_CMD)
+ $$(eval CMD=$$(CC) -c $$($1_CXXFLAGS) $$(INIT_HOOK_CFLAGS) $$(GENDEPFLAGS) $$< -o $$@ && $$(MOVE_DEP))
+ @$$(BUILD_CMD)
+
+$1/%.o : %.cc $1/%.d $1/cxxflags.txt $1/compiler.txt | $(BEGIN)
+ @mkdir -p $$(@D)
+ @$$(SILENT) || printf "$$(MSG_COMPILING_CXX) $$<" | $$(AWK_CMD)
+ $$(eval CMD=$$(CC) -c $$($1_CXXFLAGS) $$(INIT_HOOK_CFLAGS) $$(GENDEPFLAGS) $$< -o $$@ && $$(MOVE_DEP))
+ @$$(BUILD_CMD)
+
+# Assemble: create object files from assembler source files.
+$1/%.o : %.S $1/asflags.txt $1/compiler.txt | $(BEGIN)
+ @mkdir -p $$(@D)
+ @$(SILENT) || printf "$$(MSG_ASSEMBLING) $$<" | $$(AWK_CMD)
+ $$(eval CMD=$$(CC) -c $$($1_ASFLAGS) $$< -o $$@)
+ @$$(BUILD_CMD)
+
+$1/%.a : $1/%.o
+ @mkdir -p $$(@D)
+ @$(SILENT) || printf "Archiving: $$<" | $$(AWK_CMD)
+ $$(eval CMD=$$(AR) rcs $$@ $$<)
+ @$$(BUILD_CMD)
+
+$1/force:
+
+$1/cflags.txt: $1/force
+ echo '$$($1_CFLAGS)' | cmp -s - $$@ || echo '$$($1_CFLAGS)' > $$@
+
+$1/cxxflags.txt: $1/force
+ echo '$$($1_CXXFLAGS)' | cmp -s - $$@ || echo '$$($1_CXXFLAGS)' > $$@
+
+$1/asflags.txt: $1/force
+ echo '$$($1_ASFLAGS)' | cmp -s - $$@ || echo '$$($1_ASFLAGS)' > $$@
+
+$1/compiler.txt: $1/force
+ $$(CC) --version | cmp -s - $$@ || $$(CC) --version > $$@
+endef
+
+.PRECIOUS: $(MASTER_OUTPUT)/obj.txt
+$(MASTER_OUTPUT)/obj.txt: $(MASTER_OUTPUT)/force
+ echo '$(OBJ)' | cmp -s - $@ || echo '$(OBJ)' > $@
+
+.PRECIOUS: $(MASTER_OUTPUT)/ldflags.txt
+$(MASTER_OUTPUT)/ldflags.txt: $(MASTER_OUTPUT)/force
+ echo '$(LDFLAGS)' | cmp -s - $@ || echo '$(LDFLAGS)' > $@
+
+
+# We have to use static rules for the .d files for some reason
+DEPS = $(patsubst %.o,%.d,$(patsubst %.a,%.o,$(OBJ)))
+# Keep the .d files
+.PRECIOUS: $(DEPS)
+# Empty rule to force recompilation if the .d file is missing
+$(DEPS):
+
+
+$(foreach OUTPUT,$(OUTPUTS),$(eval $(call GEN_OBJRULE,$(OUTPUT))))
+
+# Create preprocessed source for use in sending a bug report.
+%.i : %.c | $(BEGIN)
+ $(CC) -E -mmcu=$(MCU) $(CFLAGS) $< -o $@
+
+# Target: clean project.
+clean:
+ $(foreach OUTPUT,$(OUTPUTS), $(REMOVE) -r $(OUTPUT) 2>/dev/null)
+ $(REMOVE) $(BUILD_DIR)/$(TARGET).*
+
+show_path:
+ @echo VPATH=$(VPATH)
+ @echo SRC=$(SRC)
+ @echo OBJ=$(OBJ)
+
+dump_vars: ERROR_IF_EMPTY=""
+dump_vars: ERROR_IF_NONBOOL=""
+dump_vars: ERROR_IF_UNSET=""
+dump_vars:
+ @$(foreach V,$(sort $(.VARIABLES)),$(if $(filter-out environment% default automatic,$(origin $V)),$(info $V=$($V))))
+
+objs-size:
+ for i in $(OBJ); do echo $$i; done | sort | xargs $(SIZE)
+
+ifeq ($(findstring avr-gcc,$(CC)),avr-gcc)
+SIZE_MARGIN = 1024
+
+check-size:
+ $(eval MAX_SIZE=$(shell n=`$(CC) -E -mmcu=$(MCU) -D__ASSEMBLER__ $(CFLAGS) $(OPT_DEFS) platforms/avr/bootloader_size.c 2> /dev/null | $(SED) -ne 's/\r//;/^#/n;/^AVR_SIZE:/,$${s/^AVR_SIZE: //;p;}'` && echo $$(($$n)) || echo 0))
+ $(eval CURRENT_SIZE=$(shell if [ -f $(BUILD_DIR)/$(TARGET).hex ]; then $(SIZE) --target=$(FORMAT) $(BUILD_DIR)/$(TARGET).hex | $(AWK) 'NR==2 {print $$4}'; else printf 0; fi))
+ $(eval FREE_SIZE=$(shell expr $(MAX_SIZE) - $(CURRENT_SIZE)))
+ $(eval OVER_SIZE=$(shell expr $(CURRENT_SIZE) - $(MAX_SIZE)))
+ $(eval PERCENT_SIZE=$(shell expr $(CURRENT_SIZE) \* 100 / $(MAX_SIZE)))
+ if [ $(MAX_SIZE) -gt 0 ] && [ $(CURRENT_SIZE) -gt 0 ]; then \
+ $(SILENT) || printf "$(MSG_CHECK_FILESIZE)" | $(AWK_CMD); \
+ if [ $(CURRENT_SIZE) -gt $(MAX_SIZE) ]; then \
+ printf "\n * $(MSG_FILE_TOO_BIG)"; $(PRINT_ERROR_PLAIN); \
+ else \
+ if [ $(FREE_SIZE) -lt $(SIZE_MARGIN) ]; then \
+ $(PRINT_WARNING_PLAIN); printf " * $(MSG_FILE_NEAR_LIMIT)"; \
+ else \
+ $(PRINT_OK); $(SILENT) || printf " * $(MSG_FILE_JUST_RIGHT)"; \
+ fi ; \
+ fi ; \
+ fi
+else
+check-size:
+ $(SILENT) || echo "$(MSG_CHECK_FILESIZE_SKIPPED)"
+endif
+
+check-md5:
+ $(MD5SUM) $(BUILD_DIR)/$(TARGET).$(FIRMWARE_FORMAT)
+
+# Create build directory
+$(shell mkdir -p $(BUILD_DIR) 2>/dev/null)
+
+# Create object files directory
+$(eval $(foreach OUTPUT,$(OUTPUTS),$(shell mkdir -p $(OUTPUT) 2>/dev/null)))
+
+# Include the dependency files.
+-include $(patsubst %.o,%.d,$(patsubst %.a,%.o,$(OBJ)))
+
+
+# Listing of phony targets.
+.PHONY : all dump_vars finish sizebefore sizeafter qmkversion \
+gccversion build elf hex uf2 eep lss sym coff extcoff \
+clean clean_list debug gdb-config show_path \
+program teensy dfu dfu-ee dfu-start \
+flash dfu-split-left dfu-split-right \
+avrdude-split-left avrdude-split-right \
+avrdude-loop usbasp
diff --git a/builddefs/testlist.mk b/builddefs/testlist.mk
new file mode 100644
index 0000000000..86da5668ac
--- /dev/null
+++ b/builddefs/testlist.mk
@@ -0,0 +1,19 @@
+TEST_LIST = $(sort $(patsubst %/test.mk,%, $(shell find $(ROOT_DIR)tests -type f -name test.mk)))
+FULL_TESTS := $(notdir $(TEST_LIST))
+
+include $(QUANTUM_PATH)/debounce/tests/testlist.mk
+include $(QUANTUM_PATH)/sequencer/tests/testlist.mk
+include $(PLATFORM_PATH)/test/testlist.mk
+
+define VALIDATE_TEST_LIST
+ ifneq ($1,)
+ ifeq ($$(findstring -,$1),-)
+ $$(call CATASTROPHIC_ERROR,Invalid test name,Test names can't contain '-', but '$1' does.)
+ else
+ $$(eval $$(call VALIDATE_TEST_LIST,$$(firstword $2),$$(wordlist 2,9999,$2)))
+ endif
+ endif
+endef
+
+
+$(eval $(call VALIDATE_TEST_LIST,$(firstword $(TEST_LIST)),$(wordlist 2,9999,$(TEST_LIST))))
diff --git a/common_features.mk b/common_features.mk
deleted file mode 100644
index 7ff19e8084..0000000000
--- a/common_features.mk
+++ /dev/null
@@ -1,801 +0,0 @@
-# Copyright 2017 Fred Sundvik
-#
-# 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 .
-
-QUANTUM_SRC += \
- $(QUANTUM_DIR)/quantum.c \
- $(QUANTUM_DIR)/send_string.c \
- $(QUANTUM_DIR)/bitwise.c \
- $(QUANTUM_DIR)/led.c \
- $(QUANTUM_DIR)/action.c \
- $(QUANTUM_DIR)/action_layer.c \
- $(QUANTUM_DIR)/action_tapping.c \
- $(QUANTUM_DIR)/action_util.c \
- $(QUANTUM_DIR)/eeconfig.c \
- $(QUANTUM_DIR)/keyboard.c \
- $(QUANTUM_DIR)/keymap_common.c \
- $(QUANTUM_DIR)/keycode_config.c \
- $(QUANTUM_DIR)/sync_timer.c \
- $(QUANTUM_DIR)/logging/debug.c \
- $(QUANTUM_DIR)/logging/sendchar.c \
-
-VPATH += $(QUANTUM_DIR)/logging
-# Fall back to lib/printf if there is no platform provided print
-ifeq ("$(wildcard $(PLATFORM_PATH)/$(PLATFORM_KEY)/printf.mk)","")
- include $(QUANTUM_PATH)/logging/print.mk
-else
- include $(PLATFORM_PATH)/$(PLATFORM_KEY)/printf.mk
-endif
-
-ifeq ($(strip $(DEBUG_MATRIX_SCAN_RATE_ENABLE)), yes)
- OPT_DEFS += -DDEBUG_MATRIX_SCAN_RATE
- CONSOLE_ENABLE = yes
-else ifeq ($(strip $(DEBUG_MATRIX_SCAN_RATE_ENABLE)), api)
- OPT_DEFS += -DDEBUG_MATRIX_SCAN_RATE
-endif
-
-AUDIO_ENABLE ?= no
-ifeq ($(strip $(AUDIO_ENABLE)), yes)
- ifeq ($(PLATFORM),CHIBIOS)
- AUDIO_DRIVER ?= dac_basic
- ifeq ($(strip $(AUDIO_DRIVER)), dac_basic)
- OPT_DEFS += -DAUDIO_DRIVER_DAC
- else ifeq ($(strip $(AUDIO_DRIVER)), dac_additive)
- OPT_DEFS += -DAUDIO_DRIVER_DAC
- ## stm32f2 and above have a usable DAC unit, f1 do not, and need to use pwm instead
- else ifeq ($(strip $(AUDIO_DRIVER)), pwm_software)
- OPT_DEFS += -DAUDIO_DRIVER_PWM
- else ifeq ($(strip $(AUDIO_DRIVER)), pwm_hardware)
- OPT_DEFS += -DAUDIO_DRIVER_PWM
- endif
- else
- # fallback for all other platforms is pwm
- AUDIO_DRIVER ?= pwm_hardware
- OPT_DEFS += -DAUDIO_DRIVER_PWM
- endif
- OPT_DEFS += -DAUDIO_ENABLE
- MUSIC_ENABLE = yes
- SRC += $(QUANTUM_DIR)/process_keycode/process_audio.c
- SRC += $(QUANTUM_DIR)/process_keycode/process_clicky.c
- SRC += $(QUANTUM_DIR)/audio/audio.c ## common audio code, hardware agnostic
- SRC += $(PLATFORM_PATH)/$(PLATFORM_KEY)/$(DRIVER_DIR)/audio_$(strip $(AUDIO_DRIVER)).c
- SRC += $(QUANTUM_DIR)/audio/voices.c
- SRC += $(QUANTUM_DIR)/audio/luts.c
-endif
-
-ifeq ($(strip $(SEQUENCER_ENABLE)), yes)
- OPT_DEFS += -DSEQUENCER_ENABLE
- MUSIC_ENABLE = yes
- SRC += $(QUANTUM_DIR)/sequencer/sequencer.c
- SRC += $(QUANTUM_DIR)/process_keycode/process_sequencer.c
-endif
-
-ifeq ($(strip $(MIDI_ENABLE)), yes)
- OPT_DEFS += -DMIDI_ENABLE
- MUSIC_ENABLE = yes
- SRC += $(QUANTUM_DIR)/process_keycode/process_midi.c
-endif
-
-MUSIC_ENABLE ?= no
-ifeq ($(MUSIC_ENABLE), yes)
- SRC += $(QUANTUM_DIR)/process_keycode/process_music.c
-endif
-
-ifeq ($(strip $(STENO_ENABLE)), yes)
- OPT_DEFS += -DSTENO_ENABLE
- VIRTSER_ENABLE ?= yes
- SRC += $(QUANTUM_DIR)/process_keycode/process_steno.c
-endif
-
-ifeq ($(strip $(VIRTSER_ENABLE)), yes)
- OPT_DEFS += -DVIRTSER_ENABLE
-endif
-
-ifeq ($(strip $(MOUSEKEY_ENABLE)), yes)
- OPT_DEFS += -DMOUSEKEY_ENABLE
- MOUSE_ENABLE := yes
- SRC += $(QUANTUM_DIR)/mousekey.c
-endif
-
-VALID_POINTING_DEVICE_DRIVER_TYPES := adns5050 adns9800 analog_joystick cirque_pinnacle_i2c cirque_pinnacle_spi pmw3360 pmw3389 pimoroni_trackball custom
-ifeq ($(strip $(POINTING_DEVICE_ENABLE)), yes)
- ifeq ($(filter $(POINTING_DEVICE_DRIVER),$(VALID_POINTING_DEVICE_DRIVER_TYPES)),)
- $(call CATASTROPHIC_ERROR,Invalid POINTING_DEVICE_DRIVER,POINTING_DEVICE_DRIVER="$(POINTING_DEVICE_DRIVER)" is not a valid pointing device type)
- else
- OPT_DEFS += -DPOINTING_DEVICE_ENABLE
- MOUSE_ENABLE := yes
- SRC += $(QUANTUM_DIR)/pointing_device.c
- SRC += $(QUANTUM_DIR)/pointing_device_drivers.c
- ifneq ($(strip $(POINTING_DEVICE_DRIVER)), custom)
- SRC += drivers/sensors/$(strip $(POINTING_DEVICE_DRIVER)).c
- OPT_DEFS += -DPOINTING_DEVICE_DRIVER_$(strip $(shell echo $(POINTING_DEVICE_DRIVER) | tr '[:lower:]' '[:upper:]'))
- endif
- OPT_DEFS += -DPOINTING_DEVICE_DRIVER_$(strip $(POINTING_DEVICE_DRIVER))
- ifeq ($(strip $(POINTING_DEVICE_DRIVER)), adns9800)
- OPT_DEFS += -DSTM32_SPI -DHAL_USE_SPI=TRUE
- QUANTUM_LIB_SRC += spi_master.c
- else ifeq ($(strip $(POINTING_DEVICE_DRIVER)), analog_joystick)
- OPT_DEFS += -DSTM32_ADC -DHAL_USE_ADC=TRUE
- LIB_SRC += analog.c
- else ifeq ($(strip $(POINTING_DEVICE_DRIVER)), cirque_pinnacle_i2c)
- OPT_DEFS += -DSTM32_I2C -DHAL_USE_I2C=TRUE
- SRC += drivers/sensors/cirque_pinnacle.c
- QUANTUM_LIB_SRC += i2c_master.c
- else ifeq ($(strip $(POINTING_DEVICE_DRIVER)), cirque_pinnacle_spi)
- OPT_DEFS += -DSTM32_SPI -DHAL_USE_SPI=TRUE
- SRC += drivers/sensors/cirque_pinnacle.c
- QUANTUM_LIB_SRC += spi_master.c
- else ifeq ($(strip $(POINTING_DEVICE_DRIVER)), pimoroni_trackball)
- OPT_DEFS += -DSTM32_SPI -DHAL_USE_I2C=TRUE
- QUANTUM_LIB_SRC += i2c_master.c
- else ifeq ($(strip $(POINTING_DEVICE_DRIVER)), pmw3360)
- OPT_DEFS += -DSTM32_SPI -DHAL_USE_SPI=TRUE
- QUANTUM_LIB_SRC += spi_master.c
- else ifeq ($(strip $(POINTING_DEVICE_DRIVER)), pmw3389)
- OPT_DEFS += -DSTM32_SPI -DHAL_USE_SPI=TRUE
- QUANTUM_LIB_SRC += spi_master.c
- endif
- endif
-endif
-
-VALID_EEPROM_DRIVER_TYPES := vendor custom transient i2c spi
-EEPROM_DRIVER ?= vendor
-ifeq ($(filter $(EEPROM_DRIVER),$(VALID_EEPROM_DRIVER_TYPES)),)
- $(call CATASTROPHIC_ERROR,Invalid EEPROM_DRIVER,EEPROM_DRIVER="$(EEPROM_DRIVER)" is not a valid EEPROM driver)
-else
- OPT_DEFS += -DEEPROM_ENABLE
- ifeq ($(strip $(EEPROM_DRIVER)), custom)
- # Custom EEPROM implementation -- only needs to implement init/erase/read_block/write_block
- OPT_DEFS += -DEEPROM_DRIVER -DEEPROM_CUSTOM
- COMMON_VPATH += $(DRIVER_PATH)/eeprom
- SRC += eeprom_driver.c
- else ifeq ($(strip $(EEPROM_DRIVER)), i2c)
- # External I2C EEPROM implementation
- OPT_DEFS += -DEEPROM_DRIVER -DEEPROM_I2C
- COMMON_VPATH += $(DRIVER_PATH)/eeprom
- QUANTUM_LIB_SRC += i2c_master.c
- SRC += eeprom_driver.c eeprom_i2c.c
- else ifeq ($(strip $(EEPROM_DRIVER)), spi)
- # External SPI EEPROM implementation
- OPT_DEFS += -DEEPROM_DRIVER -DEEPROM_SPI
- COMMON_VPATH += $(DRIVER_PATH)/eeprom
- QUANTUM_LIB_SRC += spi_master.c
- SRC += eeprom_driver.c eeprom_spi.c
- else ifeq ($(strip $(EEPROM_DRIVER)), transient)
- # Transient EEPROM implementation -- no data storage but provides runtime area for it
- OPT_DEFS += -DEEPROM_DRIVER -DEEPROM_TRANSIENT
- COMMON_VPATH += $(DRIVER_PATH)/eeprom
- SRC += eeprom_driver.c eeprom_transient.c
- else ifeq ($(strip $(EEPROM_DRIVER)), vendor)
- # Vendor-implemented EEPROM
- OPT_DEFS += -DEEPROM_VENDOR
- ifeq ($(PLATFORM),AVR)
- # Automatically provided by avr-libc, nothing required
- else ifeq ($(PLATFORM),CHIBIOS)
- ifneq ($(filter STM32F3xx_% STM32F1xx_% %_STM32F401xC %_STM32F401xE %_STM32F405xG %_STM32F411xE %_STM32F072xB %_STM32F042x6 %_GD32VF103xB %_GD32VF103x8, $(MCU_SERIES)_$(MCU_LDSCRIPT)),)
- # Emulated EEPROM
- OPT_DEFS += -DEEPROM_DRIVER -DEEPROM_STM32_FLASH_EMULATED
- COMMON_VPATH += $(DRIVER_PATH)/eeprom
- SRC += eeprom_driver.c
- SRC += $(PLATFORM_COMMON_DIR)/eeprom_stm32.c
- SRC += $(PLATFORM_COMMON_DIR)/flash_stm32.c
- else ifneq ($(filter $(MCU_SERIES),STM32L0xx STM32L1xx),)
- # True EEPROM on STM32L0xx, L1xx
- OPT_DEFS += -DEEPROM_DRIVER -DEEPROM_STM32_L0_L1
- COMMON_VPATH += $(DRIVER_PATH)/eeprom
- COMMON_VPATH += $(PLATFORM_PATH)/$(PLATFORM_KEY)/$(DRIVER_DIR)/eeprom
- SRC += eeprom_driver.c
- SRC += eeprom_stm32_L0_L1.c
- else ifneq ($(filter $(MCU_SERIES),KL2x K20x),)
- # Teensy EEPROM implementations
- OPT_DEFS += -DEEPROM_TEENSY
- SRC += eeprom_teensy.c
- else
- # Fall back to transient, i.e. non-persistent
- OPT_DEFS += -DEEPROM_DRIVER -DEEPROM_TRANSIENT
- COMMON_VPATH += $(DRIVER_PATH)/eeprom
- SRC += eeprom_driver.c eeprom_transient.c
- endif
- else ifeq ($(PLATFORM),ARM_ATSAM)
- # arm_atsam EEPROM
- OPT_DEFS += -DEEPROM_SAMD
- SRC += $(PLATFORM_COMMON_DIR)/eeprom_samd.c
- else ifeq ($(PLATFORM),TEST)
- # Test harness "EEPROM"
- OPT_DEFS += -DEEPROM_TEST_HARNESS
- SRC += $(PLATFORM_COMMON_DIR)/eeprom.c
- endif
- endif
-endif
-
-RGBLIGHT_ENABLE ?= no
-VALID_RGBLIGHT_TYPES := WS2812 APA102 custom
-
-ifeq ($(strip $(RGBLIGHT_CUSTOM_DRIVER)), yes)
- RGBLIGHT_DRIVER ?= custom
-endif
-
-ifeq ($(strip $(RGBLIGHT_ENABLE)), yes)
- RGBLIGHT_DRIVER ?= WS2812
-
- ifeq ($(filter $(RGBLIGHT_DRIVER),$(VALID_RGBLIGHT_TYPES)),)
- $(call CATASTROPHIC_ERROR,Invalid RGBLIGHT_DRIVER,RGBLIGHT_DRIVER="$(RGBLIGHT_DRIVER)" is not a valid RGB type)
- else
- COMMON_VPATH += $(QUANTUM_DIR)/rgblight
- POST_CONFIG_H += $(QUANTUM_DIR)/rgblight/rgblight_post_config.h
- OPT_DEFS += -DRGBLIGHT_ENABLE
- SRC += $(QUANTUM_DIR)/color.c
- SRC += $(QUANTUM_DIR)/rgblight/rgblight.c
- CIE1931_CURVE := yes
- RGB_KEYCODES_ENABLE := yes
- endif
-
- ifeq ($(strip $(RGBLIGHT_DRIVER)), WS2812)
- WS2812_DRIVER_REQUIRED := yes
- endif
-
- ifeq ($(strip $(RGBLIGHT_DRIVER)), APA102)
- APA102_DRIVER_REQUIRED := yes
- endif
-
- ifeq ($(strip $(RGBLIGHT_DRIVER)), custom)
- OPT_DEFS += -DRGBLIGHT_CUSTOM_DRIVER
- endif
-endif
-
-LED_MATRIX_ENABLE ?= no
-VALID_LED_MATRIX_TYPES := IS31FL3731 IS31FL3742A IS31FL3743A IS31FL3745 IS31FL3746A custom
-# TODO: IS31FL3733 IS31FL3737 IS31FL3741
-
-ifeq ($(strip $(LED_MATRIX_ENABLE)), yes)
- ifeq ($(filter $(LED_MATRIX_DRIVER),$(VALID_LED_MATRIX_TYPES)),)
- $(call CATASTROPHIC_ERROR,Invalid LED_MATRIX_DRIVER,LED_MATRIX_DRIVER="$(LED_MATRIX_DRIVER)" is not a valid matrix type)
- endif
- OPT_DEFS += -DLED_MATRIX_ENABLE
-ifneq (,$(filter $(MCU), atmega16u2 atmega32u2 at90usb162))
- # ATmegaxxU2 does not have hardware MUL instruction - lib8tion must be told to use software multiplication routines
- OPT_DEFS += -DLIB8_ATTINY
-endif
- COMMON_VPATH += $(QUANTUM_DIR)/led_matrix
- COMMON_VPATH += $(QUANTUM_DIR)/led_matrix/animations
- COMMON_VPATH += $(QUANTUM_DIR)/led_matrix/animations/runners
- SRC += $(QUANTUM_DIR)/process_keycode/process_backlight.c
- SRC += $(QUANTUM_DIR)/led_matrix/led_matrix.c
- SRC += $(QUANTUM_DIR)/led_matrix/led_matrix_drivers.c
- SRC += $(LIB_PATH)/lib8tion/lib8tion.c
- CIE1931_CURVE := yes
-
- ifeq ($(strip $(LED_MATRIX_DRIVER)), IS31FL3731)
- OPT_DEFS += -DIS31FL3731 -DSTM32_I2C -DHAL_USE_I2C=TRUE
- COMMON_VPATH += $(DRIVER_PATH)/led/issi
- SRC += is31fl3731-simple.c
- QUANTUM_LIB_SRC += i2c_master.c
- endif
-
- ifeq ($(strip $(LED_MATRIX_DRIVER)), IS31FL3742A)
- OPT_DEFS += -DIS31FLCOMMON -DIS31FL3742A -DSTM32_I2C -DHAL_USE_I2C=TRUE
- COMMON_VPATH += $(DRIVER_PATH)/led/issi
- SRC += is31flcommon.c
- QUANTUM_LIB_SRC += i2c_master.c
- endif
-
- ifeq ($(strip $(LED_MATRIX_DRIVER)), IS31FL3743A)
- OPT_DEFS += -DIS31FLCOMMON -DIS31FL3743A -DSTM32_I2C -DHAL_USE_I2C=TRUE
- COMMON_VPATH += $(DRIVER_PATH)/led/issi
- SRC += is31flcommon.c
- QUANTUM_LIB_SRC += i2c_master.c
- endif
-
- ifeq ($(strip $(LED_MATRIX_DRIVER)), IS31FL3745)
- OPT_DEFS += -DIS31FLCOMMON -DIS31FL3745 -DSTM32_I2C -DHAL_USE_I2C=TRUE
- COMMON_VPATH += $(DRIVER_PATH)/led/issi
- SRC += is31flcommon.c
- QUANTUM_LIB_SRC += i2c_master.c
- endif
-
- ifeq ($(strip $(LED_MATRIX_DRIVER)), IS31FL3746A)
- OPT_DEFS += -DIS31FLCOMMON -DIS31FL3746A -DSTM32_I2C -DHAL_USE_I2C=TRUE
- COMMON_VPATH += $(DRIVER_PATH)/led/issi
- SRC += is31flcommon.c
- QUANTUM_LIB_SRC += i2c_master.c
- endif
-
-endif
-
-RGB_MATRIX_ENABLE ?= no
-
-VALID_RGB_MATRIX_TYPES := AW20216 IS31FL3731 IS31FL3733 IS31FL3737 IS31FL3741 IS31FL3742A IS31FL3743A IS31FL3745 IS31FL3746A CKLED2001 WS2812 custom
-ifeq ($(strip $(RGB_MATRIX_ENABLE)), yes)
- ifeq ($(filter $(RGB_MATRIX_DRIVER),$(VALID_RGB_MATRIX_TYPES)),)
- $(call CATASTROPHIC_ERROR,Invalid RGB_MATRIX_DRIVER,RGB_MATRIX_DRIVER="$(RGB_MATRIX_DRIVER)" is not a valid matrix type)
- endif
- OPT_DEFS += -DRGB_MATRIX_ENABLE
-ifneq (,$(filter $(MCU), atmega16u2 atmega32u2 at90usb162))
- # ATmegaxxU2 does not have hardware MUL instruction - lib8tion must be told to use software multiplication routines
- OPT_DEFS += -DLIB8_ATTINY
-endif
- COMMON_VPATH += $(QUANTUM_DIR)/rgb_matrix
- COMMON_VPATH += $(QUANTUM_DIR)/rgb_matrix/animations
- COMMON_VPATH += $(QUANTUM_DIR)/rgb_matrix/animations/runners
- SRC += $(QUANTUM_DIR)/color.c
- SRC += $(QUANTUM_DIR)/rgb_matrix/rgb_matrix.c
- SRC += $(QUANTUM_DIR)/rgb_matrix/rgb_matrix_drivers.c
- SRC += $(LIB_PATH)/lib8tion/lib8tion.c
- CIE1931_CURVE := yes
- RGB_KEYCODES_ENABLE := yes
-
- ifeq ($(strip $(RGB_MATRIX_DRIVER)), AW20216)
- OPT_DEFS += -DAW20216 -DSTM32_SPI -DHAL_USE_SPI=TRUE
- COMMON_VPATH += $(DRIVER_PATH)/led
- SRC += aw20216.c
- QUANTUM_LIB_SRC += spi_master.c
- endif
-
- ifeq ($(strip $(RGB_MATRIX_DRIVER)), IS31FL3731)
- OPT_DEFS += -DIS31FL3731 -DSTM32_I2C -DHAL_USE_I2C=TRUE
- COMMON_VPATH += $(DRIVER_PATH)/led/issi
- SRC += is31fl3731.c
- QUANTUM_LIB_SRC += i2c_master.c
- endif
-
- ifeq ($(strip $(RGB_MATRIX_DRIVER)), IS31FL3733)
- OPT_DEFS += -DIS31FL3733 -DSTM32_I2C -DHAL_USE_I2C=TRUE
- COMMON_VPATH += $(DRIVER_PATH)/led/issi
- SRC += is31fl3733.c
- QUANTUM_LIB_SRC += i2c_master.c
- endif
-
- ifeq ($(strip $(RGB_MATRIX_DRIVER)), IS31FL3737)
- OPT_DEFS += -DIS31FL3737 -DSTM32_I2C -DHAL_USE_I2C=TRUE
- COMMON_VPATH += $(DRIVER_PATH)/led/issi
- SRC += is31fl3737.c
- QUANTUM_LIB_SRC += i2c_master.c
- endif
-
- ifeq ($(strip $(RGB_MATRIX_DRIVER)), IS31FL3741)
- OPT_DEFS += -DIS31FL3741 -DSTM32_I2C -DHAL_USE_I2C=TRUE
- COMMON_VPATH += $(DRIVER_PATH)/led/issi
- SRC += is31fl3741.c
- QUANTUM_LIB_SRC += i2c_master.c
- endif
-
- ifeq ($(strip $(RGB_MATRIX_DRIVER)), IS31FL3742A)
- OPT_DEFS += -DIS31FLCOMMON -DIS31FL3742A -DSTM32_I2C -DHAL_USE_I2C=TRUE
- COMMON_VPATH += $(DRIVER_PATH)/led/issi
- SRC += is31flcommon.c
- QUANTUM_LIB_SRC += i2c_master.c
- endif
-
- ifeq ($(strip $(RGB_MATRIX_DRIVER)), IS31FL3743A)
- OPT_DEFS += -DIS31FLCOMMON -DIS31FL3743A -DSTM32_I2C -DHAL_USE_I2C=TRUE
- COMMON_VPATH += $(DRIVER_PATH)/led/issi
- SRC += is31flcommon.c
- QUANTUM_LIB_SRC += i2c_master.c
- endif
-
- ifeq ($(strip $(RGB_MATRIX_DRIVER)), IS31FL3745)
- OPT_DEFS += -DIS31FLCOMMON -DIS31FL3745 -DSTM32_I2C -DHAL_USE_I2C=TRUE
- COMMON_VPATH += $(DRIVER_PATH)/led/issi
- SRC += is31flcommon.c
- QUANTUM_LIB_SRC += i2c_master.c
- endif
-
- ifeq ($(strip $(RGB_MATRIX_DRIVER)), IS31FL3746A)
- OPT_DEFS += -DIS31FLCOMMON -DIS31FL3746A -DSTM32_I2C -DHAL_USE_I2C=TRUE
- COMMON_VPATH += $(DRIVER_PATH)/led/issi
- SRC += is31flcommon.c
- QUANTUM_LIB_SRC += i2c_master.c
- endif
-
- ifeq ($(strip $(RGB_MATRIX_DRIVER)), CKLED2001)
- OPT_DEFS += -DCKLED2001 -DSTM32_I2C -DHAL_USE_I2C=TRUE
- COMMON_VPATH += $(DRIVER_PATH)/led
- SRC += ckled2001.c
- QUANTUM_LIB_SRC += i2c_master.c
- endif
-
- ifeq ($(strip $(RGB_MATRIX_DRIVER)), WS2812)
- OPT_DEFS += -DWS2812
- WS2812_DRIVER_REQUIRED := yes
- endif
-
- ifeq ($(strip $(RGB_MATRIX_DRIVER)), APA102)
- OPT_DEFS += -DAPA102
- APA102_DRIVER_REQUIRED := yes
- endif
-
- ifeq ($(strip $(RGB_MATRIX_CUSTOM_KB)), yes)
- OPT_DEFS += -DRGB_MATRIX_CUSTOM_KB
- endif
-
- ifeq ($(strip $(RGB_MATRIX_CUSTOM_USER)), yes)
- OPT_DEFS += -DRGB_MATRIX_CUSTOM_USER
- endif
-endif
-
-ifeq ($(strip $(RGB_KEYCODES_ENABLE)), yes)
- SRC += $(QUANTUM_DIR)/process_keycode/process_rgb.c
-endif
-
-ifeq ($(strip $(PRINTING_ENABLE)), yes)
- OPT_DEFS += -DPRINTING_ENABLE
- SRC += $(QUANTUM_DIR)/process_keycode/process_printer.c
- QUANTUM_LIB_SRC += uart.c
-endif
-
-VARIABLE_TRACE ?= no
-ifneq ($(strip $(VARIABLE_TRACE)),no)
- SRC += $(QUANTUM_DIR)/variable_trace.c
- OPT_DEFS += -DNUM_TRACED_VARIABLES=$(strip $(VARIABLE_TRACE))
- ifneq ($(strip $(MAX_VARIABLE_TRACE_SIZE)),)
- OPT_DEFS += -DMAX_VARIABLE_TRACE_SIZE=$(strip $(MAX_VARIABLE_TRACE_SIZE))
- endif
-endif
-
-ifeq ($(strip $(SLEEP_LED_ENABLE)), yes)
- SRC += $(PLATFORM_COMMON_DIR)/sleep_led.c
- OPT_DEFS += -DSLEEP_LED_ENABLE
-
- NO_SUSPEND_POWER_DOWN := yes
-endif
-
-VALID_BACKLIGHT_TYPES := pwm timer software custom
-
-BACKLIGHT_ENABLE ?= no
-ifeq ($(strip $(CONVERT_TO_PROTON_C)), yes)
- BACKLIGHT_DRIVER ?= software
-else
- BACKLIGHT_DRIVER ?= pwm
-endif
-ifeq ($(strip $(BACKLIGHT_ENABLE)), yes)
- ifeq ($(filter $(BACKLIGHT_DRIVER),$(VALID_BACKLIGHT_TYPES)),)
- $(call CATASTROPHIC_ERROR,Invalid BACKLIGHT_DRIVER,BACKLIGHT_DRIVER="$(BACKLIGHT_DRIVER)" is not a valid backlight type)
- endif
-
- COMMON_VPATH += $(QUANTUM_DIR)/backlight
- SRC += $(QUANTUM_DIR)/backlight/backlight.c
- SRC += $(QUANTUM_DIR)/process_keycode/process_backlight.c
- OPT_DEFS += -DBACKLIGHT_ENABLE
-
- ifeq ($(strip $(BACKLIGHT_DRIVER)), custom)
- OPT_DEFS += -DBACKLIGHT_CUSTOM_DRIVER
- else
- SRC += $(QUANTUM_DIR)/backlight/backlight_driver_common.c
- ifeq ($(strip $(BACKLIGHT_DRIVER)), pwm)
- SRC += $(QUANTUM_DIR)/backlight/backlight_$(PLATFORM_KEY).c
- else
- SRC += $(QUANTUM_DIR)/backlight/backlight_$(strip $(BACKLIGHT_DRIVER)).c
- endif
- endif
-endif
-
-VALID_WS2812_DRIVER_TYPES := bitbang pwm spi i2c
-
-WS2812_DRIVER ?= bitbang
-ifeq ($(strip $(WS2812_DRIVER_REQUIRED)), yes)
- ifeq ($(filter $(WS2812_DRIVER),$(VALID_WS2812_DRIVER_TYPES)),)
- $(call CATASTROPHIC_ERROR,Invalid WS2812_DRIVER,WS2812_DRIVER="$(WS2812_DRIVER)" is not a valid WS2812 driver)
- endif
-
- OPT_DEFS += -DWS2812_DRIVER_$(strip $(shell echo $(WS2812_DRIVER) | tr '[:lower:]' '[:upper:]'))
-
- ifeq ($(strip $(WS2812_DRIVER)), bitbang)
- SRC += ws2812.c
- else
- SRC += ws2812_$(strip $(WS2812_DRIVER)).c
-
- ifeq ($(strip $(PLATFORM)), CHIBIOS)
- ifeq ($(strip $(WS2812_DRIVER)), pwm)
- OPT_DEFS += -DSTM32_DMA_REQUIRED=TRUE
- endif
- endif
- endif
-
- # add extra deps
- ifeq ($(strip $(WS2812_DRIVER)), i2c)
- QUANTUM_LIB_SRC += i2c_master.c
- endif
-endif
-
-ifeq ($(strip $(APA102_DRIVER_REQUIRED)), yes)
- COMMON_VPATH += $(DRIVER_PATH)/led
- SRC += apa102.c
-endif
-
-ifeq ($(strip $(CIE1931_CURVE)), yes)
- OPT_DEFS += -DUSE_CIE1931_CURVE
- LED_TABLES := yes
-endif
-
-ifeq ($(strip $(LED_TABLES)), yes)
- SRC += $(QUANTUM_DIR)/led_tables.c
-endif
-
-ifeq ($(strip $(TERMINAL_ENABLE)), yes)
- SRC += $(QUANTUM_DIR)/process_keycode/process_terminal.c
- OPT_DEFS += -DTERMINAL_ENABLE
- OPT_DEFS += -DUSER_PRINT
-endif
-
-ifeq ($(strip $(VIA_ENABLE)), yes)
- DYNAMIC_KEYMAP_ENABLE := yes
- RAW_ENABLE := yes
- BOOTMAGIC_ENABLE := yes
- SRC += $(QUANTUM_DIR)/via.c
- OPT_DEFS += -DVIA_ENABLE
-endif
-
-VALID_MAGIC_TYPES := yes
-BOOTMAGIC_ENABLE ?= no
-ifneq ($(strip $(BOOTMAGIC_ENABLE)), no)
- ifeq ($(filter $(BOOTMAGIC_ENABLE),$(VALID_MAGIC_TYPES)),)
- $(call CATASTROPHIC_ERROR,Invalid BOOTMAGIC_ENABLE,BOOTMAGIC_ENABLE="$(BOOTMAGIC_ENABLE)" is not a valid type of magic)
- endif
- ifneq ($(strip $(BOOTMAGIC_ENABLE)), no)
- OPT_DEFS += -DBOOTMAGIC_LITE
- QUANTUM_SRC += $(QUANTUM_DIR)/bootmagic/bootmagic_lite.c
- endif
-endif
-COMMON_VPATH += $(QUANTUM_DIR)/bootmagic
-QUANTUM_SRC += $(QUANTUM_DIR)/bootmagic/magic.c
-
-VALID_CUSTOM_MATRIX_TYPES:= yes lite no
-
-CUSTOM_MATRIX ?= no
-
-ifneq ($(strip $(CUSTOM_MATRIX)), yes)
- ifeq ($(filter $(CUSTOM_MATRIX),$(VALID_CUSTOM_MATRIX_TYPES)),)
- $(call CATASTROPHIC_ERROR,Invalid CUSTOM_MATRIX,CUSTOM_MATRIX="$(CUSTOM_MATRIX)" is not a valid custom matrix type)
- endif
-
- # Include common stuff for all non custom matrix users
- QUANTUM_SRC += $(QUANTUM_DIR)/matrix_common.c
-
- # if 'lite' then skip the actual matrix implementation
- ifneq ($(strip $(CUSTOM_MATRIX)), lite)
- # Include the standard or split matrix code if needed
- QUANTUM_SRC += $(QUANTUM_DIR)/matrix.c
- endif
-endif
-
-# Debounce Modules. Set DEBOUNCE_TYPE=custom if including one manually.
-DEBOUNCE_TYPE ?= sym_defer_g
-ifneq ($(strip $(DEBOUNCE_TYPE)), custom)
- QUANTUM_SRC += $(QUANTUM_DIR)/debounce/$(strip $(DEBOUNCE_TYPE)).c
-endif
-
-ifeq ($(strip $(SPLIT_KEYBOARD)), yes)
- POST_CONFIG_H += $(QUANTUM_DIR)/split_common/post_config.h
- OPT_DEFS += -DSPLIT_KEYBOARD
- CRC_ENABLE := yes
-
- # Include files used by all split keyboards
- QUANTUM_SRC += $(QUANTUM_DIR)/split_common/split_util.c
-
- # Determine which (if any) transport files are required
- ifneq ($(strip $(SPLIT_TRANSPORT)), custom)
- QUANTUM_SRC += $(QUANTUM_DIR)/split_common/transport.c \
- $(QUANTUM_DIR)/split_common/transactions.c
-
- OPT_DEFS += -DSPLIT_COMMON_TRANSACTIONS
-
- # Functions added via QUANTUM_LIB_SRC are only included in the final binary if they're called.
- # Unused functions are pruned away, which is why we can add multiple drivers here without bloat.
- ifeq ($(PLATFORM),AVR)
- ifneq ($(NO_I2C),yes)
- QUANTUM_LIB_SRC += i2c_master.c \
- i2c_slave.c
- endif
- endif
-
- SERIAL_DRIVER ?= bitbang
- OPT_DEFS += -DSERIAL_DRIVER_$(strip $(shell echo $(SERIAL_DRIVER) | tr '[:lower:]' '[:upper:]'))
- ifeq ($(strip $(SERIAL_DRIVER)), bitbang)
- QUANTUM_LIB_SRC += serial.c
- else
- QUANTUM_LIB_SRC += serial_$(strip $(SERIAL_DRIVER)).c
- endif
- endif
- COMMON_VPATH += $(QUANTUM_PATH)/split_common
-endif
-
-ifeq ($(strip $(CRC_ENABLE)), yes)
- OPT_DEFS += -DCRC_ENABLE
- SRC += crc.c
-endif
-
-ifeq ($(strip $(HAPTIC_ENABLE)),yes)
- COMMON_VPATH += $(DRIVER_PATH)/haptic
-
- ifneq ($(filter DRV2605L, $(HAPTIC_DRIVER)), )
- SRC += DRV2605L.c
- QUANTUM_LIB_SRC += i2c_master.c
- OPT_DEFS += -DDRV2605L
- endif
-
- ifneq ($(filter SOLENOID, $(HAPTIC_DRIVER)), )
- SRC += solenoid.c
- OPT_DEFS += -DSOLENOID_ENABLE
- endif
-endif
-
-ifeq ($(strip $(HD44780_ENABLE)), yes)
- SRC += platforms/avr/drivers/hd44780.c
- OPT_DEFS += -DHD44780_ENABLE
-endif
-
-VALID_OLED_DRIVER_TYPES := SSD1306 custom
-OLED_DRIVER ?= SSD1306
-ifeq ($(strip $(OLED_ENABLE)), yes)
- ifeq ($(filter $(OLED_DRIVER),$(VALID_OLED_DRIVER_TYPES)),)
- $(call CATASTROPHIC_ERROR,Invalid OLED_DRIVER,OLED_DRIVER="$(OLED_DRIVER)" is not a valid OLED driver)
- else
- OPT_DEFS += -DOLED_ENABLE
- COMMON_VPATH += $(DRIVER_PATH)/oled
-
- OPT_DEFS += -DOLED_DRIVER_$(strip $(shell echo $(OLED_DRIVER) | tr '[:lower:]' '[:upper:]'))
- ifeq ($(strip $(OLED_DRIVER)), SSD1306)
- SRC += ssd1306_sh1106.c
- QUANTUM_LIB_SRC += i2c_master.c
- endif
- endif
-endif
-
-ifeq ($(strip $(ST7565_ENABLE)), yes)
- OPT_DEFS += -DST7565_ENABLE
- COMMON_VPATH += $(DRIVER_PATH)/oled # For glcdfont.h
- COMMON_VPATH += $(DRIVER_PATH)/lcd
- QUANTUM_LIB_SRC += spi_master.c
- SRC += st7565.c
-endif
-
-ifeq ($(strip $(UCIS_ENABLE)), yes)
- OPT_DEFS += -DUCIS_ENABLE
- UNICODE_COMMON := yes
- SRC += $(QUANTUM_DIR)/process_keycode/process_ucis.c
-endif
-
-ifeq ($(strip $(UNICODEMAP_ENABLE)), yes)
- OPT_DEFS += -DUNICODEMAP_ENABLE
- UNICODE_COMMON := yes
- SRC += $(QUANTUM_DIR)/process_keycode/process_unicodemap.c
-endif
-
-ifeq ($(strip $(UNICODE_ENABLE)), yes)
- OPT_DEFS += -DUNICODE_ENABLE
- UNICODE_COMMON := yes
- SRC += $(QUANTUM_DIR)/process_keycode/process_unicode.c
-endif
-
-ifeq ($(strip $(UNICODE_COMMON)), yes)
- OPT_DEFS += -DUNICODE_COMMON_ENABLE
- SRC += $(QUANTUM_DIR)/process_keycode/process_unicode_common.c
-endif
-
-MAGIC_ENABLE ?= yes
-ifeq ($(strip $(MAGIC_ENABLE)), yes)
- SRC += $(QUANTUM_DIR)/process_keycode/process_magic.c
- OPT_DEFS += -DMAGIC_KEYCODE_ENABLE
-endif
-
-ifeq ($(strip $(AUTO_SHIFT_ENABLE)), yes)
- SRC += $(QUANTUM_DIR)/process_keycode/process_auto_shift.c
- OPT_DEFS += -DAUTO_SHIFT_ENABLE
- ifeq ($(strip $(AUTO_SHIFT_MODIFIERS)), yes)
- OPT_DEFS += -DAUTO_SHIFT_MODIFIERS
- endif
-endif
-
-ifeq ($(strip $(PS2_MOUSE_ENABLE)), yes)
- PS2_ENABLE := yes
- SRC += ps2_mouse.c
- OPT_DEFS += -DPS2_MOUSE_ENABLE
- OPT_DEFS += -DMOUSE_ENABLE
-endif
-
-ifeq ($(strip $(PS2_USE_BUSYWAIT)), yes)
- PS2_ENABLE := yes
- SRC += ps2_busywait.c
- SRC += ps2_io_avr.c
- OPT_DEFS += -DPS2_USE_BUSYWAIT
-endif
-
-ifeq ($(strip $(PS2_USE_INT)), yes)
- PS2_ENABLE := yes
- SRC += ps2_interrupt.c
- SRC += ps2_io.c
- OPT_DEFS += -DPS2_USE_INT
-endif
-
-ifeq ($(strip $(PS2_USE_USART)), yes)
- PS2_ENABLE := yes
- SRC += ps2_usart.c
- SRC += ps2_io.c
- OPT_DEFS += -DPS2_USE_USART
-endif
-
-ifeq ($(strip $(PS2_ENABLE)), yes)
- COMMON_VPATH += $(DRIVER_PATH)/ps2
- COMMON_VPATH += $(PLATFORM_PATH)/$(PLATFORM_KEY)/$(DRIVER_DIR)/ps2
- OPT_DEFS += -DPS2_ENABLE
-endif
-
-JOYSTICK_ENABLE ?= no
-VALID_JOYSTICK_TYPES := analog digital
-JOYSTICK_DRIVER ?= analog
-ifeq ($(strip $(JOYSTICK_ENABLE)), yes)
- ifeq ($(filter $(JOYSTICK_DRIVER),$(VALID_JOYSTICK_TYPES)),)
- $(call CATASTROPHIC_ERROR,Invalid JOYSTICK_DRIVER,JOYSTICK_DRIVER="$(JOYSTICK_DRIVER)" is not a valid joystick driver)
- endif
- OPT_DEFS += -DJOYSTICK_ENABLE
- SRC += $(QUANTUM_DIR)/process_keycode/process_joystick.c
- SRC += $(QUANTUM_DIR)/joystick.c
-
- ifeq ($(strip $(JOYSTICK_DRIVER)), analog)
- OPT_DEFS += -DANALOG_JOYSTICK_ENABLE
- SRC += analog.c
- endif
- ifeq ($(strip $(JOYSTICK_DRIVER)), digital)
- OPT_DEFS += -DDIGITAL_JOYSTICK_ENABLE
- endif
-endif
-
-USBPD_ENABLE ?= no
-VALID_USBPD_DRIVER_TYPES = custom vendor
-USBPD_DRIVER ?= vendor
-ifeq ($(strip $(USBPD_ENABLE)), yes)
- ifeq ($(filter $(strip $(USBPD_DRIVER)),$(VALID_USBPD_DRIVER_TYPES)),)
- $(call CATASTROPHIC_ERROR,Invalid USBPD_DRIVER,USBPD_DRIVER="$(USBPD_DRIVER)" is not a valid USBPD driver)
- else
- OPT_DEFS += -DUSBPD_ENABLE
- ifeq ($(strip $(USBPD_DRIVER)), vendor)
- # Vendor-specific implementations
- OPT_DEFS += -DUSBPD_VENDOR
- ifeq ($(strip $(MCU_SERIES)), STM32G4xx)
- OPT_DEFS += -DUSBPD_STM32G4
- SRC += usbpd_stm32g4.c
- else
- $(call CATASTROPHIC_ERROR,Invalid USBPD_DRIVER,There is no vendor-provided USBPD driver available)
- endif
- else ifeq ($(strip $(USBPD_DRIVER)), custom)
- OPT_DEFS += -DUSBPD_CUSTOM
- # Board designers can add their own driver to $(SRC)
- endif
- endif
-endif
-
-BLUETOOTH_ENABLE ?= no
-VALID_BLUETOOTH_DRIVER_TYPES := BluefruitLE RN42 custom
-ifeq ($(strip $(BLUETOOTH_ENABLE)), yes)
- ifeq ($(filter $(strip $(BLUETOOTH_DRIVER)),$(VALID_BLUETOOTH_DRIVER_TYPES)),)
- $(call CATASTROPHIC_ERROR,Invalid BLUETOOTH_DRIVER,BLUETOOTH_DRIVER="$(BLUETOOTH_DRIVER)" is not a valid Bluetooth driver type)
- endif
- OPT_DEFS += -DBLUETOOTH_ENABLE
- NO_USB_STARTUP_CHECK := yes
- COMMON_VPATH += $(DRIVER_PATH)/bluetooth
- SRC += outputselect.c
-
- ifeq ($(strip $(BLUETOOTH_DRIVER)), BluefruitLE)
- OPT_DEFS += -DBLUETOOTH_BLUEFRUIT_LE
- SRC += analog.c
- SRC += $(DRIVER_PATH)/bluetooth/bluefruit_le.cpp
- QUANTUM_LIB_SRC += spi_master.c
- endif
-
- ifeq ($(strip $(BLUETOOTH_DRIVER)), RN42)
- OPT_DEFS += -DBLUETOOTH_RN42
- SRC += $(DRIVER_PATH)/bluetooth/rn42.c
- QUANTUM_LIB_SRC += uart.c
- endif
-endif
diff --git a/lib/python/qmk/cli/multibuild.py b/lib/python/qmk/cli/multibuild.py
index ad059edff3..dff8c88422 100755
--- a/lib/python/qmk/cli/multibuild.py
+++ b/lib/python/qmk/cli/multibuild.py
@@ -69,7 +69,7 @@ def multibuild(cli):
all: {keyboard_safe}_binary
{keyboard_safe}_binary:
@rm -f "{QMK_FIRMWARE}/.build/failed.log.{keyboard_safe}" || true
- +@$(MAKE) -C "{QMK_FIRMWARE}" -f "{QMK_FIRMWARE}/build_keyboard.mk" KEYBOARD="{keyboard_name}" KEYMAP="{cli.args.keymap}" REQUIRE_PLATFORM_KEY= COLOR=true SILENT=false {' '.join(cli.args.env)} \\
+ +@$(MAKE) -C "{QMK_FIRMWARE}" -f "{QMK_FIRMWARE}/builddefs/build_keyboard.mk" KEYBOARD="{keyboard_name}" KEYMAP="{cli.args.keymap}" REQUIRE_PLATFORM_KEY= COLOR=true SILENT=false {' '.join(cli.args.env)} \\
>>"{QMK_FIRMWARE}/.build/build.log.{os.getpid()}.{keyboard_safe}" 2>&1 \\
|| cp "{QMK_FIRMWARE}/.build/build.log.{os.getpid()}.{keyboard_safe}" "{QMK_FIRMWARE}/.build/failed.log.{os.getpid()}.{keyboard_safe}"
@{{ grep '\[ERRORS\]' "{QMK_FIRMWARE}/.build/build.log.{os.getpid()}.{keyboard_safe}" >/dev/null 2>&1 && printf "Build %-64s \e[1;31m[ERRORS]\e[0m\\n" "{keyboard_name}:{cli.args.keymap}" ; }} \\
diff --git a/lib/python/qmk/commands.py b/lib/python/qmk/commands.py
index 90a68ca3cd..275cd72e5c 100644
--- a/lib/python/qmk/commands.py
+++ b/lib/python/qmk/commands.py
@@ -213,7 +213,7 @@ def compile_configurator_json(user_keymap, bootloader=None, parallel=1, **env_va
'-r',
'-R',
'-f',
- 'build_keyboard.mk',
+ 'builddefs/build_keyboard.mk',
])
if bootloader:
diff --git a/paths.mk b/paths.mk
index 5a39d00ecd..85ccfa0796 100644
--- a/paths.mk
+++ b/paths.mk
@@ -2,7 +2,9 @@
TOP_DIR = .
TMK_DIR = tmk_core
TMK_PATH = $(TMK_DIR)
-LIB_PATH = lib
+
+LIB_DIR = lib
+LIB_PATH = $(LIB_DIR)
QUANTUM_DIR = quantum
QUANTUM_PATH = $(QUANTUM_DIR)
diff --git a/testlist.mk b/testlist.mk
deleted file mode 100644
index 86da5668ac..0000000000
--- a/testlist.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-TEST_LIST = $(sort $(patsubst %/test.mk,%, $(shell find $(ROOT_DIR)tests -type f -name test.mk)))
-FULL_TESTS := $(notdir $(TEST_LIST))
-
-include $(QUANTUM_PATH)/debounce/tests/testlist.mk
-include $(QUANTUM_PATH)/sequencer/tests/testlist.mk
-include $(PLATFORM_PATH)/test/testlist.mk
-
-define VALIDATE_TEST_LIST
- ifneq ($1,)
- ifeq ($$(findstring -,$1),-)
- $$(call CATASTROPHIC_ERROR,Invalid test name,Test names can't contain '-', but '$1' does.)
- else
- $$(eval $$(call VALIDATE_TEST_LIST,$$(firstword $2),$$(wordlist 2,9999,$2)))
- endif
- endif
-endef
-
-
-$(eval $(call VALIDATE_TEST_LIST,$(firstword $(TEST_LIST)),$(wordlist 2,9999,$(TEST_LIST))))
diff --git a/tmk_core/rules.mk b/tmk_core/rules.mk
deleted file mode 100644
index b303a87919..0000000000
--- a/tmk_core/rules.mk
+++ /dev/null
@@ -1,523 +0,0 @@
-# Hey Emacs, this is a -*- makefile -*-
-#----------------------------------------------------------------------------
-# WinAVR Makefile Template written by Eric B. Weddington, Jî’šg Wunsch, et al.
-#
-# Released to the Public Domain
-#
-# Additional material for this makefile was written by:
-# Peter Fleury
-# Tim Henigan
-# Colin O'Flynn
-# Reiner Patommel
-# Markus Pfaff
-# Sander Pool
-# Frederik Rouleau
-# Carlos Lamas
-#
-
-# Enable vpath seraching for source files only
-# Without this, output files, could be read from the wrong .build directories
-VPATH_SRC := $(VPATH)
-vpath %.c $(VPATH_SRC)
-vpath %.h $(VPATH_SRC)
-vpath %.cpp $(VPATH_SRC)
-vpath %.cc $(VPATH_SRC)
-vpath %.hpp $(VPATH_SRC)
-vpath %.S $(VPATH_SRC)
-VPATH :=
-
-# Convert all SRC to OBJ
-define OBJ_FROM_SRC
-$(patsubst %.c,$1/%.o,$(patsubst %.cpp,$1/%.o,$(patsubst %.cc,$1/%.o,$(patsubst %.S,$1/%.o,$(patsubst %.clib,$1/%.a,$($1_SRC))))))
-endef
-$(foreach OUTPUT,$(OUTPUTS),$(eval $(OUTPUT)_OBJ +=$(call OBJ_FROM_SRC,$(OUTPUT))))
-
-# Define a list of all objects
-OBJ := $(foreach OUTPUT,$(OUTPUTS),$($(OUTPUT)_OBJ))
-NO_LTO_OBJ := $(filter %.a,$(OBJ))
-
-MASTER_OUTPUT := $(firstword $(OUTPUTS))
-
-
-
-# Output format. (can be srec, ihex, binary)
-FORMAT = ihex
-
-# Optimization level, can be [0, 1, 2, 3, s].
-# 0 = turn off optimization. s = optimize for size.
-# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
-OPT ?= s
-
-# Compiler flag to set the C Standard level.
-# c89 = "ANSI" C
-# gnu89 = c89 plus GCC extensions
-# c99 = ISO C99 standard (not yet fully implemented)
-# gnu99 = c99 plus GCC extensions
-CSTANDARD = -std=gnu99
-
-
-# Place -D or -U options here for C sources
-#CDEFS +=
-
-
-# Place -D or -U options here for ASM sources
-#ADEFS +=
-
-
-# Place -D or -U options here for C++ sources
-#CXXDEFS += -D__STDC_LIMIT_MACROS
-#CXXDEFS += -D__STDC_CONSTANT_MACROS
-#CXXDEFS +=
-
-# Speed up recompilations by opt-in usage of ccache
-USE_CCACHE ?= no
-ifneq ($(USE_CCACHE),no)
- CC_PREFIX ?= ccache
-endif
-
-#---------------- Compiler Options C ----------------
-# -g*: generate debugging information
-# -O*: optimization level
-# -f...: tuning, see GCC manual and avr-libc documentation
-# -Wall...: warning level
-# -Wa,...: tell GCC to pass this to the assembler.
-ifeq ($(strip $(LTO_ENABLE)), yes)
- ifeq ($(PLATFORM),CHIBIOS)
- $(info Enabling LTO on ChibiOS-targeting boards is known to have a high likelihood of failure.)
- $(info If unsure, set LTO_ENABLE = no.)
- endif
- CDEFS += -flto
- CDEFS += -DLTO_ENABLE
-endif
-
-DEBUG_ENABLE ?= yes
-ifeq ($(strip $(SKIP_DEBUG_INFO)),yes)
- DEBUG_ENABLE=no
-endif
-
-ifeq ($(strip $(DEBUG_ENABLE)),yes)
- CFLAGS += -g$(DEBUG)
-endif
-CFLAGS += $(CDEFS)
-CFLAGS += -O$(OPT)
-# add color
-ifeq ($(COLOR),true)
-ifeq ("$(shell echo "int main(){}" | $(CC) -fdiagnostics-color -x c - -o /dev/null 2>&1)", "")
- CFLAGS+= -fdiagnostics-color
-endif
-endif
-CFLAGS += -Wall
-CFLAGS += -Wstrict-prototypes
-ifneq ($(strip $(ALLOW_WARNINGS)), yes)
- CFLAGS += -Werror
-endif
-#CFLAGS += -mshort-calls
-#CFLAGS += -fno-unit-at-a-time
-#CFLAGS += -Wundef
-#CFLAGS += -Wunreachable-code
-#CFLAGS += -Wsign-compare
-CFLAGS += $(CSTANDARD)
-
-# This fixes lots of keyboards linking errors but SHOULDN'T BE A FINAL SOLUTION
-# Fixing of multiple variable definitions must be made.
-CFLAGS += -fcommon
-
-#---------------- Compiler Options C++ ----------------
-# -g*: generate debugging information
-# -O*: optimization level
-# -f...: tuning, see GCC manual and avr-libc documentation
-# -Wall...: warning level
-# -Wa,...: tell GCC to pass this to the assembler.
-ifeq ($(strip $(DEBUG_ENABLE)),yes)
- CXXFLAGS += -g$(DEBUG)
-endif
-CXXFLAGS += $(CXXDEFS)
-CXXFLAGS += -O$(OPT)
-# to supress "warning: only initialized variables can be placed into program memory area"
-CXXFLAGS += -w
-CXXFLAGS += -Wall
-CXXFLAGS += -Wundef
-
-ifneq ($(strip $(ALLOW_WARNINGS)), yes)
- CXXFLAGS += -Werror
-endif
-#CXXFLAGS += -mshort-calls
-#CXXFLAGS += -fno-unit-at-a-time
-#CXXFLAGS += -Wstrict-prototypes
-#CXXFLAGS += -Wunreachable-code
-#CXXFLAGS += -Wsign-compare
-#CXXFLAGS += $(CSTANDARD)
-
-#---------------- Assembler Options ----------------
-ASFLAGS += $(ADEFS)
-ifeq ($(VERBOSE_AS_CMD),yes)
- ASFLAGS += -v
-endif
-
-#---------------- Library Options ----------------
-# Minimalistic printf version
-PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
-
-# Floating point printf version (requires MATH_LIB = -lm below)
-PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
-
-# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
-#PRINTF_LIB = $(PRINTF_LIB_MIN)
-#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
-
-
-# Minimalistic scanf version
-SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
-
-# Floating point + %[ scanf version (requires MATH_LIB = -lm below)
-SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
-
-# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
-#SCANF_LIB = $(SCANF_LIB_MIN)
-#SCANF_LIB = $(SCANF_LIB_FLOAT)
-
-
-MATH_LIB = -lm
-CREATE_MAP ?= yes
-
-
-#---------------- Linker Options ----------------
-# -Wl,...: tell GCC to pass this to linker.
-# -Map: create map file
-# --cref: add cross reference to map file
-#
-# Comennt out "--relax" option to avoid a error such:
-# (.vectors+0x30): relocation truncated to fit: R_AVR_13_PCREL against symbol `__vector_12'
-#
-
-ifeq ($(CREATE_MAP),yes)
- LDFLAGS += -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref
-endif
-ifeq ($(VERBOSE_LD_CMD),yes)
- LDFLAGS += -v
-endif
-#LDFLAGS += -Wl,--relax
-LDFLAGS += $(EXTMEMOPTS)
-LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
-LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB)
-#LDFLAGS += -T linker_script.x
-# You can give EXTRALDFLAGS at 'make' command line.
-LDFLAGS += $(EXTRALDFLAGS)
-
-#---------------- Assembler Listings ----------------
-# -Wa,...: tell GCC to pass this to the assembler.
-# -adhlns: create listing
-# -gstabs: have the assembler create line number information; note that
-# for use in COFF files, additional information about filenames
-# and function names needs to be present in the assembler source
-# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
-# dump that will be displayed for a given single line of source input.
-
-ADHLNS_ENABLE ?= no
-ifeq ($(ADHLNS_ENABLE),yes)
- # Avoid "Options to '-Xassembler' do not match" - only specify assembler options at LTO link time
- ifeq ($(strip $(LTO_ENABLE)), yes)
- LDFLAGS += -Wa,-adhlns=$(BUILD_DIR)/$(TARGET).lst
- else
- CFLAGS += -Wa,-adhlns=$(@:%.o=%.lst)
- CXXFLAGS += -Wa,-adhlns=$(@:%.o=%.lst)
- ifeq ($(strip $(DEBUG_ENABLE)),yes)
- ASFLAGS = -Wa,-adhlns=$(@:%.o=%.lst),-gstabs,--listing-cont-lines=100
- else
- ASFLAGS = -Wa,-adhlns=$(@:%.o=%.lst),--listing-cont-lines=100
- endif
- endif
-endif
-
-# Define programs and commands.
-SHELL = sh
-SED = sed
-REMOVE = rm -f
-REMOVEDIR = rmdir
-COPY = cp
-WINSHELL = cmd
-SECHO = $(SILENT) || echo
-MD5SUM ?= md5sum
-ifneq ($(filter Darwin FreeBSD,$(shell uname -s)),)
- MD5SUM = md5
-endif
-
-# UF2 format settings
-# To produce a UF2 file in your build, add to your keyboard's rules.mk:
-# FIRMWARE_FORMAT = uf2
-UF2CONV = $(TOP_DIR)/util/uf2conv.py
-UF2_FAMILY ?= 0x0
-
-# Compiler flags to generate dependency files.
-#GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d
-GENDEPFLAGS = -MMD -MP -MF $(patsubst %.o,%.td,$@)
-
-
-# Combine all necessary flags and optional flags.
-# Add target processor to flags.
-# You can give extra flags at 'make' command line like: make EXTRAFLAGS=-DFOO=bar
-ALL_CFLAGS = $(MCUFLAGS) $(CFLAGS) $(EXTRAFLAGS)
-ALL_CXXFLAGS = $(MCUFLAGS) -x c++ $(CXXFLAGS) $(EXTRAFLAGS)
-ALL_ASFLAGS = $(MCUFLAGS) -x assembler-with-cpp $(ASFLAGS) $(EXTRAFLAGS)
-
-define NO_LTO
-$(patsubst %.a,%.o,$1): NOLTO_CFLAGS += -fno-lto
-endef
-$(foreach LOBJ, $(NO_LTO_OBJ), $(eval $(call NO_LTO,$(LOBJ))))
-
-MOVE_DEP = mv -f $(patsubst %.o,%.td,$@) $(patsubst %.o,%.d,$@)
-
-# For a ChibiOS build, ensure that the board files have the hook overrides injected
-define BOARDSRC_INJECT_HOOKS
-$(KEYBOARD_OUTPUT)/$(patsubst %.c,%.o,$(patsubst ./%,%,$1)): INIT_HOOK_CFLAGS += -include $(TOP_DIR)/tmk_core/protocol/chibios/init_hooks.h
-endef
-$(foreach LOBJ, $(BOARDSRC), $(eval $(call BOARDSRC_INJECT_HOOKS,$(LOBJ))))
-
-# Add QMK specific flags
-DFU_SUFFIX ?= dfu-suffix
-DFU_SUFFIX_ARGS ?=
-
-
-elf: $(BUILD_DIR)/$(TARGET).elf
-hex: $(BUILD_DIR)/$(TARGET).hex
-uf2: $(BUILD_DIR)/$(TARGET).uf2
-cpfirmware: $(FIRMWARE_FORMAT)
- $(SILENT) || printf "Copying $(TARGET).$(FIRMWARE_FORMAT) to qmk_firmware folder" | $(AWK_CMD)
- $(COPY) $(BUILD_DIR)/$(TARGET).$(FIRMWARE_FORMAT) $(TARGET).$(FIRMWARE_FORMAT) && $(PRINT_OK)
-eep: $(BUILD_DIR)/$(TARGET).eep
-lss: $(BUILD_DIR)/$(TARGET).lss
-sym: $(BUILD_DIR)/$(TARGET).sym
-LIBNAME=lib$(TARGET).a
-lib: $(LIBNAME)
-
-# Display size of file, modifying the output so people don't mistakenly grab the hex output
-BINARY_SIZE = $(SIZE) --target=$(FORMAT) $(BUILD_DIR)/$(TARGET).hex | $(SED) -e 's/\.build\/.*$$/$(TARGET).$(FIRMWARE_FORMAT)/g'
-
-sizebefore:
- @if test -f $(BUILD_DIR)/$(TARGET).hex; then $(SECHO) $(MSG_SIZE_BEFORE); $(SILENT) || $(BINARY_SIZE); \
- 2>/dev/null; $(SECHO); fi
-
-sizeafter: $(BUILD_DIR)/$(TARGET).hex
- @if test -f $(BUILD_DIR)/$(TARGET).hex; then $(SECHO); $(SECHO) $(MSG_SIZE_AFTER); $(SILENT) || $(BINARY_SIZE); \
- 2>/dev/null; $(SECHO); fi
-
-# Display compiler version information.
-gccversion :
- @$(SILENT) || $(CC) --version
-
-# Create final output files (.hex, .eep) from ELF output file.
-%.hex: %.elf
- $(eval CMD=$(HEX) $< $@)
- #@$(SILENT) || printf "$(MSG_EXECUTING) '$(CMD)':\n"
- @$(SILENT) || printf "$(MSG_FLASH) $@" | $(AWK_CMD)
- @$(BUILD_CMD)
-
-%.uf2: %.hex
- $(eval CMD=$(UF2CONV) $(BUILD_DIR)/$(TARGET).hex -o $(BUILD_DIR)/$(TARGET).uf2 -c -f $(UF2_FAMILY) >/dev/null 2>&1)
- #@$(SILENT) || printf "$(MSG_EXECUTING) '$(CMD)':\n"
- @$(SILENT) || printf "$(MSG_UF2) $@" | $(AWK_CMD)
- @$(BUILD_CMD)
-
-%.eep: %.elf
- $(eval CMD=$(EEP) $< $@ || exit 0)
- #@$(SILENT) || printf "$(MSG_EXECUTING) '$(CMD)':\n"
- @$(SILENT) || printf "$(MSG_EEPROM) $@" | $(AWK_CMD)
- @$(BUILD_CMD)
-
-# Create extended listing file from ELF output file.
-%.lss: %.elf
- $(eval CMD=$(OBJDUMP) -h -S -z $< > $@)
- #@$(SILENT) || printf "$(MSG_EXECUTING) '$(CMD)':\n"
- @$(SILENT) || printf "$(MSG_EXTENDED_LISTING) $@" | $(AWK_CMD)
- @$(BUILD_CMD)
-
-# Create a symbol table from ELF output file.
-%.sym: %.elf
- $(eval CMD=$(NM) -n $< > $@ )
- #@$(SILENT) || printf "$(MSG_EXECUTING) '$(CMD)':\n"
- @$(SILENT) || printf "$(MSG_SYMBOL_TABLE) $@" | $(AWK_CMD)
- @$(BUILD_CMD)
-
-%.bin: %.elf
- $(eval CMD=$(BIN) $< $@ || exit 0)
- #@$(SILENT) || printf "$(MSG_EXECUTING) '$(CMD)':\n"
- @$(SILENT) || printf "$(MSG_BIN) $@" | $(AWK_CMD)
- @$(BUILD_CMD)
- if [ ! -z "$(DFU_SUFFIX_ARGS)" ]; then \
- $(DFU_SUFFIX) $(DFU_SUFFIX_ARGS) -a $(BUILD_DIR)/$(TARGET).bin 1>/dev/null ;\
- fi
- #$(SILENT) || printf "$(MSG_EXECUTING) '$(DFU_SUFFIX) $(DFU_SUFFIX_ARGS) -a $(BUILD_DIR)/$(TARGET).bin 1>/dev/null':\n" ;\
- $(COPY) $(BUILD_DIR)/$(TARGET).bin $(TARGET).bin;
-
-BEGIN = gccversion sizebefore
-
-# Link: create ELF output file from object files.
-.SECONDARY : $(BUILD_DIR)/$(TARGET).elf
-.PRECIOUS : $(OBJ)
-# Note the obj.txt depeendency is there to force linking if a source file is deleted
-%.elf: $(OBJ) $(MASTER_OUTPUT)/cflags.txt $(MASTER_OUTPUT)/ldflags.txt $(MASTER_OUTPUT)/obj.txt | $(BEGIN)
- @$(SILENT) || printf "$(MSG_LINKING) $@" | $(AWK_CMD)
- $(eval CMD=MAKE=$(MAKE) $(CC) $(ALL_CFLAGS) $(filter-out %.txt,$^) --output $@ $(LDFLAGS))
- @$(BUILD_CMD)
-
-
-define GEN_OBJRULE
-$1_INCFLAGS := $$(patsubst %,-I%,$$($1_INC))
-ifdef $1_CONFIG
-$1_CONFIG_FLAGS += $$(patsubst %,-include %,$$($1_CONFIG))
-endif
-$1_CFLAGS = $$(ALL_CFLAGS) $$($1_DEFS) $$($1_INCFLAGS) $$($1_CONFIG_FLAGS) $$(NOLTO_CFLAGS)
-$1_CXXFLAGS = $$(ALL_CXXFLAGS) $$($1_DEFS) $$($1_INCFLAGS) $$($1_CONFIG_FLAGS) $$(NOLTO_CFLAGS)
-$1_ASFLAGS = $$(ALL_ASFLAGS) $$($1_DEFS) $$($1_INCFLAGS) $$($1_CONFIG_FLAGS)
-
-# Compile: create object files from C source files.
-$1/%.o : %.c $1/%.d $1/cflags.txt $1/compiler.txt | $(BEGIN)
- @mkdir -p $$(@D)
- @$$(SILENT) || printf "$$(MSG_COMPILING) $$<" | $$(AWK_CMD)
- $$(eval CC_EXEC := $$(CC))
- ifneq ($$(VERBOSE_C_CMD),)
- $$(if $$(filter $$(notdir $$(VERBOSE_C_CMD)),$$(notdir $$<)),$$(eval CC_EXEC += -v))
- endif
- ifneq ($$(VERBOSE_C_INCLUDE),)
- $$(if $$(filter $$(notdir $$(VERBOSE_C_INCLUDE)),$$(notdir $$<)),$$(eval CC_EXEC += -H))
- endif
- $$(eval CMD := $$(CC_EXEC) -c $$($1_CFLAGS) $$(INIT_HOOK_CFLAGS) $$(GENDEPFLAGS) $$< -o $$@ && $$(MOVE_DEP))
- @$$(BUILD_CMD)
- ifneq ($$(DUMP_C_MACROS),)
- $$(eval CMD := $$(CC) -E -dM $$($1_CFLAGS) $$(INIT_HOOK_CFLAGS) $$(GENDEPFLAGS) $$<)
- @$$(if $$(filter $$(notdir $$(DUMP_C_MACROS)),$$(notdir $$<)),$$(BUILD_CMD))
- endif
-
-# Compile: create object files from C++ source files.
-$1/%.o : %.cpp $1/%.d $1/cxxflags.txt $1/compiler.txt | $(BEGIN)
- @mkdir -p $$(@D)
- @$$(SILENT) || printf "$$(MSG_COMPILING_CXX) $$<" | $$(AWK_CMD)
- $$(eval CMD=$$(CC) -c $$($1_CXXFLAGS) $$(INIT_HOOK_CFLAGS) $$(GENDEPFLAGS) $$< -o $$@ && $$(MOVE_DEP))
- @$$(BUILD_CMD)
-
-$1/%.o : %.cc $1/%.d $1/cxxflags.txt $1/compiler.txt | $(BEGIN)
- @mkdir -p $$(@D)
- @$$(SILENT) || printf "$$(MSG_COMPILING_CXX) $$<" | $$(AWK_CMD)
- $$(eval CMD=$$(CC) -c $$($1_CXXFLAGS) $$(INIT_HOOK_CFLAGS) $$(GENDEPFLAGS) $$< -o $$@ && $$(MOVE_DEP))
- @$$(BUILD_CMD)
-
-# Assemble: create object files from assembler source files.
-$1/%.o : %.S $1/asflags.txt $1/compiler.txt | $(BEGIN)
- @mkdir -p $$(@D)
- @$(SILENT) || printf "$$(MSG_ASSEMBLING) $$<" | $$(AWK_CMD)
- $$(eval CMD=$$(CC) -c $$($1_ASFLAGS) $$< -o $$@)
- @$$(BUILD_CMD)
-
-$1/%.a : $1/%.o
- @mkdir -p $$(@D)
- @$(SILENT) || printf "Archiving: $$<" | $$(AWK_CMD)
- $$(eval CMD=$$(AR) rcs $$@ $$<)
- @$$(BUILD_CMD)
-
-$1/force:
-
-$1/cflags.txt: $1/force
- echo '$$($1_CFLAGS)' | cmp -s - $$@ || echo '$$($1_CFLAGS)' > $$@
-
-$1/cxxflags.txt: $1/force
- echo '$$($1_CXXFLAGS)' | cmp -s - $$@ || echo '$$($1_CXXFLAGS)' > $$@
-
-$1/asflags.txt: $1/force
- echo '$$($1_ASFLAGS)' | cmp -s - $$@ || echo '$$($1_ASFLAGS)' > $$@
-
-$1/compiler.txt: $1/force
- $$(CC) --version | cmp -s - $$@ || $$(CC) --version > $$@
-endef
-
-.PRECIOUS: $(MASTER_OUTPUT)/obj.txt
-$(MASTER_OUTPUT)/obj.txt: $(MASTER_OUTPUT)/force
- echo '$(OBJ)' | cmp -s - $@ || echo '$(OBJ)' > $@
-
-.PRECIOUS: $(MASTER_OUTPUT)/ldflags.txt
-$(MASTER_OUTPUT)/ldflags.txt: $(MASTER_OUTPUT)/force
- echo '$(LDFLAGS)' | cmp -s - $@ || echo '$(LDFLAGS)' > $@
-
-
-# We have to use static rules for the .d files for some reason
-DEPS = $(patsubst %.o,%.d,$(patsubst %.a,%.o,$(OBJ)))
-# Keep the .d files
-.PRECIOUS: $(DEPS)
-# Empty rule to force recompilation if the .d file is missing
-$(DEPS):
-
-
-$(foreach OUTPUT,$(OUTPUTS),$(eval $(call GEN_OBJRULE,$(OUTPUT))))
-
-# Create preprocessed source for use in sending a bug report.
-%.i : %.c | $(BEGIN)
- $(CC) -E -mmcu=$(MCU) $(CFLAGS) $< -o $@
-
-# Target: clean project.
-clean:
- $(foreach OUTPUT,$(OUTPUTS), $(REMOVE) -r $(OUTPUT) 2>/dev/null)
- $(REMOVE) $(BUILD_DIR)/$(TARGET).*
-
-show_path:
- @echo VPATH=$(VPATH)
- @echo SRC=$(SRC)
- @echo OBJ=$(OBJ)
-
-dump_vars: ERROR_IF_EMPTY=""
-dump_vars: ERROR_IF_NONBOOL=""
-dump_vars: ERROR_IF_UNSET=""
-dump_vars:
- @$(foreach V,$(sort $(.VARIABLES)),$(if $(filter-out environment% default automatic,$(origin $V)),$(info $V=$($V))))
-
-objs-size:
- for i in $(OBJ); do echo $$i; done | sort | xargs $(SIZE)
-
-ifeq ($(findstring avr-gcc,$(CC)),avr-gcc)
-SIZE_MARGIN = 1024
-
-check-size:
- $(eval MAX_SIZE=$(shell n=`$(CC) -E -mmcu=$(MCU) -D__ASSEMBLER__ $(CFLAGS) $(OPT_DEFS) platforms/avr/bootloader_size.c 2> /dev/null | $(SED) -ne 's/\r//;/^#/n;/^AVR_SIZE:/,$${s/^AVR_SIZE: //;p;}'` && echo $$(($$n)) || echo 0))
- $(eval CURRENT_SIZE=$(shell if [ -f $(BUILD_DIR)/$(TARGET).hex ]; then $(SIZE) --target=$(FORMAT) $(BUILD_DIR)/$(TARGET).hex | $(AWK) 'NR==2 {print $$4}'; else printf 0; fi))
- $(eval FREE_SIZE=$(shell expr $(MAX_SIZE) - $(CURRENT_SIZE)))
- $(eval OVER_SIZE=$(shell expr $(CURRENT_SIZE) - $(MAX_SIZE)))
- $(eval PERCENT_SIZE=$(shell expr $(CURRENT_SIZE) \* 100 / $(MAX_SIZE)))
- if [ $(MAX_SIZE) -gt 0 ] && [ $(CURRENT_SIZE) -gt 0 ]; then \
- $(SILENT) || printf "$(MSG_CHECK_FILESIZE)" | $(AWK_CMD); \
- if [ $(CURRENT_SIZE) -gt $(MAX_SIZE) ]; then \
- printf "\n * $(MSG_FILE_TOO_BIG)"; $(PRINT_ERROR_PLAIN); \
- else \
- if [ $(FREE_SIZE) -lt $(SIZE_MARGIN) ]; then \
- $(PRINT_WARNING_PLAIN); printf " * $(MSG_FILE_NEAR_LIMIT)"; \
- else \
- $(PRINT_OK); $(SILENT) || printf " * $(MSG_FILE_JUST_RIGHT)"; \
- fi ; \
- fi ; \
- fi
-else
-check-size:
- $(SILENT) || echo "$(MSG_CHECK_FILESIZE_SKIPPED)"
-endif
-
-check-md5:
- $(MD5SUM) $(BUILD_DIR)/$(TARGET).$(FIRMWARE_FORMAT)
-
-# Create build directory
-$(shell mkdir -p $(BUILD_DIR) 2>/dev/null)
-
-# Create object files directory
-$(eval $(foreach OUTPUT,$(OUTPUTS),$(shell mkdir -p $(OUTPUT) 2>/dev/null)))
-
-# Include the dependency files.
--include $(patsubst %.o,%.d,$(patsubst %.a,%.o,$(OBJ)))
-
-
-# Listing of phony targets.
-.PHONY : all dump_vars finish sizebefore sizeafter qmkversion \
-gccversion build elf hex uf2 eep lss sym coff extcoff \
-clean clean_list debug gdb-config show_path \
-program teensy dfu dfu-ee dfu-start \
-flash dfu-split-left dfu-split-right \
-avrdude-split-left avrdude-split-right \
-avrdude-loop usbasp
--
cgit v1.2.3
From 23c238a1807c3e8c3bdd4eb432506a1469640df5 Mon Sep 17 00:00:00 2001
From: Erovia
Date: Mon, 14 Feb 2022 11:02:35 +0000
Subject: CLI: Minor additions #12795 (#16276)
---
lib/python/qmk/cli/new/keyboard.py | 89 ++++++++++++++++----------------------
lib/python/qmk/constants.py | 39 +++++++++++++++++
2 files changed, 76 insertions(+), 52 deletions(-)
(limited to 'lib/python/qmk/cli')
diff --git a/lib/python/qmk/cli/new/keyboard.py b/lib/python/qmk/cli/new/keyboard.py
index 59e781a932..8596994d38 100644
--- a/lib/python/qmk/cli/new/keyboard.py
+++ b/lib/python/qmk/cli/new/keyboard.py
@@ -15,48 +15,11 @@ from qmk.json_schema import load_jsonschema
from qmk.path import keyboard
from qmk.json_encoders import InfoJSONEncoder
from qmk.json_schema import deep_update
+from qmk.constants import MCU2BOOTLOADER
COMMUNITY = Path('layouts/default/')
TEMPLATE = Path('data/templates/keyboard/')
-MCU2BOOTLOADER = {
- "MKL26Z64": "halfkay",
- "MK20DX128": "halfkay",
- "MK20DX256": "halfkay",
- "MK66FX1M0": "halfkay",
- "STM32F042": "stm32-dfu",
- "STM32F072": "stm32-dfu",
- "STM32F103": "stm32duino",
- "STM32F303": "stm32-dfu",
- "STM32F401": "stm32-dfu",
- "STM32F405": "stm32-dfu",
- "STM32F407": "stm32-dfu",
- "STM32F411": "stm32-dfu",
- "STM32F446": "stm32-dfu",
- "STM32G431": "stm32-dfu",
- "STM32G474": "stm32-dfu",
- "STM32L412": "stm32-dfu",
- "STM32L422": "stm32-dfu",
- "STM32L432": "stm32-dfu",
- "STM32L433": "stm32-dfu",
- "STM32L442": "stm32-dfu",
- "STM32L443": "stm32-dfu",
- "GD32VF103": "gd32v-dfu",
- "WB32F3G71": "wb32-dfu",
- "atmega16u2": "atmel-dfu",
- "atmega32u2": "atmel-dfu",
- "atmega16u4": "atmel-dfu",
- "atmega32u4": "atmel-dfu",
- "at90usb162": "atmel-dfu",
- "at90usb646": "atmel-dfu",
- "at90usb647": "atmel-dfu",
- "at90usb1286": "atmel-dfu",
- "at90usb1287": "atmel-dfu",
- "atmega32a": "bootloadhid",
- "atmega328p": "usbasploader",
- "atmega328": "usbasploader",
-}
-
# defaults
schema = dotty(load_jsonschema('keyboard'))
mcu_types = sorted(schema["properties.processor.enum"], key=str.casefold)
@@ -141,20 +104,42 @@ def augment_community_info(src, dest):
dest.write_text(json.dumps(info, cls=InfoJSONEncoder))
+def _question(*args, **kwargs):
+ """Ugly workaround until 'milc' learns to display a repromt msg
+ """
+ # TODO: Remove this once milc.questions.question handles reprompt messages
+
+ reprompt = kwargs["reprompt"]
+ del kwargs["reprompt"]
+ validate = kwargs["validate"]
+ del kwargs["validate"]
+
+ prompt = args[0]
+ ret = None
+ while not ret:
+ ret = question(prompt, **kwargs)
+ if not validate(ret):
+ ret = None
+ prompt = reprompt
+
+ return ret
+
+
def prompt_keyboard():
prompt = """{fg_yellow}Name Your Keyboard Project{style_reset_all}
-
For more infomation, see:
https://docs.qmk.fm/#/hardware_keyboard_guidelines?id=naming-your-keyboardproject
-keyboard Name? """
+Keyboard Name? """
- return question(prompt, validate=lambda x: not keyboard(x).exists())
+ errmsg = 'Keyboard already exists! Please choose a different name:'
+ return _question(prompt, reprompt=errmsg, validate=lambda x: not keyboard(x).exists())
-def prompt_user():
- prompt = """{fg_yellow}Attribution{style_reset_all}
+def prompt_user():
+ prompt = """
+{fg_yellow}Attribution{style_reset_all}
Used for maintainer, copyright, etc
Your GitHub Username? """
@@ -162,8 +147,8 @@ Your GitHub Username? """
def prompt_name(def_name):
- prompt = """{fg_yellow}More Attribution{style_reset_all}
-
+ prompt = """
+{fg_yellow}More Attribution{style_reset_all}
Used for maintainer, copyright, etc
Your Real Name? """
@@ -171,8 +156,8 @@ Your Real Name? """
def prompt_layout():
- prompt = """{fg_yellow}Pick Base Layout{style_reset_all}
-
+ prompt = """
+{fg_yellow}Pick Base Layout{style_reset_all}
As a starting point, one of the common layouts can be used to bootstrap the process
Default Layout? """
@@ -184,8 +169,8 @@ Default Layout? """
def prompt_mcu():
- prompt = """{fg_yellow}What Powers Your Project{style_reset_all}
-
+ prompt = """
+{fg_yellow}What Powers Your Project{style_reset_all}
For more infomation, see:
https://docs.qmk.fm/#/compatible_microcontrollers
@@ -199,7 +184,7 @@ MCU? """
@cli.argument('-kb', '--keyboard', help='Specify the name for the new keyboard directory', arg_only=True, type=keyboard_name)
@cli.argument('-l', '--layout', help='Community layout to bootstrap with', arg_only=True, type=layout_type)
@cli.argument('-t', '--type', help='Specify the keyboard MCU type', arg_only=True, type=mcu_type)
-@cli.argument('-u', '--username', help='Specify your username (default from Git config)', arg_only=True)
+@cli.argument('-u', '--username', help='Specify your username (default from Git config)', dest='name')
@cli.argument('-n', '--realname', help='Specify your real name if you want to use that. Defaults to username', arg_only=True)
@cli.subcommand('Creates a new keyboard directory')
def new_keyboard(cli):
@@ -209,8 +194,8 @@ def new_keyboard(cli):
cli.echo('')
kb_name = cli.args.keyboard if cli.args.keyboard else prompt_keyboard()
- user_name = cli.args.username if cli.args.username else prompt_user()
- real_name = cli.args.realname or cli.args.username if cli.args.realname or cli.args.username else prompt_name(user_name)
+ user_name = cli.config.new_keyboard.name if cli.config.new_keyboard.name else prompt_user()
+ real_name = cli.args.realname or cli.config.new_keyboard.name if cli.args.realname or cli.config.new_keyboard.name else prompt_name(user_name)
default_layout = cli.args.layout if cli.args.layout else prompt_layout()
mcu = cli.args.type if cli.args.type else prompt_mcu()
bootloader = select_default_bootloader(mcu)
diff --git a/lib/python/qmk/constants.py b/lib/python/qmk/constants.py
index 00e453189f..e4b699cdb1 100644
--- a/lib/python/qmk/constants.py
+++ b/lib/python/qmk/constants.py
@@ -17,6 +17,45 @@ CHIBIOS_PROCESSORS = 'cortex-m0', 'cortex-m0plus', 'cortex-m3', 'cortex-m4', 'MK
LUFA_PROCESSORS = 'at90usb162', 'atmega16u2', 'atmega32u2', 'atmega16u4', 'atmega32u4', 'at90usb646', 'at90usb647', 'at90usb1286', 'at90usb1287', None
VUSB_PROCESSORS = 'atmega32a', 'atmega328p', 'atmega328', 'attiny85'
+# Bootloaders of the supported processors
+MCU2BOOTLOADER = {
+ "MKL26Z64": "halfkay",
+ "MK20DX128": "halfkay",
+ "MK20DX256": "halfkay",
+ "MK66FX1M0": "halfkay",
+ "STM32F042": "stm32-dfu",
+ "STM32F072": "stm32-dfu",
+ "STM32F103": "stm32duino",
+ "STM32F303": "stm32-dfu",
+ "STM32F401": "stm32-dfu",
+ "STM32F405": "stm32-dfu",
+ "STM32F407": "stm32-dfu",
+ "STM32F411": "stm32-dfu",
+ "STM32F446": "stm32-dfu",
+ "STM32G431": "stm32-dfu",
+ "STM32G474": "stm32-dfu",
+ "STM32L412": "stm32-dfu",
+ "STM32L422": "stm32-dfu",
+ "STM32L432": "stm32-dfu",
+ "STM32L433": "stm32-dfu",
+ "STM32L442": "stm32-dfu",
+ "STM32L443": "stm32-dfu",
+ "GD32VF103": "gd32v-dfu",
+ "WB32F3G71": "wb32-dfu",
+ "atmega16u2": "atmel-dfu",
+ "atmega32u2": "atmel-dfu",
+ "atmega16u4": "atmel-dfu",
+ "atmega32u4": "atmel-dfu",
+ "at90usb162": "atmel-dfu",
+ "at90usb646": "atmel-dfu",
+ "at90usb647": "atmel-dfu",
+ "at90usb1286": "atmel-dfu",
+ "at90usb1287": "atmel-dfu",
+ "atmega32a": "bootloadhid",
+ "atmega328p": "usbasploader",
+ "atmega328": "usbasploader",
+}
+
# Common format strings
DATE_FORMAT = '%Y-%m-%d'
DATETIME_FORMAT = '%Y-%m-%d %H:%M:%S %Z'
--
cgit v1.2.3
From b0621223bc53f634a28243b874379e8e157878fd Mon Sep 17 00:00:00 2001
From: Joel Challis
Date: Tue, 15 Feb 2022 01:42:58 +0000
Subject: Various fixes for new-keyboard (#16358)
---
data/templates/keyboard/config.h | 20 ++++++++++++++++++++
data/templates/keyboard/info.json | 1 +
lib/python/qmk/cli/new/keyboard.py | 10 +++++++++-
lib/python/qmk/info.py | 1 +
4 files changed, 31 insertions(+), 1 deletion(-)
create mode 100644 data/templates/keyboard/config.h
(limited to 'lib/python/qmk/cli')
diff --git a/data/templates/keyboard/config.h b/data/templates/keyboard/config.h
new file mode 100644
index 0000000000..b15c8d31f1
--- /dev/null
+++ b/data/templates/keyboard/config.h
@@ -0,0 +1,20 @@
+// Copyright %YEAR% %REAL_NAME% (@%USER_NAME%)
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+/*
+ * Feature disable options
+ * These options are also useful to firmware size reduction.
+ */
+
+/* disable debug print */
+//#define NO_DEBUG
+
+/* disable print */
+//#define NO_PRINT
+
+/* disable action features */
+//#define NO_ACTION_LAYER
+//#define NO_ACTION_TAPPING
+//#define NO_ACTION_ONESHOT
diff --git a/data/templates/keyboard/info.json b/data/templates/keyboard/info.json
index 92718faf3a..41bc691313 100644
--- a/data/templates/keyboard/info.json
+++ b/data/templates/keyboard/info.json
@@ -1,6 +1,7 @@
{
"keyboard_name": "%KEYBOARD%",
"maintainer": "%USER_NAME%",
+ "manufacturer": "%REAL_NAME%",
"processor": "%MCU%",
"bootloader": "%BOOTLOADER%",
"diode_direction": "COL2ROW",
diff --git a/lib/python/qmk/cli/new/keyboard.py b/lib/python/qmk/cli/new/keyboard.py
index 8596994d38..6fa9ad5b2c 100644
--- a/lib/python/qmk/cli/new/keyboard.py
+++ b/lib/python/qmk/cli/new/keyboard.py
@@ -208,7 +208,15 @@ def new_keyboard(cli):
cli.log.error(f'Keyboard {{fg_cyan}}{kb_name}{{fg_reset}} already exists! Please choose a different name.')
return 1
- tokens = {'YEAR': str(date.today().year), 'KEYBOARD': kb_name, 'USER_NAME': user_name, 'REAL_NAME': real_name, 'LAYOUT': default_layout, 'MCU': mcu, 'BOOTLOADER': bootloader}
+ tokens = { # Comment here is to force multiline formatting
+ 'YEAR': str(date.today().year),
+ 'KEYBOARD': kb_name,
+ 'USER_NAME': user_name,
+ 'REAL_NAME': real_name,
+ 'LAYOUT': default_layout,
+ 'MCU': mcu,
+ 'BOOTLOADER': bootloader
+ }
if cli.config.general.verbose:
cli.log.info("Creating keyboard with:")
diff --git a/lib/python/qmk/info.py b/lib/python/qmk/info.py
index 905f10ecc2..7e6f531f9c 100644
--- a/lib/python/qmk/info.py
+++ b/lib/python/qmk/info.py
@@ -49,6 +49,7 @@ def info_json(keyboard):
'parse_errors': [],
'parse_warnings': [],
'maintainer': 'qmk',
+ 'manufacturer': 'qmk',
}
# Populate the list of JSON keymaps
--
cgit v1.2.3
From cf31355f08dca311a013168eb3eb995e2fc6a3d1 Mon Sep 17 00:00:00 2001
From: Joel Challis
Date: Wed, 23 Feb 2022 17:33:08 +0000
Subject: Changelog 2022q1 (#16380)
* Initial changelog pass
* update generate-develop-pr-list content
* Fix bad word-ness
* Fix generate-develop-pr-list ignores
* Update docs/ChangeLog/20220226.md
Co-authored-by: Sergey Vlasov
Co-authored-by: Sergey Vlasov ---
docs/ChangeLog/20220226.md | 489 +++++++++++++++++++++++++
docs/ChangeLog/20220226/PR15304.md | 13 -
docs/_summary.md | 2 +-
docs/breaking_changes.md | 17 +-
docs/breaking_changes_history.md | 1 +
lib/python/qmk/cli/generate/develop_pr_list.py | 3 +-
6 files changed, 502 insertions(+), 23 deletions(-)
create mode 100644 docs/ChangeLog/20220226.md
delete mode 100644 docs/ChangeLog/20220226/PR15304.md
(limited to 'lib/python/qmk/cli')
diff --git a/docs/ChangeLog/20220226.md b/docs/ChangeLog/20220226.md
new file mode 100644
index 0000000000..a469612fe8
--- /dev/null
+++ b/docs/ChangeLog/20220226.md
@@ -0,0 +1,489 @@
+# QMK Breaking Changes - 2022 February 26 Changelog
+
+## Notable Features :id=notable-features
+
+### Default USB Polling rate now 1kHz ([#15352](https://github.com/qmk/qmk_firmware/pull/15352))
+
+The default USB Polling rate has been aligned across supported platforms to now be 1ms/1kHz.
+
+Something something *Lets go gamers!*
+
+### Split support for pointing devices ([#15304](https://github.com/qmk/qmk_firmware/pull/15304))
+
+Pointing devices can now be shared across a split keyboard with support for a single pointing device or a pointing device on each side.
+
+See the [Pointing Device](feature_pointing_device.md) documentation for further configuration options.
+
+## Changes Requiring User Action :id=changes-requiring-user-action
+
+### Legacy macro and action_function system removed ([#16025](https://github.com/qmk/qmk_firmware/pull/16025))
+
+The long time deprecated `MACRO()` and `action_get_macro` methods have been removed. Where possible, existing usages have been migrated over to core [Macros](feature_macros.md).
+
+### Create a build error if no bootloader is specified ([#16181](https://github.com/qmk/qmk_firmware/pull/16181))
+
+Bootloader configuration is no longer assumed. Keyboards must now set either:
+
+* `BOOTLOADER` within `rules.mk`
+* `bootloader` within `info.json`
+
+### Rename `AdafruitBLE` to `BluefruitLE` ([#16127](https://github.com/qmk/qmk_firmware/pull/16127))
+
+In preparation of future bluetooth work, the `AdafruitBLE` integration has been renamed to allow potential for any other Adafruit BLE products.
+
+### Updated Keyboard Codebases :id=updated-keyboard-codebases
+
+The following keyboards have had their source moved within QMK:
+
+| Old Keyboard Name | New Keyboard Name |
+|----------------------------|------------------------------------|
+| 6ball | maple_computing/6ball |
+| 7skb | salicylic_acid3/7skb |
+| 7splus | salicylic_acid3/7splus |
+| acr60 | mechkeys/acr60 |
+| adalyn | tominabox1/adalyn |
+| ajisai74 | salicylic_acid3/ajisai74 |
+| aleth42 | 25keys/aleth42 |
+| alicia_cook | ibnuda/alicia_cook |
+| allison_numpad | prototypist/allison_numpad |
+| allison | prototypist/allison |
+| alu84 | mechkeys/alu84 |
+| angel17 | kakunpc/angel17 |
+| angel64/alpha | kakunpc/angel64/alpha |
+| angel64/rev1 | kakunpc/angel64/rev1 |
+| arch_36 | obosob/arch_36 |
+| bakeneko60 | kkatano/bakeneko60 |
+| bakeneko65/rev2 | kkatano/bakeneko65/rev2 |
+| bakeneko65/rev3 | kkatano/bakeneko65/rev3 |
+| bakeneko80 | kkatano/bakeneko80 |
+| barleycorn | yiancardesigns/barleycorn |
+| bat43/rev1 | dailycraft/bat43/rev1 |
+| bat43/rev2 | dailycraft/bat43/rev2 |
+| bigseries/1key | woodkeys/bigseries/1key |
+| bigseries/2key | woodkeys/bigseries/2key |
+| bigseries/3key | woodkeys/bigseries/3key |
+| bigseries/4key | woodkeys/bigseries/4key |
+| bkf | drhigsby/bkf |
+| business_card/alpha | kakunpc/business_card/alpha |
+| business_card/beta | kakunpc/business_card/beta |
+| butterstick | gboards/butterstick |
+| c39 | maple_computing/c39 |
+| cassette42 | 25keys/cassette42 |
+| chidori | kagizaraya/chidori |
+| chili | ydkb/chili |
+| chimera_ergo | glenpickle/chimera_ergo |
+| chimera_ls | glenpickle/chimera_ls |
+| chimera_ortho | glenpickle/chimera_ortho |
+| chimera_ortho_plus | glenpickle/chimera_ortho_plus |
+| choco60 | recompile_keys/choco60 |
+| choc_taro | kakunpc/choc_taro |
+| christmas_tree | maple_computing/christmas_tree |
+| claw44/rev1 | dailycraft/claw44/rev1 |
+| cocoa40 | recompile_keys/cocoa40 |
+| comet46 | satt/comet46 |
+| cu24 | capsunlocked/cu24 |
+| cu75 | capsunlocked/cu75 |
+| cu80 | capsunlocked/cu80/v1 |
+| delilah | rainkeebs/delilah |
+| diverge3 | unikeyboard/diverge3 |
+| divergetm2 | unikeyboard/divergetm2 |
+| dozen0 | yynmt/dozen0 |
+| dubba175 | drhigsby/dubba175 |
+| eggman | qpockets/eggman |
+| ergo42 | biacco42/ergo42 |
+| ergoarrows | salicylic_acid3/ergoarrows |
+| ergodash/mini | omkbd/ergodash/mini |
+| ergodash/rev1 | omkbd/ergodash/rev1 |
+| ergodox_infinity | input_club/ergodox_infinity |
+| ergotaco | gboards/ergotaco |
+| espectro | mechkeys/espectro |
+| felix | unikeyboard/felix |
+| four_banger | bpiphany/four_banger |
+| freyr | hnahkb/freyr |
+| geminate60 | weirdo/geminate60 |
+| georgi | gboards/georgi |
+| gergo | gboards/gergo |
+| getta25 | salicylic_acid3/getta25 |
+| gingham | yiancardesigns/gingham |
+| gurindam | ibnuda/gurindam |
+| halberd | kagizaraya/halberd |
+| hecomi/alpha | takashiski/hecomi/alpha |
+| hid_liber | bpiphany/hid_liber |
+| id67/default_rgb | idobao/id67/default_rgb |
+| id67/rgb | idobao/id67/rgb |
+| id80 | idobao/id80/v1 |
+| id87 | idobao/id87/v1 |
+| idobo | idobao/id75/v1 |
+| infinity60 | input_club/infinity60 |
+| ivy/rev1 | maple_computing/ivy/rev1 |
+| jisplit89 | salicylic_acid3/jisplit89 |
+| jnao | maple_computing/jnao |
+| just60 | ydkb/just60 |
+| kagamidget | yynmt/kagamidget |
+| kelowna/rgb64 | weirdo/kelowna/rgb64 |
+| kprepublic/bm65hsrgb_iso | kprepublic/bm65hsrgb_iso/rev1 |
+| kprepublic/bm68hsrgb | kprepublic/bm68hsrgb/rev1 |
+| k_type | input_club/k_type |
+| latin17rgb | latincompass/latin17rgb |
+| latin47ble | latincompass/latin47ble |
+| latin60rgb | latincompass/latin60rgb |
+| latin64ble | latincompass/latin64ble |
+| latin6rgb | latincompass/latin6rgb |
+| latinpadble | latincompass/latinpadble |
+| latinpad | latincompass/latinpad |
+| launchpad/rev1 | maple_computing/launchpad/rev1 |
+| lck75 | lyso1/lck75 |
+| le_chiffre | tominabox1/le_chiffre |
+| lefishe | lyso1/lefishe |
+| lets_split_eh/eh | maple_computing/lets_split_eh/eh |
+| ls_60 | weirdo/ls_60 |
+| m3n3van | matthewdias/m3n3van |
+| mechmini/v1 | mechkeys/mechmini/v1 |
+| mechmini/v2 | mechkeys/mechmini/v2 |
+| meira | woodkeys/meira |
+| meishi2 | biacco42/meishi2 |
+| meishi | biacco42/meishi |
+| minidox/rev1 | maple_computing/minidox/rev1 |
+| minim | matthewdias/minim |
+| mio | recompile_keys/mio |
+| model_v | matthewdias/model_v |
+| montex | idobao/montex/v1 |
+| nafuda | salicylic_acid3/nafuda |
+| naiping/np64 | weirdo/naiping/np64 |
+| naiping/nphhkb | weirdo/naiping/nphhkb |
+| naiping/npminila | weirdo/naiping/npminila |
+| naked48 | salicylic_acid3/naked48 |
+| naked60 | salicylic_acid3/naked60 |
+| naked64 | salicylic_acid3/naked64 |
+| namecard2x4 | takashiski/namecard2x4 |
+| nebula12 | spaceholdings/nebula12 |
+| nebula68b | spaceholdings/nebula68b |
+| nebula68 | spaceholdings/nebula68 |
+| niu_mini | kbdfans/niu_mini |
+| nk1 | novelkeys/nk1 |
+| nk65 | novelkeys/nk65 |
+| nk87 | novelkeys/nk87 |
+| nknl7en | salicylic_acid3/nknl7en |
+| nknl7jp | salicylic_acid3/nknl7jp |
+| nomu30 | recompile_keys/nomu30 |
+| novelpad | novelkeys/novelpad |
+| ogurec | drhigsby/ogurec |
+| otaku_split/rev0 | takashiski/otaku_split/rev0 |
+| otaku_split/rev1 | takashiski/otaku_split/rev1 |
+| owl8 | dailycraft/owl8 |
+| packrat | drhigsby/packrat |
+| pistachio_mp | rate/pistachio_mp |
+| pistachio_pro | rate/pistachio_pro |
+| pistachio | rate/pistachio |
+| plexus75 | checkerboards/plexus75 |
+| pursuit40 | checkerboards/pursuit40 |
+| qaz | tominabox1/qaz |
+| quark | checkerboards/quark |
+| rabbit_capture_plan | kakunpc/rabbit_capture_plan |
+| rainkeeb | rainkeebs/rainkeeb |
+| reviung33 | reviung/reviung33 |
+| reviung34 | reviung/reviung34 |
+| reviung39 | reviung/reviung39 |
+| reviung41 | reviung/reviung41 |
+| reviung53 | reviung/reviung53 |
+| reviung5 | reviung/reviung5 |
+| reviung61 | reviung/reviung61 |
+| runner3680/3x6 | omkbd/runner3680/3x6 |
+| runner3680/3x7 | omkbd/runner3680/3x7 |
+| runner3680/3x8 | omkbd/runner3680/3x8 |
+| runner3680/4x6 | omkbd/runner3680/4x6 |
+| runner3680/4x7 | omkbd/runner3680/4x7 |
+| runner3680/4x8 | omkbd/runner3680/4x8 |
+| runner3680/5x6_5x8 | omkbd/runner3680/5x6_5x8 |
+| runner3680/5x6 | omkbd/runner3680/5x6 |
+| runner3680/5x7 | omkbd/runner3680/5x7 |
+| runner3680/5x8 | omkbd/runner3680/5x8 |
+| scarletbandana | woodkeys/scarletbandana |
+| scythe | kagizaraya/scythe |
+| seigaiha | yiancardesigns/seigaiha |
+| setta21 | salicylic_acid3/setta21 |
+| space_space/rev1 | qpockets/space_space/rev1 |
+| space_space/rev2 | qpockets/space_space/rev2 |
+| spiderisland/winry25tc | winry/winry25tc |
+| splitreus62 | nacly/splitreus62 |
+| squiggle/rev1 | ibnuda/squiggle/rev1 |
+| standaside | edi/standaside |
+| steal_this_keyboard | obosob/steal_this_keyboard |
+| stella | hnahkb/stella |
+| suihankey/alpha | kakunpc/suihankey/alpha |
+| suihankey/rev1 | kakunpc/suihankey/rev1 |
+| suihankey/split | kakunpc/suihankey/split |
+| thedogkeyboard | kakunpc/thedogkeyboard |
+| the_ruler | maple_computing/the_ruler |
+| tiger910 | weirdo/tiger910 |
+| treadstone32 | marksard/treadstone32 |
+| treadstone48/rev1 | marksard/treadstone48/rev1 |
+| treadstone48/rev2 | marksard/treadstone48/rev2 |
+| txuu | matthewdias/txuu |
+| ua62 | nacly/ua62 |
+| underscore33/rev1 | tominabox1/underscore33/rev1 |
+| underscore33/rev2 | tominabox1/underscore33/rev2 |
+| vn66 | hnahkb/vn66 |
+| wallaby | kkatano/wallaby |
+| wanten | qpockets/wanten |
+| whitefox | input_club/whitefox |
+| wings42/rev1 | dailycraft/wings42/rev1 |
+| wings42/rev1_extkeys | dailycraft/wings42/rev1_extkeys |
+| wings42/rev2 | dailycraft/wings42/rev2 |
+| yasui | rainkeebs/yasui |
+| yd60mq | ymdk/yd60mq |
+| yd68 | ydkb/yd68 |
+| ymd75 | ymdk/ymd75 |
+| ymd96 | ymdk/ymd96 |
+| ymdk_np21 | ymdk/np21 |
+| yurei | kkatano/yurei |
+| zinc | 25keys/zinc |
+| zinc/rev1 | 25keys/zinc/rev1 |
+| zinc/reva | 25keys/zinc/reva |
+
+## Notable core changes :id=notable-core
+
+### New MCU Support :id=new-mcu-support
+
+Building on previous cycles, QMK firmware picked up support for a couple extra MCU variants:
+
+* STM32L432
+* STM32L442
+
+### New Drivers
+
+QMK now has core-supplied support for the following device peripherals:
+
+#### LED
+
+* IS31FL3742A
+* IS31FL3743A
+* IS31FL3745
+* IS31FL3746A
+
+#### GPIO
+
+* SN74x138
+* mcp23018
+
+---
+
+## Full changelist
+
+Core:
+* Initial pass at data driven new-keyboard subcommand ([#12795](https://github.com/qmk/qmk_firmware/pull/12795))
+* Don't send keyboard reports that propagate no changes to the host ([#14065](https://github.com/qmk/qmk_firmware/pull/14065))
+* Custom matrix lite support for split keyboards ([#14674](https://github.com/qmk/qmk_firmware/pull/14674))
+* Add sym_defer_pr debouncer type ([#14948](https://github.com/qmk/qmk_firmware/pull/14948))
+* Add RGB matrix & LED Matrix support for IS31FL3742A, IS31FL3743A, IS31FL3745, IS31FL3746A ([#14989](https://github.com/qmk/qmk_firmware/pull/14989))
+* New combo configuration options ([#15083](https://github.com/qmk/qmk_firmware/pull/15083))
+* IS31FL3733 driver for LED Matrix ([#15088](https://github.com/qmk/qmk_firmware/pull/15088))
+* Add open-drain GPIO support. ([#15282](https://github.com/qmk/qmk_firmware/pull/15282))
+* Make (un)register code functions weak ([#15285](https://github.com/qmk/qmk_firmware/pull/15285))
+* Split support for pointing devices. ([#15304](https://github.com/qmk/qmk_firmware/pull/15304))
+* Added cancel_key_lock function ([#15321](https://github.com/qmk/qmk_firmware/pull/15321))
+* Remove matrix_is_modified() and debounce_is_active() ([#15349](https://github.com/qmk/qmk_firmware/pull/15349))
+* Change default USB Polling rate to 1kHz ([#15352](https://github.com/qmk/qmk_firmware/pull/15352))
+* Implement MAGIC_TOGGLE_CONTROL_CAPSLOCK ([#15368](https://github.com/qmk/qmk_firmware/pull/15368))
+* Tidy up existing i2c_master implementations ([#15376](https://github.com/qmk/qmk_firmware/pull/15376))
+* Generalize Unicode defines ([#15409](https://github.com/qmk/qmk_firmware/pull/15409))
+* Added external spi flash driver. ([#15419](https://github.com/qmk/qmk_firmware/pull/15419))
+* Remove Deprecated USB Polling comment from vusb.c ([#15420](https://github.com/qmk/qmk_firmware/pull/15420))
+* Expand rotational range for PMW3360 Optical Sensor ([#15431](https://github.com/qmk/qmk_firmware/pull/15431))
+* ChibiOS SVN mirror script update ([#15435](https://github.com/qmk/qmk_firmware/pull/15435))
+* Refactor `bootloader_jump()` implementations ([#15450](https://github.com/qmk/qmk_firmware/pull/15450))
+* added missing audio_off_user() callback ([#15457](https://github.com/qmk/qmk_firmware/pull/15457))
+* Migrate serial_uart usages to UART driver ([#15479](https://github.com/qmk/qmk_firmware/pull/15479))
+* Migrate RN42 to UART driver and refactor ([#15492](https://github.com/qmk/qmk_firmware/pull/15492))
+* pwm3360 driver cleanup and diff reduction to adns9800 ([#15559](https://github.com/qmk/qmk_firmware/pull/15559))
+* Advanced deferred_exec for core-side code. ([#15579](https://github.com/qmk/qmk_firmware/pull/15579))
+* Adjust tap_code16 to account for TAP_HOLD_CAPS_DELAY ([#15635](https://github.com/qmk/qmk_firmware/pull/15635))
+* Slight tidy up of keyboard task loop ([#15725](https://github.com/qmk/qmk_firmware/pull/15725))
+* Unify the key up/down behaviour of RGB keycodes ([#15730](https://github.com/qmk/qmk_firmware/pull/15730))
+* Add PMW3389 optical sensor Support (Updated) ([#15740](https://github.com/qmk/qmk_firmware/pull/15740))
+* ChibiOS: add support for HID Programmable Buttons ([#15787](https://github.com/qmk/qmk_firmware/pull/15787))
+* ChibiOS: shorten USB disconnect state on boot to 50ms ([#15805](https://github.com/qmk/qmk_firmware/pull/15805))
+* Add init function to clear previous matrix effect ([#15815](https://github.com/qmk/qmk_firmware/pull/15815))
+* Optimize initialization of PMW3360 Sensor ([#15821](https://github.com/qmk/qmk_firmware/pull/15821))
+* Add Pixel Flow RGB matrix effect ([#15829](https://github.com/qmk/qmk_firmware/pull/15829))
+* PMW3389 Revert Firmware load during Initilization ([#15859](https://github.com/qmk/qmk_firmware/pull/15859))
+* Combo `TAP_CODE_DELAY` and `clear_weak_mods` ([#15866](https://github.com/qmk/qmk_firmware/pull/15866))
+* Relocate matrix_scan_quantum tasks ([#15882](https://github.com/qmk/qmk_firmware/pull/15882))
+* Adjust mouse key defaults ([#15883](https://github.com/qmk/qmk_firmware/pull/15883))
+* RGB Matrix: Reload from EEPROM ([#15923](https://github.com/qmk/qmk_firmware/pull/15923))
+* Enable a default task throttle for split pointing. ([#15925](https://github.com/qmk/qmk_firmware/pull/15925))
+* Move mcp23018 driver to core ([#15944](https://github.com/qmk/qmk_firmware/pull/15944))
+* Relocate matrix_init_quantum content ([#15953](https://github.com/qmk/qmk_firmware/pull/15953))
+* Align location of some host led logic ([#15954](https://github.com/qmk/qmk_firmware/pull/15954))
+* Rename some Quantum keycodes ([#15968](https://github.com/qmk/qmk_firmware/pull/15968))
+* Migrate more makefile utilities to builddefs sub-directory ([#16002](https://github.com/qmk/qmk_firmware/pull/16002))
+* Various Makefile optimisations ([#16015](https://github.com/qmk/qmk_firmware/pull/16015))
+* Add support for STM32L432, STM32L442. ([#16016](https://github.com/qmk/qmk_firmware/pull/16016))
+* EEPROM refactor: remove `eeprom_teensy.c` by default, use transient instead ([#16020](https://github.com/qmk/qmk_firmware/pull/16020))
+* Deprecate Split Transaction status field ([#16023](https://github.com/qmk/qmk_firmware/pull/16023))
+* Rip out old macro and action_function system ([#16025](https://github.com/qmk/qmk_firmware/pull/16025))
+* Add a script that simplifies running commands under docker. ([#16028](https://github.com/qmk/qmk_firmware/pull/16028))
+* Add support for Q-series on the ckled2001 LED driver ([#16051](https://github.com/qmk/qmk_firmware/pull/16051))
+* Remove unused suspend_idle ([#16063](https://github.com/qmk/qmk_firmware/pull/16063))
+* Initial migration of suspend callbacks ([#16067](https://github.com/qmk/qmk_firmware/pull/16067))
+* Add layout change callbacks to VIA ([#16087](https://github.com/qmk/qmk_firmware/pull/16087))
+* Rename `AdafruitBLE` to `BluefruitLE` ([#16127](https://github.com/qmk/qmk_firmware/pull/16127))
+* Update outputselect to use platform connected state API ([#16185](https://github.com/qmk/qmk_firmware/pull/16185))
+* Remove default pointing device driver. ([#16190](https://github.com/qmk/qmk_firmware/pull/16190))
+* Add SN74x138 demultiplexer driver ([#16217](https://github.com/qmk/qmk_firmware/pull/16217))
+* Standardise error output. ([#16220](https://github.com/qmk/qmk_firmware/pull/16220))
+* Followup to #16220, more test error output. ([#16221](https://github.com/qmk/qmk_firmware/pull/16221))
+* Misc size regression script improvements. ([#16268](https://github.com/qmk/qmk_firmware/pull/16268))
+* Align existing pca9555 driver to better match mcp23018 API ([#16277](https://github.com/qmk/qmk_firmware/pull/16277))
+* Size checks print out target firmware file instead ([#16290](https://github.com/qmk/qmk_firmware/pull/16290))
+
+CLI:
+* `develop` changelog generator: use the PR title instead ([#15537](https://github.com/qmk/qmk_firmware/pull/15537))
+* `develop` changelog generator: skip code formatting in listing ([#16215](https://github.com/qmk/qmk_firmware/pull/16215))
+
+Keyboards:
+* Durgod: Increase scan rate by using wait_us timer ([#14091](https://github.com/qmk/qmk_firmware/pull/14091))
+* Add another GMMK Pro ANSI Keymap with custom RGB. ([#14243](https://github.com/qmk/qmk_firmware/pull/14243))
+* Parse USB device version BCD ([#14580](https://github.com/qmk/qmk_firmware/pull/14580))
+* Add vitoni keymap for GMMK Pro (ISO) ([#15006](https://github.com/qmk/qmk_firmware/pull/15006))
+* Move bm65hsrgb_iso and bm68hsrgb to rev1/ to prepare for updates to the boards ([#15132](https://github.com/qmk/qmk_firmware/pull/15132))
+* Convert ergoinu to SPLIT_KEYBOARD ([#15305](https://github.com/qmk/qmk_firmware/pull/15305))
+* Convert not_so_minidox to SPLIT_KEYBOARD ([#15306](https://github.com/qmk/qmk_firmware/pull/15306))
+* Added new handwired keyboard Wakizashi 40 ([#15336](https://github.com/qmk/qmk_firmware/pull/15336))
+* Convert ai03/orbit to SPLIT_KEYBOARD ([#15340](https://github.com/qmk/qmk_firmware/pull/15340))
+* Remove manual enable of LTO within user keymaps ([#15378](https://github.com/qmk/qmk_firmware/pull/15378))
+* Move to organization folder ([#15481](https://github.com/qmk/qmk_firmware/pull/15481))
+* Convert some more boards to Matrix Lite ([#15489](https://github.com/qmk/qmk_firmware/pull/15489))
+* Organize Reviung boards into a directory ([#15636](https://github.com/qmk/qmk_firmware/pull/15636))
+* move winry25tc to winry/ ([#15637](https://github.com/qmk/qmk_firmware/pull/15637))
+* Rename ymdk_np21 to np21 + move to ymdk vendor folder ([#15641](https://github.com/qmk/qmk_firmware/pull/15641))
+* move ymd96 to ymdk vendor folder ([#15643](https://github.com/qmk/qmk_firmware/pull/15643))
+* move ymd75 to ymdk vendor folder ([#15645](https://github.com/qmk/qmk_firmware/pull/15645))
+* move yd60mq to ymdk vendor folder ([#15647](https://github.com/qmk/qmk_firmware/pull/15647))
+* rename idobo to idobao/id75, move to vendor folder ([#15661](https://github.com/qmk/qmk_firmware/pull/15661))
+* move ID67 to IDOBAO vendor folder ([#15662](https://github.com/qmk/qmk_firmware/pull/15662))
+* move ID80 to IDOBAO vendor folder ([#15665](https://github.com/qmk/qmk_firmware/pull/15665))
+* move ID87 to IDOBAO vendor folder ([#15667](https://github.com/qmk/qmk_firmware/pull/15667))
+* move montex to IDOBAO vendor folder ([#15668](https://github.com/qmk/qmk_firmware/pull/15668))
+* move @yangdigi 's keyboards to a YDKB folder ([#15681](https://github.com/qmk/qmk_firmware/pull/15681))
+* move @kkatano 's keyboards to kkatano user folder ([#15684](https://github.com/qmk/qmk_firmware/pull/15684))
+* Sol 3 Keyboard from RGBKB ([#15687](https://github.com/qmk/qmk_firmware/pull/15687))
+* move cu24, cu75, cu80/v1 into capsunlocked folder ([#15758](https://github.com/qmk/qmk_firmware/pull/15758))
+* move mechkeys keyboards into the mechkeys/ vendor folder ([#15760](https://github.com/qmk/qmk_firmware/pull/15760))
+* move @lyso1 's boards into lyso1/ ([#15767](https://github.com/qmk/qmk_firmware/pull/15767))
+* move prototypist boards into vendor folder ([#15780](https://github.com/qmk/qmk_firmware/pull/15780))
+* move @yiancar 's boards into yiancardesigns/ ([#15781](https://github.com/qmk/qmk_firmware/pull/15781))
+* move novelkeys keyboards to vendor folder ([#15783](https://github.com/qmk/qmk_firmware/pull/15783))
+* move @weirdo-f 's keyboards into weirdo/ ([#15785](https://github.com/qmk/qmk_firmware/pull/15785))
+* move @marksard 's boards to marksard/ ([#15786](https://github.com/qmk/qmk_firmware/pull/15786))
+* move input club keyboards into vendor folder ([#15788](https://github.com/qmk/qmk_firmware/pull/15788))
+* move @monksoffunk 's boards into 25keys/ ([#15789](https://github.com/qmk/qmk_firmware/pull/15789))
+* move @Salicylic-acid3 's keyboards to salicylic-acid3/ ([#15791](https://github.com/qmk/qmk_firmware/pull/15791))
+* move @rainkeebs 's keyboards to rainkeebs/ ([#15797](https://github.com/qmk/qmk_firmware/pull/15797))
+* move standaside into edi/ ([#15798](https://github.com/qmk/qmk_firmware/pull/15798))
+* move @obosob 's boards into obosob/ ([#15799](https://github.com/qmk/qmk_firmware/pull/15799))
+* move @nacly 's boards to nacly/ ([#15801](https://github.com/qmk/qmk_firmware/pull/15801))
+* move @kakunpc 's keebs into kakunpc/ ([#15814](https://github.com/qmk/qmk_firmware/pull/15814))
+* move @qpocket 's keyboards to qpocket/ ([#15827](https://github.com/qmk/qmk_firmware/pull/15827))
+* BDN9 keymap ([#15924](https://github.com/qmk/qmk_firmware/pull/15924))
+* move @matthewdias 's keebs into matthewdias/ ([#15991](https://github.com/qmk/qmk_firmware/pull/15991))
+* move id80 and id75 to v1 to accommodate for id75 v2 and id80 v3 ([#15992](https://github.com/qmk/qmk_firmware/pull/15992))
+* Remove `action_function()` from LFKeyboards boards ([#15993](https://github.com/qmk/qmk_firmware/pull/15993))
+* move @latincompass (aka @18438880 , @haierwangwei2005)'s boards to /latincompass ([#16039](https://github.com/qmk/qmk_firmware/pull/16039))
+* move g heavy industry boards into /gboards ([#16040](https://github.com/qmk/qmk_firmware/pull/16040))
+* move @drhigsby 's boards into /drhigsby ([#16041](https://github.com/qmk/qmk_firmware/pull/16041))
+* More keyboard rules.mk cleanups ([#16044](https://github.com/qmk/qmk_firmware/pull/16044))
+* move @That-Canadian 's boards into /maple_computing ([#16050](https://github.com/qmk/qmk_firmware/pull/16050))
+* move @takai 's keyboards into /recompile_keys ([#16053](https://github.com/qmk/qmk_firmware/pull/16053))
+* move @satt99 's comet46 to satt/ ([#16059](https://github.com/qmk/qmk_firmware/pull/16059))
+* move @ka2hiro 's boards into /kagizaraya ([#16070](https://github.com/qmk/qmk_firmware/pull/16070))
+* move @GlenPickle 's chimera* boards into a folder ([#16072](https://github.com/qmk/qmk_firmware/pull/16072))
+* move @yynmt 's boards into /yynmt ([#16075](https://github.com/qmk/qmk_firmware/pull/16075))
+* move @Biacco42 's keebs into /biacco42 ([#16080](https://github.com/qmk/qmk_firmware/pull/16080))
+* move unikeyboard boards to /unikeyboard ([#16081](https://github.com/qmk/qmk_firmware/pull/16081))
+* move four_banger to bpiphany ([#16082](https://github.com/qmk/qmk_firmware/pull/16082))
+* move @takashiski 's keebs into /takashiski ([#16089](https://github.com/qmk/qmk_firmware/pull/16089))
+* move hid_liber to /bpiphany ([#16091](https://github.com/qmk/qmk_firmware/pull/16091))
+* move spaceholdings boards into /spaceholdings ([#16096](https://github.com/qmk/qmk_firmware/pull/16096))
+* move @7-rate 's keebs to /rate ([#16099](https://github.com/qmk/qmk_firmware/pull/16099))
+* move @npspears 's boards into /checkerboards ([#16100](https://github.com/qmk/qmk_firmware/pull/16100))
+* move @vuhopkep 's keebs into /hnahkb ([#16102](https://github.com/qmk/qmk_firmware/pull/16102))
+* move @ibnuda 's keebs into /ibnuda ([#16108](https://github.com/qmk/qmk_firmware/pull/16108))
+* move @tominabox1 's keebs into /tominabox1 ([#16109](https://github.com/qmk/qmk_firmware/pull/16109))
+* move niu_mini to /kbdfans ([#16112](https://github.com/qmk/qmk_firmware/pull/16112))
+* move woodkeys.click keyboards to /woodkeys ([#16113](https://github.com/qmk/qmk_firmware/pull/16113))
+* move @omkbd 's boards to /omkbd ([#16116](https://github.com/qmk/qmk_firmware/pull/16116))
+* Overhaul Tractyl Manuform ([#16134](https://github.com/qmk/qmk_firmware/pull/16134))
+* Reduce firmware size for dztech/dz60rgb_wkl/v2_1:via ([#16254](https://github.com/qmk/qmk_firmware/pull/16254))
+
+Keyboard fixes:
+* Fix build failure for UT47 ([#15483](https://github.com/qmk/qmk_firmware/pull/15483))
+* Update grs_70ec to use newer custom matrix ([#15609](https://github.com/qmk/qmk_firmware/pull/15609))
+* fix compiler issue with Tractyl Manuform 4x6 ([#15646](https://github.com/qmk/qmk_firmware/pull/15646))
+* Fix CI. ([#15828](https://github.com/qmk/qmk_firmware/pull/15828))
+* Yet another bad `DEFAULT_FOLDER` fix. ([#15904](https://github.com/qmk/qmk_firmware/pull/15904))
+* Fix build failures for `mschwingen/modelm` ([#15987](https://github.com/qmk/qmk_firmware/pull/15987))
+* `rocketboard_16`: Fix mismatched LUT sizes ([#15997](https://github.com/qmk/qmk_firmware/pull/15997))
+* Fix erroneous SRC for Clueboard 66 hotswap ([#16007](https://github.com/qmk/qmk_firmware/pull/16007))
+* Fix handwired/ms_sculpt_mobile default keymap ([#16032](https://github.com/qmk/qmk_firmware/pull/16032))
+* Re-org Hillside folders as new model prep. Fix default keymap. ([#16128](https://github.com/qmk/qmk_firmware/pull/16128))
+* Fix up default folder locations. Again. ([#16135](https://github.com/qmk/qmk_firmware/pull/16135))
+* Sol3 rgb fix ([#16157](https://github.com/qmk/qmk_firmware/pull/16157))
+* Add missing `BOOTLOADER` for a handful of boards ([#16225](https://github.com/qmk/qmk_firmware/pull/16225))
+* Remove half implemented micronucleus bootloader support ([#16252](https://github.com/qmk/qmk_firmware/pull/16252))
+* Fixup bootloaders. ([#16256](https://github.com/qmk/qmk_firmware/pull/16256))
+* Fix idobao/id80/v3 compilation errors ([#16280](https://github.com/qmk/qmk_firmware/pull/16280))
+* Remove parent-relative paths from keyboards. ([#16282](https://github.com/qmk/qmk_firmware/pull/16282))
+* Bodge for helix build failures ([#16376](https://github.com/qmk/qmk_firmware/pull/16376))
+
+Others:
+* Add a clarification to an error message ([#15207](https://github.com/qmk/qmk_firmware/pull/15207))
+* Clang-format tweaks ([#15906](https://github.com/qmk/qmk_firmware/pull/15906))
+* Add example implementations for compatible MCUs list ([#15935](https://github.com/qmk/qmk_firmware/pull/15935))
+* Add version.h to gitignore ([#16222](https://github.com/qmk/qmk_firmware/pull/16222))
+* Update keyboard mapping for all moved boards this cycle ([#16312](https://github.com/qmk/qmk_firmware/pull/16312))
+* Align docs to new-keyboard behaviour ([#16357](https://github.com/qmk/qmk_firmware/pull/16357))
+* Align new-keyboard with recent schema updates ([#16378](https://github.com/qmk/qmk_firmware/pull/16378))
+
+Bugs:
+* Fixes potential wpm sampling overflow, along with code comment fixes ([#15277](https://github.com/qmk/qmk_firmware/pull/15277))
+* Add missing define for unicode common ([#15416](https://github.com/qmk/qmk_firmware/pull/15416))
+* Fix for SPI write timing in PMW3360 driver ([#15519](https://github.com/qmk/qmk_firmware/pull/15519))
+* Documentation Typo fix ([#15538](https://github.com/qmk/qmk_firmware/pull/15538))
+* fix a typo ([#15557](https://github.com/qmk/qmk_firmware/pull/15557))
+* Fix avr serial compile ([#15589](https://github.com/qmk/qmk_firmware/pull/15589))
+* More AVR GPIO compilation fixes. ([#15592](https://github.com/qmk/qmk_firmware/pull/15592))
+* Fix bug and code regression for Split Common ([#15603](https://github.com/qmk/qmk_firmware/pull/15603))
+* Include missing string.h include in split ([#15606](https://github.com/qmk/qmk_firmware/pull/15606))
+* Fixes for bootloader refactor build failures ([#15638](https://github.com/qmk/qmk_firmware/pull/15638))
+* Update pmw3360 driver after reading the datasheet top to bottom. Fix some outdated refs. ([#15682](https://github.com/qmk/qmk_firmware/pull/15682))
+* Fix split pointing for analog joystick ([#15691](https://github.com/qmk/qmk_firmware/pull/15691))
+* Fix broken bootloader builds in develop. ([#15880](https://github.com/qmk/qmk_firmware/pull/15880))
+* Fix optical sensor firmware upload ([#15919](https://github.com/qmk/qmk_firmware/pull/15919))
+* Pass in the keyrecord_t of the dual-role/tapping key when calling per-key tap hold functions ([#15938](https://github.com/qmk/qmk_firmware/pull/15938))
+* fixed typo in orange HSV colors decalartion ([#15976](https://github.com/qmk/qmk_firmware/pull/15976))
+* Fix hack for chibiOS reset name ([#15984](https://github.com/qmk/qmk_firmware/pull/15984))
+* Fix right side ws2812 leds having two indices ([#15985](https://github.com/qmk/qmk_firmware/pull/15985))
+* Workaround in Makefile for recursive rule matching ([#15988](https://github.com/qmk/qmk_firmware/pull/15988))
+* Fix BACKLIGHT_CAPS_LOCK warning ([#15999](https://github.com/qmk/qmk_firmware/pull/15999))
+* Fix compilation issues for led indicators ([#16001](https://github.com/qmk/qmk_firmware/pull/16001))
+* ChibiOS timer fixes ([#16017](https://github.com/qmk/qmk_firmware/pull/16017))
+* Fix bootloader_jump for certain CTRL boards ([#16026](https://github.com/qmk/qmk_firmware/pull/16026))
+* Fix up issue with PROGMEM and hand_swap_config ([#16027](https://github.com/qmk/qmk_firmware/pull/16027))
+* Don't make EEPROM size assumptions with dynamic keymaps. ([#16054](https://github.com/qmk/qmk_firmware/pull/16054))
+* fix missed .noci in reviung move ([#16107](https://github.com/qmk/qmk_firmware/pull/16107))
+* Fix issues with Python Tests ([#16162](https://github.com/qmk/qmk_firmware/pull/16162))
+* Fixup multibuild filegen ([#16166](https://github.com/qmk/qmk_firmware/pull/16166))
+* Remove old .gitignore entry. Add more macOS junk exclusions. ([#16167](https://github.com/qmk/qmk_firmware/pull/16167))
+* Fixup builds so that teensy EEPROM knows which MCU it's targeting. ([#16168](https://github.com/qmk/qmk_firmware/pull/16168))
+* Create a build error if no bootloader is specified. ([#16181](https://github.com/qmk/qmk_firmware/pull/16181))
+* Ensure `version.h` is recreated each build. ([#16188](https://github.com/qmk/qmk_firmware/pull/16188))
+* Add `custom` to list of valid bootloader types in info.json ([#16228](https://github.com/qmk/qmk_firmware/pull/16228))
+* Fix `layer_state` restoration at end of dynamic macro feature #16208 ([#16230](https://github.com/qmk/qmk_firmware/pull/16230))
+* Minor additions #12795 ([#16276](https://github.com/qmk/qmk_firmware/pull/16276))
+* Various fixes for matrix _RIGHT handling ([#16292](https://github.com/qmk/qmk_firmware/pull/16292))
+* Fix slashes in build_full_test.mk ([#16300](https://github.com/qmk/qmk_firmware/pull/16300))
+* ps2/avr: use the correct file name ([#16316](https://github.com/qmk/qmk_firmware/pull/16316))
+* Fix compilation of ChibiOS UART driver ([#16348](https://github.com/qmk/qmk_firmware/pull/16348))
+* Various fixes for new-keyboard ([#16358](https://github.com/qmk/qmk_firmware/pull/16358))
+* Allow NO_PIN within data driven configuration ([#16359](https://github.com/qmk/qmk_firmware/pull/16359))
diff --git a/docs/ChangeLog/20220226/PR15304.md b/docs/ChangeLog/20220226/PR15304.md
deleted file mode 100644
index 3cdb40db10..0000000000
--- a/docs/ChangeLog/20220226/PR15304.md
+++ /dev/null
@@ -1,13 +0,0 @@
-### Split Common core now supports Pointing Devices ([#15304](https://github.com/qmk/qmk_firmware/pull/15304))
-
-Pointing devices can now be shared across a split keyboard with support for a single pointing device or a pointing device on each side.
-
-This feature can be enabled with `#define SPLIT_POINTING_ENABLE` and one of the following options:
-
-| Setting | Description |
-|---------------------------|------------------------------------|
-|`POINTING_DEVICE_LEFT` | Pointing device on the left side |
-|`POINTING_DEVICE_RIGHT` | Pointing device on the right side |
-|`POINTING_DEVICE_COMBINED` | Pointing device on both sides |
-
-See the [Pointing Device](../feature_pointing_device.md) documentation for further configuration options.
diff --git a/docs/_summary.md b/docs/_summary.md
index 8c83a216ab..74203aa0f8 100644
--- a/docs/_summary.md
+++ b/docs/_summary.md
@@ -131,7 +131,7 @@
* Breaking Changes
* [Overview](breaking_changes.md)
* [My Pull Request Was Flagged](breaking_changes_instructions.md)
- * [Most Recent ChangeLog](ChangeLog/20211127.md "QMK v0.15.0 - 2021 Nov 27")
+ * [Most Recent ChangeLog](ChangeLog/20220226.md "QMK v0.16.0 - 2022 Feb 26")
* [Past Breaking Changes](breaking_changes_history.md)
* C Development
diff --git a/docs/breaking_changes.md b/docs/breaking_changes.md
index 8bde6c88f7..3fed268b98 100644
--- a/docs/breaking_changes.md
+++ b/docs/breaking_changes.md
@@ -8,6 +8,7 @@ The breaking change period is when we will merge PR's that change QMK in dangero
## What has been included in past Breaking Changes?
+* [2022 Feb 26](ChangeLog/20220226.md)
* [2021 Nov 27](ChangeLog/20211127.md)
* [2021 Aug 28](ChangeLog/20210828.md)
* [2021 May 29](ChangeLog/20210529.md)
@@ -20,17 +21,17 @@ The breaking change period is when we will merge PR's that change QMK in dangero
## When is the next Breaking Change?
-The next Breaking Change is scheduled for February 26, 2022.
+The next Breaking Change is scheduled for May 28, 2022.
### Important Dates
-* [x] 2021 Nov 27 - `develop` is tagged with a new release version. Each push to `master` is subsequently merged to `develop` by GitHub actions.
-* [ ] 2022 Jan 31 - `develop` closed to new PR's.
-* [ ] 2022 Jan 31 - Call for testers.
-* [ ] 2022 Feb 12 - Last day for merges -- after this point `develop` is locked for testing and accepts only bugfixes
-* [ ] 2022 Feb 24 - `master` is locked, no PR's merged.
-* [ ] 2022 Feb 26 - Merge `develop` to `master`.
-* [ ] 2022 Feb 26 - `master` is unlocked. PR's can be merged again.
+* [x] 2022 Feb 26 - `develop` is tagged with a new release version. Each push to `master` is subsequently merged to `develop` by GitHub actions.
+* [ ] 2022 Apr 31 - `develop` closed to new PR's.
+* [ ] 2022 Apr 31 - Call for testers.
+* [ ] 2022 May 14 - Last day for merges -- after this point `develop` is locked for testing and accepts only bugfixes
+* [ ] 2022 May 26 - `master` is locked, no PR's merged.
+* [ ] 2022 May 28 - Merge `develop` to `master`.
+* [ ] 2022 May 28 - `master` is unlocked. PR's can be merged again.
## What changes will be included?
diff --git a/docs/breaking_changes_history.md b/docs/breaking_changes_history.md
index 6b1b71b1fd..c40989fb5e 100644
--- a/docs/breaking_changes_history.md
+++ b/docs/breaking_changes_history.md
@@ -2,6 +2,7 @@
This page links to all previous changelogs from the QMK Breaking Changes process.
+* [2022 Feb 26](ChangeLog/20220226.md) - version 0.16.0
* [2021 Nov 27](ChangeLog/20211127.md) - version 0.15.0
* [2021 Aug 28](ChangeLog/20210828.md) - version 0.14.0
* [2021 May 29](ChangeLog/20210529.md) - version 0.13.0
diff --git a/lib/python/qmk/cli/generate/develop_pr_list.py b/lib/python/qmk/cli/generate/develop_pr_list.py
index 09236a7c42..549db5b185 100755
--- a/lib/python/qmk/cli/generate/develop_pr_list.py
+++ b/lib/python/qmk/cli/generate/develop_pr_list.py
@@ -18,7 +18,8 @@ ignored_titles = ["Format code according to conventions"]
def _is_ignored(title):
for ignore in ignored_titles:
if ignore in title:
- return
+ return True
+ return False
def _get_pr_info(cache, gh, pr_num):
--
cgit v1.2.3