From e884e42ce98ad8994477deef26e6ad27b8b3643c Mon Sep 17 00:00:00 2001 From: Joel Challis Date: Sun, 12 Nov 2023 22:30:27 +0000 Subject: [PATCH] Generalise ADC driver source inclusion (#22448) --- builddefs/common_features.mk | 12 ++++++++---- docs/adc_driver.md | 2 +- keyboards/1upkeyboards/1upslider8/rules.mk | 2 +- keyboards/cipulot/ec_23u/rules.mk | 3 ++- keyboards/cipulot/ec_60/rules.mk | 3 ++- keyboards/cipulot/ec_alveus/1_0_0/rules.mk | 3 ++- keyboards/cipulot/ec_alveus/1_2_0/rules.mk | 3 ++- keyboards/cipulot/ec_pro2/rules.mk | 4 +++- keyboards/cipulot/ec_prox/ansi_iso/rules.mk | 3 ++- keyboards/cipulot/ec_prox/jis/rules.mk | 3 ++- keyboards/cipulot/ec_theca/rules.mk | 3 ++- keyboards/cipulot/rf_r1_8_9xu/rules.mk | 3 ++- keyboards/drop/alt/v2/rules.mk | 4 +++- keyboards/drop/ctrl/v2/rules.mk | 4 +++- keyboards/drop/shift/v2/rules.mk | 4 +++- keyboards/gmmk/numpad/rules.mk | 5 +++-- keyboards/handwired/battleship_gamepad/rules.mk | 2 -- keyboards/handwired/onekey/keymaps/adc/rules.mk | 4 ++-- keyboards/handwired/onekey/nucleo_f446re/rules.mk | 1 - keyboards/handwired/promethium/rules.mk | 3 ++- keyboards/keebwerk/nano_slider/rules.mk | 2 +- keyboards/lime/keymaps/default/rules.mk | 2 -- keyboards/ploopyco/mouse/rules.mk | 3 ++- keyboards/ploopyco/trackball/rules.mk | 3 ++- keyboards/ploopyco/trackball_mini/rules.mk | 3 ++- keyboards/ploopyco/trackball_thumb/rules.mk | 3 ++- keyboards/sekigon/grs_70ec/rules.mk | 4 +++- keyboards/splitkb/kyria/keymaps/gotham/rules.mk | 2 +- keyboards/tzarc/ghoul/rules.mk | 2 +- keyboards/ungodly/launch_pad/rules.mk | 2 +- keyboards/v4n4g0rth0n/v2/rules.mk | 3 +-- keyboards/viktus/minne_topre/rules.mk | 3 ++- keyboards/viktus/osav2_numpad_topre/rules.mk | 3 ++- keyboards/viktus/osav2_topre/rules.mk | 3 ++- keyboards/viktus/styrka_topre/rules.mk | 3 ++- 35 files changed, 69 insertions(+), 43 deletions(-) diff --git a/builddefs/common_features.mk b/builddefs/common_features.mk index b6f888d30d..fbaf087ad1 100644 --- a/builddefs/common_features.mk +++ b/builddefs/common_features.mk @@ -139,8 +139,7 @@ ifeq ($(strip $(POINTING_DEVICE_ENABLE)), yes) ifeq ($(strip $(POINTING_DEVICE_DRIVER)), adns9800) SPI_DRIVER_REQUIRED = yes else ifeq ($(strip $(POINTING_DEVICE_DRIVER)), analog_joystick) - OPT_DEFS += -DSTM32_ADC -DHAL_USE_ADC=TRUE - LIB_SRC += analog.c + ANALOG_DRIVER_REQUIRED = yes else ifeq ($(strip $(POINTING_DEVICE_DRIVER)), cirque_pinnacle_i2c) I2C_DRIVER_REQUIRED = yes SRC += drivers/sensors/cirque_pinnacle.c @@ -840,8 +839,8 @@ ifeq ($(strip $(JOYSTICK_ENABLE)), yes) SRC += $(QUANTUM_DIR)/joystick.c ifeq ($(strip $(JOYSTICK_DRIVER)), analog) + ANALOG_DRIVER_REQUIRED = yes OPT_DEFS += -DANALOG_JOYSTICK_ENABLE - SRC += analog.c endif ifeq ($(strip $(JOYSTICK_DRIVER)), digital) OPT_DEFS += -DDIGITAL_JOYSTICK_ENABLE @@ -886,9 +885,9 @@ ifeq ($(strip $(BLUETOOTH_ENABLE)), yes) ifeq ($(strip $(BLUETOOTH_DRIVER)), bluefruit_le) SPI_DRIVER_REQUIRED = yes + ANALOG_DRIVER_REQUIRED = yes SRC += $(DRIVER_PATH)/bluetooth/bluetooth.c SRC += $(DRIVER_PATH)/bluetooth/bluefruit_le.cpp - QUANTUM_LIB_SRC += analog.c endif ifeq ($(strip $(BLUETOOTH_DRIVER)), rn42) @@ -935,6 +934,11 @@ ifeq ($(strip $(APA102_DRIVER_REQUIRED)), yes) SRC += apa102.c endif +ifeq ($(strip $(ANALOG_DRIVER_REQUIRED)), yes) + OPT_DEFS += -DHAL_USE_ADC=TRUE + QUANTUM_LIB_SRC += analog.c +endif + ifeq ($(strip $(I2C_DRIVER_REQUIRED)), yes) OPT_DEFS += -DHAL_USE_I2C=TRUE QUANTUM_LIB_SRC += i2c_master.c diff --git a/docs/adc_driver.md b/docs/adc_driver.md index 494d90c94f..dd928e1e7f 100644 --- a/docs/adc_driver.md +++ b/docs/adc_driver.md @@ -9,7 +9,7 @@ This driver currently supports both AVR and a limited selection of ARM devices. To use this driver, add the following to your `rules.mk`: ```make -SRC += analog.c +ANALOG_DRIVER_REQUIRED = yes ``` Then place this include at the top of your code: diff --git a/keyboards/1upkeyboards/1upslider8/rules.mk b/keyboards/1upkeyboards/1upslider8/rules.mk index 8515c3fae0..cc58820278 100644 --- a/keyboards/1upkeyboards/1upslider8/rules.mk +++ b/keyboards/1upkeyboards/1upslider8/rules.mk @@ -1 +1 @@ -SRC += analog.c +ANALOG_DRIVER_REQUIRED = yes diff --git a/keyboards/cipulot/ec_23u/rules.mk b/keyboards/cipulot/ec_23u/rules.mk index ed348e8618..fc2dcf32ab 100644 --- a/keyboards/cipulot/ec_23u/rules.mk +++ b/keyboards/cipulot/ec_23u/rules.mk @@ -1,3 +1,4 @@ CUSTOM_MATRIX = lite -QUANTUM_LIB_SRC += analog.c SRC += matrix.c ec_switch_matrix.c + +ANALOG_DRIVER_REQUIRED = yes diff --git a/keyboards/cipulot/ec_60/rules.mk b/keyboards/cipulot/ec_60/rules.mk index ed348e8618..fc2dcf32ab 100644 --- a/keyboards/cipulot/ec_60/rules.mk +++ b/keyboards/cipulot/ec_60/rules.mk @@ -1,3 +1,4 @@ CUSTOM_MATRIX = lite -QUANTUM_LIB_SRC += analog.c SRC += matrix.c ec_switch_matrix.c + +ANALOG_DRIVER_REQUIRED = yes diff --git a/keyboards/cipulot/ec_alveus/1_0_0/rules.mk b/keyboards/cipulot/ec_alveus/1_0_0/rules.mk index b8929fa590..fc2dcf32ab 100644 --- a/keyboards/cipulot/ec_alveus/1_0_0/rules.mk +++ b/keyboards/cipulot/ec_alveus/1_0_0/rules.mk @@ -1,3 +1,4 @@ CUSTOM_MATRIX = lite -QUANTUM_LIB_SRC += analog.c SRC += matrix.c ec_switch_matrix.c + +ANALOG_DRIVER_REQUIRED = yes diff --git a/keyboards/cipulot/ec_alveus/1_2_0/rules.mk b/keyboards/cipulot/ec_alveus/1_2_0/rules.mk index b8929fa590..fc2dcf32ab 100644 --- a/keyboards/cipulot/ec_alveus/1_2_0/rules.mk +++ b/keyboards/cipulot/ec_alveus/1_2_0/rules.mk @@ -1,3 +1,4 @@ CUSTOM_MATRIX = lite -QUANTUM_LIB_SRC += analog.c SRC += matrix.c ec_switch_matrix.c + +ANALOG_DRIVER_REQUIRED = yes diff --git a/keyboards/cipulot/ec_pro2/rules.mk b/keyboards/cipulot/ec_pro2/rules.mk index b27b0f7ac0..fc2dcf32ab 100644 --- a/keyboards/cipulot/ec_pro2/rules.mk +++ b/keyboards/cipulot/ec_pro2/rules.mk @@ -1,2 +1,4 @@ CUSTOM_MATRIX = lite -SRC += analog.c matrix.c ec_switch_matrix.c +SRC += matrix.c ec_switch_matrix.c + +ANALOG_DRIVER_REQUIRED = yes diff --git a/keyboards/cipulot/ec_prox/ansi_iso/rules.mk b/keyboards/cipulot/ec_prox/ansi_iso/rules.mk index ed348e8618..fc2dcf32ab 100644 --- a/keyboards/cipulot/ec_prox/ansi_iso/rules.mk +++ b/keyboards/cipulot/ec_prox/ansi_iso/rules.mk @@ -1,3 +1,4 @@ CUSTOM_MATRIX = lite -QUANTUM_LIB_SRC += analog.c SRC += matrix.c ec_switch_matrix.c + +ANALOG_DRIVER_REQUIRED = yes diff --git a/keyboards/cipulot/ec_prox/jis/rules.mk b/keyboards/cipulot/ec_prox/jis/rules.mk index ed348e8618..fc2dcf32ab 100644 --- a/keyboards/cipulot/ec_prox/jis/rules.mk +++ b/keyboards/cipulot/ec_prox/jis/rules.mk @@ -1,3 +1,4 @@ CUSTOM_MATRIX = lite -QUANTUM_LIB_SRC += analog.c SRC += matrix.c ec_switch_matrix.c + +ANALOG_DRIVER_REQUIRED = yes diff --git a/keyboards/cipulot/ec_theca/rules.mk b/keyboards/cipulot/ec_theca/rules.mk index b8929fa590..fc2dcf32ab 100644 --- a/keyboards/cipulot/ec_theca/rules.mk +++ b/keyboards/cipulot/ec_theca/rules.mk @@ -1,3 +1,4 @@ CUSTOM_MATRIX = lite -QUANTUM_LIB_SRC += analog.c SRC += matrix.c ec_switch_matrix.c + +ANALOG_DRIVER_REQUIRED = yes diff --git a/keyboards/cipulot/rf_r1_8_9xu/rules.mk b/keyboards/cipulot/rf_r1_8_9xu/rules.mk index ed348e8618..fc2dcf32ab 100644 --- a/keyboards/cipulot/rf_r1_8_9xu/rules.mk +++ b/keyboards/cipulot/rf_r1_8_9xu/rules.mk @@ -1,3 +1,4 @@ CUSTOM_MATRIX = lite -QUANTUM_LIB_SRC += analog.c SRC += matrix.c ec_switch_matrix.c + +ANALOG_DRIVER_REQUIRED = yes diff --git a/keyboards/drop/alt/v2/rules.mk b/keyboards/drop/alt/v2/rules.mk index a504f81cb1..3c300442da 100644 --- a/keyboards/drop/alt/v2/rules.mk +++ b/keyboards/drop/alt/v2/rules.mk @@ -1,4 +1,6 @@ UF2_DEVICE_TYPE_ID = 0x35446147 UF2CONV_ARGS = --device-type $(UF2_DEVICE_TYPE_ID) -SRC += analog.c lib/common.c lib/mux.c +SRC += lib/common.c lib/mux.c + +ANALOG_DRIVER_REQUIRED = yes diff --git a/keyboards/drop/ctrl/v2/rules.mk b/keyboards/drop/ctrl/v2/rules.mk index 13c11c1833..02a766b5c3 100644 --- a/keyboards/drop/ctrl/v2/rules.mk +++ b/keyboards/drop/ctrl/v2/rules.mk @@ -1,4 +1,6 @@ UF2_DEVICE_TYPE_ID = 0x27b9a6ea UF2CONV_ARGS = --device-type $(UF2_DEVICE_TYPE_ID) -SRC += analog.c lib/common.c lib/mux.c +SRC += lib/common.c lib/mux.c + +ANALOG_DRIVER_REQUIRED = yes diff --git a/keyboards/drop/shift/v2/rules.mk b/keyboards/drop/shift/v2/rules.mk index aec83326d0..f4f3ce1498 100644 --- a/keyboards/drop/shift/v2/rules.mk +++ b/keyboards/drop/shift/v2/rules.mk @@ -1,4 +1,6 @@ UF2_DEVICE_TYPE_ID = 0x9bc1e968 UF2CONV_ARGS = --device-type $(UF2_DEVICE_TYPE_ID) -SRC += analog.c lib/common.c lib/mux.c +SRC += lib/common.c lib/mux.c + +ANALOG_DRIVER_REQUIRED = yes diff --git a/keyboards/gmmk/numpad/rules.mk b/keyboards/gmmk/numpad/rules.mk index e30aa52954..d289eb81a4 100644 --- a/keyboards/gmmk/numpad/rules.mk +++ b/keyboards/gmmk/numpad/rules.mk @@ -18,5 +18,6 @@ RGB_MATRIX_ENABLE = yes LTO_ENABLE = yes -SRC += analog.c \ - matrix.c \ No newline at end of file +ANALOG_DRIVER_REQUIRED = yes + +SRC += matrix.c diff --git a/keyboards/handwired/battleship_gamepad/rules.mk b/keyboards/handwired/battleship_gamepad/rules.mk index 7422e73873..a41273f890 100644 --- a/keyboards/handwired/battleship_gamepad/rules.mk +++ b/keyboards/handwired/battleship_gamepad/rules.mk @@ -1,5 +1,3 @@ -SRC += analog.c - # Build Options # change yes to no to disable # diff --git a/keyboards/handwired/onekey/keymaps/adc/rules.mk b/keyboards/handwired/onekey/keymaps/adc/rules.mk index a691d5488f..8b36baccb0 100644 --- a/keyboards/handwired/onekey/keymaps/adc/rules.mk +++ b/keyboards/handwired/onekey/keymaps/adc/rules.mk @@ -1,3 +1,3 @@ -SRC += analog.c - CONSOLE_ENABLE = yes + +ANALOG_DRIVER_REQUIRED = yes diff --git a/keyboards/handwired/onekey/nucleo_f446re/rules.mk b/keyboards/handwired/onekey/nucleo_f446re/rules.mk index 8515c3fae0..e69de29bb2 100644 --- a/keyboards/handwired/onekey/nucleo_f446re/rules.mk +++ b/keyboards/handwired/onekey/nucleo_f446re/rules.mk @@ -1 +0,0 @@ -SRC += analog.c diff --git a/keyboards/handwired/promethium/rules.mk b/keyboards/handwired/promethium/rules.mk index 609c4d0e7e..d6b97ed810 100644 --- a/keyboards/handwired/promethium/rules.mk +++ b/keyboards/handwired/promethium/rules.mk @@ -18,10 +18,11 @@ PS2_ENABLE = yes PS2_DRIVER = interrupt CUSTOM_MATRIX = yes BLUETOOTH_ENABLE = yes + WS2812_DRIVER_REQUIRED = yes +ANALOG_DRIVER_REQUIRED = yes SRC += rgbsps.c -SRC += analog.c SRC += matrix.c LTO_ENABLE = yes diff --git a/keyboards/keebwerk/nano_slider/rules.mk b/keyboards/keebwerk/nano_slider/rules.mk index a7fcafd4b9..d133bb6d6e 100644 --- a/keyboards/keebwerk/nano_slider/rules.mk +++ b/keyboards/keebwerk/nano_slider/rules.mk @@ -13,4 +13,4 @@ MIDI_ENABLE = yes # MIDI support AUDIO_ENABLE = no # Audio output LTO_ENABLE = yes -SRC += analog.c +ANALOG_DRIVER_REQUIRED = yes diff --git a/keyboards/lime/keymaps/default/rules.mk b/keyboards/lime/keymaps/default/rules.mk index b4572ce79a..dd69af3a2e 100644 --- a/keyboards/lime/keymaps/default/rules.mk +++ b/keyboards/lime/keymaps/default/rules.mk @@ -5,5 +5,3 @@ JOYSTICK_DRIVER = analog EXTRAKEY_ENABLE = yes WPM_ENABLE = yes LTO_ENABLE = yes - -SRC += analog.c diff --git a/keyboards/ploopyco/mouse/rules.mk b/keyboards/ploopyco/mouse/rules.mk index 8d62f78ed7..17df9cc3c9 100644 --- a/keyboards/ploopyco/mouse/rules.mk +++ b/keyboards/ploopyco/mouse/rules.mk @@ -19,5 +19,6 @@ MOUSEKEY_ENABLE = yes # Mouse keys ENCODER_ENABLE := no OPTS_DEF += -DENCODER_ENABLE -QUANTUM_LIB_SRC += analog.c +ANALOG_DRIVER_REQUIRED = yes + SRC += opt_encoder.c diff --git a/keyboards/ploopyco/trackball/rules.mk b/keyboards/ploopyco/trackball/rules.mk index 0f5f3f648f..ce7c4f29c8 100644 --- a/keyboards/ploopyco/trackball/rules.mk +++ b/keyboards/ploopyco/trackball/rules.mk @@ -19,7 +19,8 @@ MOUSEKEY_ENABLE = yes # Mouse keys ENCODER_ENABLE := no OPTS_DEF += -DENCODER_ENABLE -QUANTUM_LIB_SRC += analog.c +ANALOG_DRIVER_REQUIRED = yes + SRC += opt_encoder.c DEFAULT_FOLDER = ploopyco/trackball/rev1_005 diff --git a/keyboards/ploopyco/trackball_mini/rules.mk b/keyboards/ploopyco/trackball_mini/rules.mk index d7016929c9..bcede0676c 100644 --- a/keyboards/ploopyco/trackball_mini/rules.mk +++ b/keyboards/ploopyco/trackball_mini/rules.mk @@ -16,7 +16,8 @@ MOUSEKEY_ENABLE = yes # Mouse keys ENCODER_ENABLE := no OPTS_DEF += -DENCODER_ENABLE -QUANTUM_LIB_SRC += analog.c +ANALOG_DRIVER_REQUIRED = yes + SRC += opt_encoder.c DEFAULT_FOLDER = ploopyco/trackball_mini/rev1_001 diff --git a/keyboards/ploopyco/trackball_thumb/rules.mk b/keyboards/ploopyco/trackball_thumb/rules.mk index 4a16c0abfb..6b82d7734b 100644 --- a/keyboards/ploopyco/trackball_thumb/rules.mk +++ b/keyboards/ploopyco/trackball_thumb/rules.mk @@ -3,7 +3,8 @@ F_CPU = 8000000 POINTING_DEVICE_DRIVER = pmw3360 -QUANTUM_LIB_SRC += analog.c +ANALOG_DRIVER_REQUIRED = yes + SRC += opt_encoder.c DEFAULT_FOLDER = ploopyco/trackball_thumb/rev1_001 diff --git a/keyboards/sekigon/grs_70ec/rules.mk b/keyboards/sekigon/grs_70ec/rules.mk index 00931a551e..4bd93ef25b 100644 --- a/keyboards/sekigon/grs_70ec/rules.mk +++ b/keyboards/sekigon/grs_70ec/rules.mk @@ -13,4 +13,6 @@ AUDIO_ENABLE = no # Audio output CUSTOM_MATRIX = lite SPLIT_KEYBOARD = yes -SRC += analog.c ec_switch_matrix.c matrix.c +ANALOG_DRIVER_REQUIRED = yes + +SRC += ec_switch_matrix.c matrix.c diff --git a/keyboards/splitkb/kyria/keymaps/gotham/rules.mk b/keyboards/splitkb/kyria/keymaps/gotham/rules.mk index eff9494ff1..00b2868c1f 100644 --- a/keyboards/splitkb/kyria/keymaps/gotham/rules.mk +++ b/keyboards/splitkb/kyria/keymaps/gotham/rules.mk @@ -14,9 +14,9 @@ ifeq ($(strip $(OLED_ENABLE)), yes) endif ifeq ($(strip $(THUMBSTICK_ENABLE)), yes) + ANALOG_DRIVER_REQUIRED = yes POINTING_DEVICE_ENABLE = yes POINTING_DEVICE_DRIVER = custom OPT_DEFS += -DTHUMBSTICK_ENABLE - SRC += analog.c SRC += thumbstick.c endif diff --git a/keyboards/tzarc/ghoul/rules.mk b/keyboards/tzarc/ghoul/rules.mk index 5efa406e26..4bf96d9824 100644 --- a/keyboards/tzarc/ghoul/rules.mk +++ b/keyboards/tzarc/ghoul/rules.mk @@ -3,4 +3,4 @@ QUANTUM_PAINTER_DRIVERS = ssd1351_spi DEFAULT_FOLDER = tzarc/ghoul/rev1/stm32 -SRC += analog.c +ANALOG_DRIVER_REQUIRED = yes diff --git a/keyboards/ungodly/launch_pad/rules.mk b/keyboards/ungodly/launch_pad/rules.mk index 9354144466..31fabc928c 100644 --- a/keyboards/ungodly/launch_pad/rules.mk +++ b/keyboards/ungodly/launch_pad/rules.mk @@ -19,4 +19,4 @@ MAGIC_ENABLE = no GRAVE_ESC_ENABLE = no LTO_ENABLE = yes -SRC += analog.c +ANALOG_DRIVER_REQUIRED = yes diff --git a/keyboards/v4n4g0rth0n/v2/rules.mk b/keyboards/v4n4g0rth0n/v2/rules.mk index b63f456708..0114504486 100644 --- a/keyboards/v4n4g0rth0n/v2/rules.mk +++ b/keyboards/v4n4g0rth0n/v2/rules.mk @@ -11,5 +11,4 @@ BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow AUDIO_ENABLE = no # Audio output -SRC += analog.c - +ANALOG_DRIVER_REQUIRED = yes diff --git a/keyboards/viktus/minne_topre/rules.mk b/keyboards/viktus/minne_topre/rules.mk index 037e26c530..b86fee73da 100644 --- a/keyboards/viktus/minne_topre/rules.mk +++ b/keyboards/viktus/minne_topre/rules.mk @@ -1,3 +1,4 @@ CUSTOM_MATRIX = lite -QUANTUM_LIB_SRC += analog.c SRC += ec.c + +ANALOG_DRIVER_REQUIRED = yes diff --git a/keyboards/viktus/osav2_numpad_topre/rules.mk b/keyboards/viktus/osav2_numpad_topre/rules.mk index 037e26c530..b86fee73da 100644 --- a/keyboards/viktus/osav2_numpad_topre/rules.mk +++ b/keyboards/viktus/osav2_numpad_topre/rules.mk @@ -1,3 +1,4 @@ CUSTOM_MATRIX = lite -QUANTUM_LIB_SRC += analog.c SRC += ec.c + +ANALOG_DRIVER_REQUIRED = yes diff --git a/keyboards/viktus/osav2_topre/rules.mk b/keyboards/viktus/osav2_topre/rules.mk index 037e26c530..b86fee73da 100644 --- a/keyboards/viktus/osav2_topre/rules.mk +++ b/keyboards/viktus/osav2_topre/rules.mk @@ -1,3 +1,4 @@ CUSTOM_MATRIX = lite -QUANTUM_LIB_SRC += analog.c SRC += ec.c + +ANALOG_DRIVER_REQUIRED = yes diff --git a/keyboards/viktus/styrka_topre/rules.mk b/keyboards/viktus/styrka_topre/rules.mk index 037e26c530..b86fee73da 100644 --- a/keyboards/viktus/styrka_topre/rules.mk +++ b/keyboards/viktus/styrka_topre/rules.mk @@ -1,3 +1,4 @@ CUSTOM_MATRIX = lite -QUANTUM_LIB_SRC += analog.c SRC += ec.c + +ANALOG_DRIVER_REQUIRED = yes