Skip to content

Commit e884e42

Browse files
authored
Generalise ADC driver source inclusion (#22448)
1 parent 786ebf8 commit e884e42

File tree

35 files changed

+69
-43
lines changed

35 files changed

+69
-43
lines changed

builddefs/common_features.mk

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,7 @@ ifeq ($(strip $(POINTING_DEVICE_ENABLE)), yes)
139139
ifeq ($(strip $(POINTING_DEVICE_DRIVER)), adns9800)
140140
SPI_DRIVER_REQUIRED = yes
141141
else ifeq ($(strip $(POINTING_DEVICE_DRIVER)), analog_joystick)
142-
OPT_DEFS += -DSTM32_ADC -DHAL_USE_ADC=TRUE
143-
LIB_SRC += analog.c
142+
ANALOG_DRIVER_REQUIRED = yes
144143
else ifeq ($(strip $(POINTING_DEVICE_DRIVER)), cirque_pinnacle_i2c)
145144
I2C_DRIVER_REQUIRED = yes
146145
SRC += drivers/sensors/cirque_pinnacle.c
@@ -840,8 +839,8 @@ ifeq ($(strip $(JOYSTICK_ENABLE)), yes)
840839
SRC += $(QUANTUM_DIR)/joystick.c
841840

842841
ifeq ($(strip $(JOYSTICK_DRIVER)), analog)
842+
ANALOG_DRIVER_REQUIRED = yes
843843
OPT_DEFS += -DANALOG_JOYSTICK_ENABLE
844-
SRC += analog.c
845844
endif
846845
ifeq ($(strip $(JOYSTICK_DRIVER)), digital)
847846
OPT_DEFS += -DDIGITAL_JOYSTICK_ENABLE
@@ -886,9 +885,9 @@ ifeq ($(strip $(BLUETOOTH_ENABLE)), yes)
886885

887886
ifeq ($(strip $(BLUETOOTH_DRIVER)), bluefruit_le)
888887
SPI_DRIVER_REQUIRED = yes
888+
ANALOG_DRIVER_REQUIRED = yes
889889
SRC += $(DRIVER_PATH)/bluetooth/bluetooth.c
890890
SRC += $(DRIVER_PATH)/bluetooth/bluefruit_le.cpp
891-
QUANTUM_LIB_SRC += analog.c
892891
endif
893892

894893
ifeq ($(strip $(BLUETOOTH_DRIVER)), rn42)
@@ -935,6 +934,11 @@ ifeq ($(strip $(APA102_DRIVER_REQUIRED)), yes)
935934
SRC += apa102.c
936935
endif
937936

937+
ifeq ($(strip $(ANALOG_DRIVER_REQUIRED)), yes)
938+
OPT_DEFS += -DHAL_USE_ADC=TRUE
939+
QUANTUM_LIB_SRC += analog.c
940+
endif
941+
938942
ifeq ($(strip $(I2C_DRIVER_REQUIRED)), yes)
939943
OPT_DEFS += -DHAL_USE_I2C=TRUE
940944
QUANTUM_LIB_SRC += i2c_master.c

docs/adc_driver.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ This driver currently supports both AVR and a limited selection of ARM devices.
99
To use this driver, add the following to your `rules.mk`:
1010

1111
```make
12-
SRC += analog.c
12+
ANALOG_DRIVER_REQUIRED = yes
1313
```
1414

1515
Then place this include at the top of your code:
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
SRC += analog.c
1+
ANALOG_DRIVER_REQUIRED = yes

keyboards/cipulot/ec_23u/rules.mk

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
CUSTOM_MATRIX = lite
2-
QUANTUM_LIB_SRC += analog.c
32
SRC += matrix.c ec_switch_matrix.c
3+
4+
ANALOG_DRIVER_REQUIRED = yes

keyboards/cipulot/ec_60/rules.mk

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
CUSTOM_MATRIX = lite
2-
QUANTUM_LIB_SRC += analog.c
32
SRC += matrix.c ec_switch_matrix.c
3+
4+
ANALOG_DRIVER_REQUIRED = yes
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
CUSTOM_MATRIX = lite
2-
QUANTUM_LIB_SRC += analog.c
32
SRC += matrix.c ec_switch_matrix.c
3+
4+
ANALOG_DRIVER_REQUIRED = yes
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
CUSTOM_MATRIX = lite
2-
QUANTUM_LIB_SRC += analog.c
32
SRC += matrix.c ec_switch_matrix.c
3+
4+
ANALOG_DRIVER_REQUIRED = yes

keyboards/cipulot/ec_pro2/rules.mk

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
CUSTOM_MATRIX = lite
2-
SRC += analog.c matrix.c ec_switch_matrix.c
2+
SRC += matrix.c ec_switch_matrix.c
3+
4+
ANALOG_DRIVER_REQUIRED = yes
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
CUSTOM_MATRIX = lite
2-
QUANTUM_LIB_SRC += analog.c
32
SRC += matrix.c ec_switch_matrix.c
3+
4+
ANALOG_DRIVER_REQUIRED = yes
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
CUSTOM_MATRIX = lite
2-
QUANTUM_LIB_SRC += analog.c
32
SRC += matrix.c ec_switch_matrix.c
3+
4+
ANALOG_DRIVER_REQUIRED = yes

0 commit comments

Comments
 (0)