Skip to content

Commit

Permalink
Generalise ADC driver source inclusion (qmk#22448)
Browse files Browse the repository at this point in the history
  • Loading branch information
zvecr committed Nov 12, 2023
1 parent 786ebf8 commit e884e42
Show file tree
Hide file tree
Showing 35 changed files with 69 additions and 43 deletions.
12 changes: 8 additions & 4 deletions builddefs/common_features.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/adc_driver.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion keyboards/1upkeyboards/1upslider8/rules.mk
Original file line number Diff line number Diff line change
@@ -1 +1 @@
SRC += analog.c
ANALOG_DRIVER_REQUIRED = yes
3 changes: 2 additions & 1 deletion keyboards/cipulot/ec_23u/rules.mk
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
CUSTOM_MATRIX = lite
QUANTUM_LIB_SRC += analog.c
SRC += matrix.c ec_switch_matrix.c

ANALOG_DRIVER_REQUIRED = yes
3 changes: 2 additions & 1 deletion keyboards/cipulot/ec_60/rules.mk
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
CUSTOM_MATRIX = lite
QUANTUM_LIB_SRC += analog.c
SRC += matrix.c ec_switch_matrix.c

ANALOG_DRIVER_REQUIRED = yes
3 changes: 2 additions & 1 deletion keyboards/cipulot/ec_alveus/1_0_0/rules.mk
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
CUSTOM_MATRIX = lite
QUANTUM_LIB_SRC += analog.c
SRC += matrix.c ec_switch_matrix.c

ANALOG_DRIVER_REQUIRED = yes
3 changes: 2 additions & 1 deletion keyboards/cipulot/ec_alveus/1_2_0/rules.mk
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
CUSTOM_MATRIX = lite
QUANTUM_LIB_SRC += analog.c
SRC += matrix.c ec_switch_matrix.c

ANALOG_DRIVER_REQUIRED = yes
4 changes: 3 additions & 1 deletion keyboards/cipulot/ec_pro2/rules.mk
Original file line number Diff line number Diff line change
@@ -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
3 changes: 2 additions & 1 deletion keyboards/cipulot/ec_prox/ansi_iso/rules.mk
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
CUSTOM_MATRIX = lite
QUANTUM_LIB_SRC += analog.c
SRC += matrix.c ec_switch_matrix.c

ANALOG_DRIVER_REQUIRED = yes
3 changes: 2 additions & 1 deletion keyboards/cipulot/ec_prox/jis/rules.mk
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
CUSTOM_MATRIX = lite
QUANTUM_LIB_SRC += analog.c
SRC += matrix.c ec_switch_matrix.c

ANALOG_DRIVER_REQUIRED = yes
3 changes: 2 additions & 1 deletion keyboards/cipulot/ec_theca/rules.mk
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
CUSTOM_MATRIX = lite
QUANTUM_LIB_SRC += analog.c
SRC += matrix.c ec_switch_matrix.c

ANALOG_DRIVER_REQUIRED = yes
3 changes: 2 additions & 1 deletion keyboards/cipulot/rf_r1_8_9xu/rules.mk
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
CUSTOM_MATRIX = lite
QUANTUM_LIB_SRC += analog.c
SRC += matrix.c ec_switch_matrix.c

ANALOG_DRIVER_REQUIRED = yes
4 changes: 3 additions & 1 deletion keyboards/drop/alt/v2/rules.mk
Original file line number Diff line number Diff line change
@@ -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
4 changes: 3 additions & 1 deletion keyboards/drop/ctrl/v2/rules.mk
Original file line number Diff line number Diff line change
@@ -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
4 changes: 3 additions & 1 deletion keyboards/drop/shift/v2/rules.mk
Original file line number Diff line number Diff line change
@@ -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
5 changes: 3 additions & 2 deletions keyboards/gmmk/numpad/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ RGB_MATRIX_ENABLE = yes

LTO_ENABLE = yes

SRC += analog.c \
matrix.c
ANALOG_DRIVER_REQUIRED = yes

SRC += matrix.c
2 changes: 0 additions & 2 deletions keyboards/handwired/battleship_gamepad/rules.mk
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
SRC += analog.c

# Build Options
# change yes to no to disable
#
Expand Down
4 changes: 2 additions & 2 deletions keyboards/handwired/onekey/keymaps/adc/rules.mk
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
SRC += analog.c

CONSOLE_ENABLE = yes

ANALOG_DRIVER_REQUIRED = yes
1 change: 0 additions & 1 deletion keyboards/handwired/onekey/nucleo_f446re/rules.mk
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
SRC += analog.c
3 changes: 2 additions & 1 deletion keyboards/handwired/promethium/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion keyboards/keebwerk/nano_slider/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ MIDI_ENABLE = yes # MIDI support
AUDIO_ENABLE = no # Audio output
LTO_ENABLE = yes

SRC += analog.c
ANALOG_DRIVER_REQUIRED = yes
2 changes: 0 additions & 2 deletions keyboards/lime/keymaps/default/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ JOYSTICK_DRIVER = analog
EXTRAKEY_ENABLE = yes
WPM_ENABLE = yes
LTO_ENABLE = yes

SRC += analog.c
3 changes: 2 additions & 1 deletion keyboards/ploopyco/mouse/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 2 additions & 1 deletion keyboards/ploopyco/trackball/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 2 additions & 1 deletion keyboards/ploopyco/trackball_mini/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 2 additions & 1 deletion keyboards/ploopyco/trackball_thumb/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 3 additions & 1 deletion keyboards/sekigon/grs_70ec/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion keyboards/splitkb/kyria/keymaps/gotham/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion keyboards/tzarc/ghoul/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ QUANTUM_PAINTER_DRIVERS = ssd1351_spi

DEFAULT_FOLDER = tzarc/ghoul/rev1/stm32

SRC += analog.c
ANALOG_DRIVER_REQUIRED = yes
2 changes: 1 addition & 1 deletion keyboards/ungodly/launch_pad/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ MAGIC_ENABLE = no
GRAVE_ESC_ENABLE = no
LTO_ENABLE = yes

SRC += analog.c
ANALOG_DRIVER_REQUIRED = yes
3 changes: 1 addition & 2 deletions keyboards/v4n4g0rth0n/v2/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 2 additions & 1 deletion keyboards/viktus/minne_topre/rules.mk
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
CUSTOM_MATRIX = lite
QUANTUM_LIB_SRC += analog.c
SRC += ec.c

ANALOG_DRIVER_REQUIRED = yes
3 changes: 2 additions & 1 deletion keyboards/viktus/osav2_numpad_topre/rules.mk
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
CUSTOM_MATRIX = lite
QUANTUM_LIB_SRC += analog.c
SRC += ec.c

ANALOG_DRIVER_REQUIRED = yes
3 changes: 2 additions & 1 deletion keyboards/viktus/osav2_topre/rules.mk
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
CUSTOM_MATRIX = lite
QUANTUM_LIB_SRC += analog.c
SRC += ec.c

ANALOG_DRIVER_REQUIRED = yes
3 changes: 2 additions & 1 deletion keyboards/viktus/styrka_topre/rules.mk
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
CUSTOM_MATRIX = lite
QUANTUM_LIB_SRC += analog.c
SRC += ec.c

ANALOG_DRIVER_REQUIRED = yes

0 comments on commit e884e42

Please sign in to comment.