1
0
Fork 0
forked from forks/qmk_firmware

Move tmk_core/common/<plat> (#13918)

This commit is contained in:
Joel Challis 2021-11-19 18:41:02 +00:00 committed by GitHub
parent 43b9e23bae
commit 2728603fe6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
107 changed files with 54 additions and 54 deletions

View file

@ -388,7 +388,7 @@ VPATH += $(COMMON_VPATH)
include common_features.mk include common_features.mk
include $(BUILDDEFS_PATH)/generic_features.mk include $(BUILDDEFS_PATH)/generic_features.mk
include $(TMK_PATH)/protocol.mk include $(TMK_PATH)/protocol.mk
include $(TMK_PATH)/common.mk include $(PLATFORM_PATH)/common.mk
include $(BUILDDEFS_PATH)/bootloader.mk include $(BUILDDEFS_PATH)/bootloader.mk
SRC += $(patsubst %.c,%.clib,$(LIB_SRC)) SRC += $(patsubst %.c,%.clib,$(LIB_SRC))
@ -404,13 +404,14 @@ ifneq ($(REQUIRE_PLATFORM_KEY),)
endif endif
endif endif
include $(TMK_PATH)/$(PLATFORM_KEY).mk include $(PLATFORM_PATH)/$(PLATFORM_KEY)/platform.mk
-include $(PLATFORM_PATH)/$(PLATFORM_KEY)/flash.mk
ifneq ($(strip $(PROTOCOL)),) ifneq ($(strip $(PROTOCOL)),)
include $(TMK_PATH)/protocol/$(strip $(shell echo $(PROTOCOL) | tr '[:upper:]' '[:lower:]')).mk include $(TMK_PATH)/protocol/$(strip $(shell echo $(PROTOCOL) | tr '[:upper:]' '[:lower:]')).mk
else else
include $(TMK_PATH)/protocol/$(PLATFORM_KEY).mk include $(TMK_PATH)/protocol/$(PLATFORM_KEY).mk
endif endif
-include $(TOP_DIR)/platforms/$(PLATFORM_KEY)/flash.mk
# TODO: remove this bodge? # TODO: remove this bodge?
PROJECT_DEFS := $(OPT_DEFS) PROJECT_DEFS := $(OPT_DEFS)

View file

@ -54,11 +54,11 @@ endif
include common_features.mk include common_features.mk
include $(BUILDDEFS_PATH)/generic_features.mk include $(BUILDDEFS_PATH)/generic_features.mk
include $(TMK_PATH)/common.mk include $(PLATFORM_PATH)/common.mk
include $(TMK_PATH)/protocol.mk include $(TMK_PATH)/protocol.mk
include $(QUANTUM_PATH)/debounce/tests/rules.mk include $(QUANTUM_PATH)/debounce/tests/rules.mk
include $(QUANTUM_PATH)/sequencer/tests/rules.mk include $(QUANTUM_PATH)/sequencer/tests/rules.mk
include $(TMK_PATH)/common/test/rules.mk include $(PLATFORM_PATH)/test/rules.mk
ifneq ($(filter $(FULL_TESTS),$(TEST)),) ifneq ($(filter $(FULL_TESTS),$(TEST)),)
include build_full_test.mk include build_full_test.mk
endif endif
@ -73,7 +73,7 @@ $(TEST_OBJ)/$(TEST)_INC := $($(TEST)_INC) $(VPATH) $(GTEST_INC)
$(TEST_OBJ)/$(TEST)_DEFS := $($(TEST)_DEFS) $(TEST_OBJ)/$(TEST)_DEFS := $($(TEST)_DEFS)
$(TEST_OBJ)/$(TEST)_CONFIG := $($(TEST)_CONFIG) $(TEST_OBJ)/$(TEST)_CONFIG := $($(TEST)_CONFIG)
include $(TMK_PATH)/native.mk include $(PLATFORM_PATH)/$(PLATFORM_KEY)/platform.mk
include $(TMK_PATH)/rules.mk include $(TMK_PATH)/rules.mk

View file

@ -33,8 +33,10 @@ QUANTUM_SRC += \
VPATH += $(QUANTUM_DIR)/logging VPATH += $(QUANTUM_DIR)/logging
# Fall back to lib/printf if there is no platform provided print # Fall back to lib/printf if there is no platform provided print
ifeq ("$(wildcard $(TMK_PATH)/common/$(PLATFORM_KEY)/printf.mk)","") ifeq ("$(wildcard $(PLATFORM_PATH)/$(PLATFORM_KEY)/printf.mk)","")
include $(QUANTUM_PATH)/logging/print.mk include $(QUANTUM_PATH)/logging/print.mk
else
include $(PLATFORM_PATH)/$(PLATFORM_KEY)/printf.mk
endif endif
ifeq ($(strip $(DEBUG_MATRIX_SCAN_RATE_ENABLE)), yes) ifeq ($(strip $(DEBUG_MATRIX_SCAN_RATE_ENABLE)), yes)

View file

@ -45,7 +45,7 @@ Once you have a good feel for how layers work and what you can do, you can get m
Layers stack on top of each other in numerical order. When determining what a keypress does, QMK scans the layers from the top down, stopping when it reaches the first active layer that is not set to `KC_TRNS`. As a result if you activate a layer that is numerically lower than your current layer, and your current layer (or another layer that is active and higher than your target layer) has something other than `KC_TRNS`, that is the key that will be sent, not the key on the layer you just activated. This is the cause of most people's "why doesn't my layer get switched" problem. Layers stack on top of each other in numerical order. When determining what a keypress does, QMK scans the layers from the top down, stopping when it reaches the first active layer that is not set to `KC_TRNS`. As a result if you activate a layer that is numerically lower than your current layer, and your current layer (or another layer that is active and higher than your target layer) has something other than `KC_TRNS`, that is the key that will be sent, not the key on the layer you just activated. This is the cause of most people's "why doesn't my layer get switched" problem.
Sometimes, you might want to switch between layers in a macro or as part of a tap dance routine. `layer_on` activates a layer, and `layer_off` deactivates it. More layer-related functions can be found in [action_layer.h](https://github.com/qmk/qmk_firmware/blob/master/tmk_core/common/action_layer.h). Sometimes, you might want to switch between layers in a macro or as part of a tap dance routine. `layer_on` activates a layer, and `layer_off` deactivates it. More layer-related functions can be found in [action_layer.h](https://github.com/qmk/qmk_firmware/blob/master/quantum/action_layer.h).
## Functions :id=functions ## Functions :id=functions

View file

@ -6,7 +6,7 @@ Cette page couvre les questions souvent posées à propos des keymaps. Si vous n
Regardez [Keycodes](keycodes.md) pour une liste des keycodes disponibles. Certains keycodes spécifiques ont des documentations plus complètes de disponible. Regardez [Keycodes](keycodes.md) pour une liste des keycodes disponibles. Certains keycodes spécifiques ont des documentations plus complètes de disponible.
Les keycodes sont définies dans [common/keycode.h](https://github.com/qmk/qmk_firmware/blob/master/tmk_core/common/keycode.h). Les keycodes sont définies dans [common/keycode.h](https://github.com/qmk/qmk_firmware/blob/master/quantum/keycode.h).
## Quels sont les keycodes par défaut ? ## Quels sont les keycodes par défaut ?

View file

@ -4,7 +4,7 @@ QMK has a GPIO control abstraction layer which is microcontroller agnostic. This
## Functions :id=functions ## Functions :id=functions
The following functions provide basic control of GPIOs and are found in `tmk_core/common/<platform>/gpio.h`. The following functions provide basic control of GPIOs and are found in `platforms/<platform>/gpio.h`.
|Function |Description | Old AVR Examples | Old ChibiOS/ARM Examples | |Function |Description | Old AVR Examples | Old ChibiOS/ARM Examples |
|------------------------|--------------------------------------------------|-------------------------------------------------|-------------------------------------------------| |------------------------|--------------------------------------------------|-------------------------------------------------|-------------------------------------------------|

View file

@ -10,7 +10,7 @@
## どのキーコードを使えますか? ## どのキーコードを使えますか?
あなたが利用可能なキーコードのインデックスについては、[キーコード](ja/keycodes.md)を見てください。より広範なドキュメントがある場合は、そこからリンクしてあります。 あなたが利用可能なキーコードのインデックスについては、[キーコード](ja/keycodes.md)を見てください。より広範なドキュメントがある場合は、そこからリンクしてあります。
キーコードは実際には [common/keycode.h](https://github.com/qmk/qmk_firmware/blob/master/tmk_core/common/keycode.h) で定義されています。 キーコードは実際には [common/keycode.h](https://github.com/qmk/qmk_firmware/blob/master/quantum/keycode.h) で定義されています。
## デフォルトのキーコードとは何か? ## デフォルトのキーコードとは何か?

View file

@ -50,7 +50,7 @@ QMK を使い始めたばかりの場合は、全てを単純にしたいでし
レイヤーは番号順に上に積み重なっています。キーの押下の動作を決定する時に、QMK は上から順にレイヤーを走査し、`KC_TRNS` に設定されていない最初のアクティブなレイヤーに到達すると停止します。結果として、現在のレイヤーよりも数値的に低いレイヤーをアクティブにし、現在のレイヤー(あるいはアクティブでターゲットレイヤーよりも高い別のレイヤー)に `KC_TRNS` 以外のものがある場合、それが送信されるキーであり、アクティブ化したばかりのレイヤー上のキーではありません。これが、ほとんどの人の "なぜレイヤーが切り替わらないのか" 問題の原因です。 レイヤーは番号順に上に積み重なっています。キーの押下の動作を決定する時に、QMK は上から順にレイヤーを走査し、`KC_TRNS` に設定されていない最初のアクティブなレイヤーに到達すると停止します。結果として、現在のレイヤーよりも数値的に低いレイヤーをアクティブにし、現在のレイヤー(あるいはアクティブでターゲットレイヤーよりも高い別のレイヤー)に `KC_TRNS` 以外のものがある場合、それが送信されるキーであり、アクティブ化したばかりのレイヤー上のキーではありません。これが、ほとんどの人の "なぜレイヤーが切り替わらないのか" 問題の原因です。
場合によっては、マクロ内あるいはタップダンスルーチンの一部としてレイヤーを切り替えほうが良いかもしれません。`layer_on` はレイヤーをアクティブにし、`layer_off` はそれを非アクティブにします。もっと多くのレイヤーに関する関数は、[action_layer.h](https://github.com/qmk/qmk_firmware/blob/master/tmk_core/common/action_layer.h) で見つけることができます。 場合によっては、マクロ内あるいはタップダンスルーチンの一部としてレイヤーを切り替えほうが良いかもしれません。`layer_on` はレイヤーをアクティブにし、`layer_off` はそれを非アクティブにします。もっと多くのレイヤーに関する関数は、[action_layer.h](https://github.com/qmk/qmk_firmware/blob/master/quantum/action_layer.h) で見つけることができます。
## 関数 :id=functions ## 関数 :id=functions

View file

@ -27,7 +27,7 @@
- 「旧式の」 GPIO/I2C/SPI 関数を使用しない - 正当な理由がない限り、QMK の抽象化を使用しなければなりません (怠惰は正当な理由にはなりません) - 「旧式の」 GPIO/I2C/SPI 関数を使用しない - 正当な理由がない限り、QMK の抽象化を使用しなければなりません (怠惰は正当な理由にはなりません)
- タイミングの抽象化にも従う必要があります: - タイミングの抽象化にも従う必要があります:
- `_delay_ms()` のかわりに `wait_ms()` を。(`#include <util/delay.h>` も消します) - `_delay_ms()` のかわりに `wait_ms()` を。(`#include <util/delay.h>` も消します)
- `timer_read()``timer_read32()` など。 -- タイミング API は [timer.h](https://github.com/qmk/qmk_firmware/blob/master/tmk_core/common/timer.h) を参照してください - `timer_read()``timer_read32()` など。 -- タイミング API は [timer.h](https://github.com/qmk/qmk_firmware/blob/master/platforms/timer.h) を参照してください
- 新しい抽象化が有用だと思う場合は、次のことをお勧めします: - 新しい抽象化が有用だと思う場合は、次のことをお勧めします:
- 機能が完成するまで自分のキーボードでプロトタイプを作成する - 機能が完成するまで自分のキーボードでプロトタイプを作成する
- Discord の QMK コラボレータと話し合う - Discord の QMK コラボレータと話し合う

View file

@ -24,7 +24,7 @@ If there are any inconsistencies with these recommendations, you're best off [cr
- no "old-school" or other low-level GPIO/I2C/SPI functions may be used -- must use QMK abstractions unless justifiable (and laziness is not valid justification) - no "old-school" or other low-level GPIO/I2C/SPI functions may be used -- must use QMK abstractions unless justifiable (and laziness is not valid justification)
- timing abstractions should be followed too: - timing abstractions should be followed too:
- `wait_ms()` instead of `_delay_ms()` (remove `#include <util/delay.h>` too) - `wait_ms()` instead of `_delay_ms()` (remove `#include <util/delay.h>` too)
- `timer_read()` and `timer_read32()` etc. -- see [timer.h](https://github.com/qmk/qmk_firmware/blob/master/tmk_core/common/timer.h) for the timing APIs - `timer_read()` and `timer_read32()` etc. -- see [timer.h](https://github.com/qmk/qmk_firmware/blob/master/platforms/timer.h) for the timing APIs
- if you think a new abstraction is useful, you're encouraged to: - if you think a new abstraction is useful, you're encouraged to:
- prototype it in your own keyboard until it's feature-complete - prototype it in your own keyboard until it's feature-complete
- discuss it with QMK Collaborators on Discord - discuss it with QMK Collaborators on Discord

View file

@ -5,7 +5,7 @@
## 我能用什么键码? ## 我能用什么键码?
看[键码](keycodes.md)你可以找到你能用的键码索引。可以的话这些链接可以连接到更广泛的文档。 看[键码](keycodes.md)你可以找到你能用的键码索引。可以的话这些链接可以连接到更广泛的文档。
键码实际上定义在[common/keycode.h](https://github.com/qmk/qmk_firmware/blob/master/tmk_core/common/keycode.h). 键码实际上定义在[common/keycode.h](https://github.com/qmk/qmk_firmware/blob/master/quantum/keycode.h).
## 默认的键码什么样? ## 默认的键码什么样?

View file

@ -8,7 +8,7 @@
#include "quantum.h" #include "quantum.h"
#ifdef EE_HANDS #ifdef EE_HANDS
# include "tmk_core/common/eeprom.h" # include "eeprom.h"
# include "eeconfig.h" # include "eeconfig.h"
#endif #endif

View file

@ -9,7 +9,7 @@
#include "raw_hid.h" #include "raw_hid.h"
#include "dynamic_keymap.h" #include "dynamic_keymap.h"
#include "tmk_core/common/eeprom.h" #include "eeprom.h"
#include "version.h" // for QMK_BUILDDATE used in EEPROM magic #include "version.h" // for QMK_BUILDDATE used in EEPROM magic
/* Artificial delay added to get media keys to work in the encoder*/ /* Artificial delay added to get media keys to work in the encoder*/

View file

@ -1,5 +1,5 @@
#include "satisfaction75.h" #include "satisfaction75.h"
#include "tmk_core/common/eeprom.h" #include "eeprom.h"
void pre_encoder_mode_change(){ void pre_encoder_mode_change(){
if(encoder_mode == ENC_MODE_CLOCK_SET){ if(encoder_mode == ENC_MODE_CLOCK_SET){

View file

@ -17,7 +17,7 @@
*/ */
#include QMK_KEYBOARD_H #include QMK_KEYBOARD_H
#include "tmk_core/common/eeprom.h" #include "eeprom.h"
#include "action_layer.h" #include "action_layer.h"
#include "rgblight.h" #include "rgblight.h"
#include "via.h" #include "via.h"

View file

@ -17,7 +17,7 @@
*/ */
#include "mxss_frontled.h" #include "mxss_frontled.h"
#include "tmk_core/common/eeprom.h" #include "eeprom.h"
#include "rgblight.h" #include "rgblight.h"
#include "via.h" #include "via.h"
#include "version.h" // for QMK_BUILDDATE used in EEPROM magic #include "version.h" // for QMK_BUILDDATE used in EEPROM magic

View file

@ -27,7 +27,7 @@
#include "via.h" #include "via.h"
#ifndef VIA_ENABLE #ifndef VIA_ENABLE
#include "tmk_core/common/eeprom.h" #include "eeprom.h"
#include "version.h" // for QMK_BUILDDATE used in EEPROM magic #include "version.h" // for QMK_BUILDDATE used in EEPROM magic
#endif #endif

View file

@ -24,7 +24,7 @@
#include "progmem.h" #include "progmem.h"
#include "quantum/color.h" #include "quantum/color.h"
#include "tmk_core/common/eeprom.h" #include "eeprom.h"
#include "via.h" // uses EEPROM address, lighting value IDs #include "via.h" // uses EEPROM address, lighting value IDs
#define MONO_BACKLIGHT_CONFIG_EEPROM_ADDR (VIA_EEPROM_CUSTOM_CONFIG_ADDR) #define MONO_BACKLIGHT_CONFIG_EEPROM_ADDR (VIA_EEPROM_CUSTOM_CONFIG_ADDR)

View file

@ -68,7 +68,7 @@ LED_TYPE g_ws2812_leds[WS2812_LED_TOTAL];
#include "progmem.h" #include "progmem.h"
#include "quantum/color.h" #include "quantum/color.h"
#include "tmk_core/common/eeprom.h" #include "eeprom.h"
#include "via.h" // uses EEPROM address, lighting value IDs #include "via.h" // uses EEPROM address, lighting value IDs
#define RGB_BACKLIGHT_CONFIG_EEPROM_ADDR (VIA_EEPROM_CUSTOM_CONFIG_ADDR) #define RGB_BACKLIGHT_CONFIG_EEPROM_ADDR (VIA_EEPROM_CUSTOM_CONFIG_ADDR)

View file

@ -13,6 +13,9 @@ DRIVER_PATH = $(DRIVER_DIR)
PLATFORM_DIR = platforms PLATFORM_DIR = platforms
PLATFORM_PATH = $(PLATFORM_DIR) PLATFORM_PATH = $(PLATFORM_DIR)
PROTOCOL_DIR = protocol
PROTOCOL_PATH = $(TMK_DIR)/$(PROTOCOL_DIR)
BUILDDEFS_DIR = builddefs BUILDDEFS_DIR = builddefs
BUILDDEFS_PATH = $(BUILDDEFS_DIR) BUILDDEFS_PATH = $(BUILDDEFS_DIR)

View file

@ -163,7 +163,7 @@ ifeq ($(strip $(QMK_BOOTLOADER_TYPE)),)
else else
make -C lib/lufa/Bootloaders/$(QMK_BOOTLOADER_TYPE)/ clean make -C lib/lufa/Bootloaders/$(QMK_BOOTLOADER_TYPE)/ clean
$(QMK_BIN) generate-dfu-header --quiet --keyboard $(KEYBOARD) --output lib/lufa/Bootloaders/$(QMK_BOOTLOADER_TYPE)/Keyboard.h $(QMK_BIN) generate-dfu-header --quiet --keyboard $(KEYBOARD) --output lib/lufa/Bootloaders/$(QMK_BOOTLOADER_TYPE)/Keyboard.h
$(eval MAX_SIZE=$(shell n=`$(CC) -E -mmcu=$(MCU) -D__ASSEMBLER__ $(CFLAGS) $(OPT_DEFS) tmk_core/common/avr/bootloader_size.c 2> /dev/null | sed -ne 's/\r//;/^#/n;/^AVR_SIZE:/,$${s/^AVR_SIZE: //;p;}'` && echo $$(($$n)) || echo 0)) $(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 PROGRAM_SIZE_KB=$(shell n=`expr $(MAX_SIZE) / 1024` && echo $$(($$n)) || echo 0)) $(eval PROGRAM_SIZE_KB=$(shell n=`expr $(MAX_SIZE) / 1024` && echo $$(($$n)) || echo 0))
$(eval BOOT_SECTION_SIZE_KB=$(shell n=`expr $(BOOTLOADER_SIZE) / 1024` && echo $$(($$n)) || echo 0)) $(eval BOOT_SECTION_SIZE_KB=$(shell n=`expr $(BOOTLOADER_SIZE) / 1024` && echo $$(($$n)) || echo 0))
$(eval FLASH_SIZE_KB=$(shell n=`expr $(PROGRAM_SIZE_KB) + $(BOOT_SECTION_SIZE_KB)` && echo $$(($$n)) || echo 0)) $(eval FLASH_SIZE_KB=$(shell n=`expr $(PROGRAM_SIZE_KB) + $(BOOT_SECTION_SIZE_KB)` && echo $$(($$n)) || echo 0))

12
platforms/common.mk Normal file
View file

@ -0,0 +1,12 @@
PLATFORM_COMMON_DIR = $(PLATFORM_PATH)/$(PLATFORM_KEY)
TMK_COMMON_SRC += \
$(PLATFORM_COMMON_DIR)/platform.c \
$(PLATFORM_COMMON_DIR)/suspend.c \
$(PLATFORM_COMMON_DIR)/timer.c \
$(PLATFORM_COMMON_DIR)/bootloader.c \
# Search Path
VPATH += $(PLATFORM_PATH)
VPATH += $(PLATFORM_PATH)/$(PLATFORM_KEY)
VPATH += $(PLATFORM_PATH)/$(PLATFORM_KEY)/$(DRIVER_DIR)

View file

@ -11,14 +11,14 @@ eeprom_stm32_large_DEFS := $(eeprom_stm32_DEFS) \
-DFEE_PAGE_COUNT=16 -DFEE_PAGE_COUNT=16
eeprom_stm32_INC := \ eeprom_stm32_INC := \
$(TMK_PATH)/common/chibios/ $(PLATFORM_PATH)/chibios/
eeprom_stm32_tiny_INC := $(eeprom_stm32_INC) eeprom_stm32_tiny_INC := $(eeprom_stm32_INC)
eeprom_stm32_large_INC := $(eeprom_stm32_INC) eeprom_stm32_large_INC := $(eeprom_stm32_INC)
eeprom_stm32_SRC := \ eeprom_stm32_SRC := \
$(TOP_DIR)/drivers/eeprom/eeprom_driver.c \ $(TOP_DIR)/drivers/eeprom/eeprom_driver.c \
$(TMK_PATH)/common/test/eeprom_stm32_tests.cpp \ $(PLATFORM_PATH)/$(PLATFORM_KEY)/eeprom_stm32_tests.cpp \
$(TMK_PATH)/common/test/flash_stm32_mock.c \ $(PLATFORM_PATH)/$(PLATFORM_KEY)/flash_stm32_mock.c \
$(TMK_PATH)/common/chibios/eeprom_stm32.c $(PLATFORM_PATH)/chibios/eeprom_stm32.c
eeprom_stm32_tiny_SRC := $(eeprom_stm32_SRC) eeprom_stm32_tiny_SRC := $(eeprom_stm32_SRC)
eeprom_stm32_large_SRC := $(eeprom_stm32_SRC) eeprom_stm32_large_SRC := $(eeprom_stm32_SRC)

View file

@ -16,7 +16,7 @@
DEBOUNCE_COMMON_DEFS := -DMATRIX_ROWS=4 -DMATRIX_COLS=10 -DDEBOUNCE=5 DEBOUNCE_COMMON_DEFS := -DMATRIX_ROWS=4 -DMATRIX_COLS=10 -DDEBOUNCE=5
DEBOUNCE_COMMON_SRC := $(QUANTUM_PATH)/debounce/tests/debounce_test_common.cpp \ DEBOUNCE_COMMON_SRC := $(QUANTUM_PATH)/debounce/tests/debounce_test_common.cpp \
$(TMK_PATH)/common/test/timer.c $(PLATFORM_PATH)/$(PLATFORM_KEY)/timer.c
debounce_sym_defer_g_DEFS := $(DEBOUNCE_COMMON_DEFS) debounce_sym_defer_g_DEFS := $(DEBOUNCE_COMMON_DEFS)
debounce_sym_defer_g_SRC := $(DEBOUNCE_COMMON_SRC) \ debounce_sym_defer_g_SRC := $(DEBOUNCE_COMMON_SRC) \

Some files were not shown because too many files have changed in this diff Show more