diff options
author | Daniel Friesel <daniel.friesel@uos.de> | 2021-05-28 15:51:30 +0200 |
---|---|---|
committer | Daniel Friesel <daniel.friesel@uos.de> | 2021-05-28 15:51:30 +0200 |
commit | 15c753b2aa1729a8a793ea2f1078dfe84e23d2e5 (patch) | |
tree | 832ea4c9292ebf75a0abcbfa82fd3006c1345880 | |
parent | 460ecf074d133cbe026cbddb7cf5fad1180c9831 (diff) |
driver configuration is now kconfig-first
-rw-r--r-- | Makefile | 113 | ||||
-rw-r--r-- | src/app/bme680-max44009-logger/Makefile.inc | 1 | ||||
-rw-r--r-- | src/app/button-and-motion-logger/Makefile.inc | 1 | ||||
-rw-r--r-- | src/app/ccs811test/Makefile.inc | 3 | ||||
-rw-r--r-- | src/app/datalogger/main.cc | 58 | ||||
-rw-r--r-- | src/app/i2cbench/main.cc | 16 | ||||
-rw-r--r-- | src/app/luxlog/Makefile.inc | 1 | ||||
-rw-r--r-- | src/app/mpu9250_motionlog/Makefile.inc | 1 | ||||
-rw-r--r-- | src/app/nrf24l01test/Makefile.inc | 1 | ||||
-rw-r--r-- | src/app/sharp96-bad-apple/Makefile.inc | 1 | ||||
-rw-r--r-- | src/app/sharp96test/Makefile.inc | 1 | ||||
-rw-r--r-- | src/app/ssd1306-bad-apple/Makefile.inc | 1 | ||||
-rw-r--r-- | src/app/ssd1306test/Makefile.inc | 1 |
13 files changed, 49 insertions, 150 deletions
@@ -44,176 +44,68 @@ ifneq (${stack_usage}, ) COMMON_FLAGS += -fstack-usage endif -# Allow .config driver entries to be overriddenvia commandline / environment - -ifneq ($(findstring dummy,${drivers}), ) - CONFIG_driver_dummy = y -endif - -ifneq ($(findstring lm75,${drivers}), ) - CONFIG_driver_lm75 = y -endif - -ifneq ($(findstring s5851a,${drivers}), ) - CONFIG_driver_s5851a = y -endif - -ifneq ($(findstring am2320,${drivers}), ) - CONFIG_driver_am2320 = y -endif - -ifneq ($(findstring bme280,${drivers}), ) - CONFIG_driver_bme280 = y -endif - -ifneq ($(findstring bme680,${drivers}), ) - CONFIG_driver_bme680 = y -endif - -ifneq ($(findstring ccs811,${drivers}), ) - CONFIG_driver_ccs811 = y -endif - -ifneq ($(findstring eeprom24lc64,${drivers}), ) - CONFIG_driver_eeprom24lc64 = y -endif - -ifneq ($(findstring max44006,${drivers}), ) - CONFIG_driver_max44006 = y -endif - -ifneq ($(findstring max44009,${drivers}), ) - CONFIG_driver_max44009 = y -endif - -ifneq ($(findstring hdc1080,${drivers}), ) - CONFIG_driver_hdc1080 = y -endif - -ifneq ($(findstring mpu9250,${drivers}), ) - CONFIG_driver_mpu9250 = y -endif - -ifneq ($(findstring mmsimple,${drivers}), ) - CONFIG_driver_mmsimple = y -endif - -ifneq ($(findstring mmsubstate,${drivers}), ) - CONFIG_driver_mmsubstate = y -endif - -ifneq ($(findstring nrf24l01,${drivers}), ) - CONFIG_driver_nrf24l01 = y -endif - -ifneq ($(findstring sharp96,${drivers}), ) - CONFIG_driver_sharp96 = y -endif - -ifneq ($(findstring ssd1306,${drivers}), ) - CONFIG_driver_ssd1306 = y -endif - -ifneq ($(findstring tsl2591,${drivers}), ) - CONFIG_driver_tsl2591 = y -endif - -ifneq ($(findstring scd4x,${drivers}), ) - CONFIG_driver_scd4x = y -endif - -ifneq ($(findstring resistive_load,${drivers}), ) - CONFIG_driver_resistive_load = y -endif - -ifneq ($(findstring aemr_transition_sync,${drivers}), ) - CONFIG_driver_aemr_transition_sync = y -endif - -ifneq ($(findstring softi2c,${drivers}), ) - CONFIG_driver_softi2c = y -endif - -# Load drivers - ifdef CONFIG_driver_dummy CXX_TARGETS += src/driver/dummy.cc - COMMON_FLAGS += -DDRIVER_DUMMY endif ifdef CONFIG_driver_lm75 CXX_TARGETS += src/driver/lm75.cc - COMMON_FLAGS += -DDRIVER_LM75 endif ifdef CONFIG_driver_s5851a CXX_TARGETS += src/driver/s5851a.cc - COMMON_FLAGS += -DDRIVER_S5851A endif ifdef CONFIG_driver_am2320 CXX_TARGETS += src/driver/am2320.cc - COMMON_FLAGS += -DDRIVER_AM2320 endif ifdef CONFIG_driver_bme280 CXX_TARGETS += src/driver/bme280.cc src/driver/bme680_util.cc - COMMON_FLAGS += -DDRIVER_BME280 endif ifdef CONFIG_driver_bme680 CXX_TARGETS += src/driver/bme680.cc src/driver/bme680_util.cc - COMMON_FLAGS += -DDRIVER_BME680 endif ifdef CONFIG_driver_ccs811 CXX_TARGETS += src/driver/ccs811.cc - COMMON_FLAGS += -DDRIVER_CCS811 endif ifdef CONFIG_driver_eeprom24lc64 CXX_TARGETS += src/driver/eeprom24lc64.cc - COMMON_FLAGS += -DDRIVER_EEPROM24LC64 endif ifdef CONFIG_driver_max44006 CXX_TARGETS += src/driver/max44006.cc - COMMON_FLAGS += -DDRIVER_MAX44006 endif ifdef CONFIG_driver_max44009 CXX_TARGETS += src/driver/max44009.cc - COMMON_FLAGS += -DDRIVER_MAX44009 endif ifdef CONFIG_driver_hdc1080 CXX_TARGETS += src/driver/hdc1080.cc - COMMON_FLAGS += -DDRIVER_HDC1080 endif ifdef CONFIG_driver_mpu9250 CXX_TARGETS += src/driver/mpu9250.cc - COMMON_FLAGS += -DDRIVER_MPU9250 endif ifdef CONFIG_driver_mmsimple CXX_TARGETS += src/driver/mmsimple.cc - COMMON_FLAGS += -DDRIVER_MMSIMPLE endif ifdef CONFIG_driver_mmsubstate CXX_TARGETS += src/driver/mmsubstate.cc - COMMON_FLAGS += -DDRIVER_MMSUBSTATE endif ifdef CONFIG_driver_tsl2591 CXX_TARGETS += src/driver/tsl2591.cc - COMMON_FLAGS += -DDRIVER_TSL2591 endif ifdef CONFIG_driver_scd4x CXX_TARGETS += src/driver/scd4x.cc - COMMON_FLAGS += -DDRIVER_SCD4X endif ifdef CONFIG_driver_nrf24l01 @@ -233,7 +125,6 @@ ifdef CONFIG_driver_nrf24l01 nrf24l01_cs_pin ?= pc0 nrf24l01_irq_pin ?= pc2 endif - COMMON_FLAGS += -DDRIVER_NRF24L01 COMMON_FLAGS += -DNRF24L01_EN_PIN=GPIO::${nrf24l01_en_pin} COMMON_FLAGS += -DNRF24L01_CS_PIN=GPIO::${nrf24l01_cs_pin} COMMON_FLAGS += -DNRF24L01_IRQ_PIN=GPIO::${nrf24l01_irq_pin} @@ -259,7 +150,7 @@ endif ifdef CONFIG_driver_ssd1306 CXX_TARGETS += src/driver/ssd1306.cc - COMMON_FLAGS += -DDRIVER_SSD1306 -DSSD1306_WIDTH=${CONFIG_driver_ssd1306_width} -DSSD1306_HEIGHT=${CONFIG_driver_ssd1306_height} + COMMON_FLAGS += -DSSD1306_WIDTH=${CONFIG_driver_ssd1306_width} -DSSD1306_HEIGHT=${CONFIG_driver_ssd1306_height} endif ifdef CONFIG_driver_resistive_load @@ -268,7 +159,6 @@ ifdef CONFIG_driver_resistive_load resistor2_pin ?= p3_1 resistor3_pin ?= p3_2 resistor4_pin ?= p3_3 - COMMON_FLAGS += -DDRIVER_RESISTIVE_LOAD COMMON_FLAGS += -DRESISTIVE_LOAD_PIN1=GPIO::${resistor1_pin} COMMON_FLAGS += -DRESISTIVE_LOAD_PIN2=GPIO::${resistor2_pin} COMMON_FLAGS += -DRESISTIVE_LOAD_PIN3=GPIO::${resistor3_pin} @@ -281,7 +171,6 @@ endif ifdef CONFIG_driver_softi2c CXX_TARGETS += src/driver/soft_i2c.cc - COMMON_FLAGS += -DCONFIG_driver_softi2c endif ifdef CONFIG_meta_driver_hardware_i2c diff --git a/src/app/bme680-max44009-logger/Makefile.inc b/src/app/bme680-max44009-logger/Makefile.inc index e31f936..98b37fe 100644 --- a/src/app/bme680-max44009-logger/Makefile.inc +++ b/src/app/bme680-max44009-logger/Makefile.inc @@ -9,6 +9,7 @@ ifdef app override arch_drivers += ,i2c CONFIG_driver_bme680 = y CONFIG_driver_max44009 = y + COMMON_FLAGS += -DCONFIG_driver_bme680 -DCONFIG_driver_max44009 endif COMMON_FLAGS += -DBME680_FLOAT_POINT_COMPENSATION diff --git a/src/app/button-and-motion-logger/Makefile.inc b/src/app/button-and-motion-logger/Makefile.inc index 369a0d8..65916ac 100644 --- a/src/app/button-and-motion-logger/Makefile.inc +++ b/src/app/button-and-motion-logger/Makefile.inc @@ -7,4 +7,5 @@ ifdef app override arch_drivers += ,adc,i2c CONFIG_driver_mpu9250 = y + COMMON_FLAGS += -DCONFIG_driver_mpu9250 endif diff --git a/src/app/ccs811test/Makefile.inc b/src/app/ccs811test/Makefile.inc index 3c0ee21..6ca8774 100644 --- a/src/app/ccs811test/Makefile.inc +++ b/src/app/ccs811test/Makefile.inc @@ -6,6 +6,7 @@ ifdef app override arch_drivers += ,i2c - CONFIG_driver_ccS811 = y + CONFIG_driver_ccs811 = y + COMMON_FLAGS += -DCONFIG_driver_ccs811 loop = 1 endif diff --git a/src/app/datalogger/main.cc b/src/app/datalogger/main.cc index 0119d27..2444c14 100644 --- a/src/app/datalogger/main.cc +++ b/src/app/datalogger/main.cc @@ -13,57 +13,57 @@ #include "driver/soft_i2c.h" #endif -#ifdef DRIVER_LM75 +#ifdef CONFIG_driver_lm75 #include "driver/lm75.h" #endif -#ifdef DRIVER_S5851A +#ifdef CONFIG_driver_s5851a #include "driver/s5851a.h" #endif -#ifdef DRIVER_AM2320 +#ifdef CONFIG_driver_am2320 #include "driver/am2320.h" #endif -#ifdef DRIVER_BME280 +#ifdef CONFIG_driver_bme280 #include "driver/bme280.h" #include "driver/bme680_util.h" #endif -#ifdef DRIVER_BME680 +#ifdef CONFIG_driver_bme680 #include "driver/bme680.h" #include "driver/bme680_util.h" #endif -#ifdef DRIVER_CCS811 +#ifdef CONFIG_driver_ccs811 #include "driver/ccs811.h" #endif -#ifdef DRIVER_MAX44009 +#ifdef CONFIG_driver_max44009 #include "driver/max44009.h" #endif -#ifdef DRIVER_HDC1080 +#ifdef CONFIG_driver_hdc1080 #include "driver/hdc1080.h" #endif -#ifdef DRIVER_MPU9250 +#ifdef CONFIG_driver_mpu9250 #include "driver/mpu9250.h" #endif -#ifdef DRIVER_TSL2591 +#ifdef CONFIG_driver_tsl2591 #include "driver/tsl2591.h" #endif -#ifdef DRIVER_SCD4X +#ifdef CONFIG_driver_scd4x #include "driver/scd4x.h" #endif void loop(void) { -#ifdef DRIVER_LM75 +#ifdef CONFIG_driver_lm75 kout << "temperature_celsius: "; kout.printf_float(lm75.getTemp()); kout << endl; #endif -#ifdef DRIVER_S5851A +#ifdef CONFIG_driver_s5851a kout << "temperature_celsius: "; kout.printf_float(s5851a.getTemp()); kout << endl; #endif -#ifdef DRIVER_AM2320 +#ifdef CONFIG_driver_am2320 am2320.read(); if (am2320.getStatus() == 0) { kout.printf_float(am2320.getTemp()); @@ -75,7 +75,7 @@ void loop(void) } #endif -#ifdef DRIVER_BME280 +#ifdef CONFIG_driver_bme280 struct bme280_data comp_data; int8_t rslt = bme280.getSensorData(BME280_ALL, &comp_data); kout << "BME280 read " << rslt << endl; @@ -84,7 +84,7 @@ void loop(void) kout << "BME280 pressure " << (float)comp_data.pressure / 100 << " Pa" << endl; #endif -#ifdef DRIVER_BME680 +#ifdef CONFIG_driver_bme680 struct bme680_field_data data; bme680.setSensorMode(); arch.delay_ms(250); @@ -95,7 +95,7 @@ void loop(void) kout << "BME680 gas resistance " << data.gas_resistance << endl; #endif -#ifdef DRIVER_CCS811 +#ifdef CONFIG_driver_ccs811 ccs811.read(); kout << bin; kout << "CCS811 status / error: " << ccs811.status << " / " << ccs811.error_id << endl; @@ -103,7 +103,7 @@ void loop(void) kout << "CCS811 tVOC / eCO₂ : " << ccs811.tvoc << " ppb / " << ccs811.eco2 << " ppm" << endl; #endif -#ifdef DRIVER_HDC1080 +#ifdef CONFIG_driver_hdc1080 /* hdc1080.heater(1); for (unsigned char i = 0; i < 50; i++) { @@ -114,7 +114,7 @@ void loop(void) kout << "HDC1080 humidity " << hdc1080.getRH() << " %H" << endl; #endif -#ifdef DRIVER_MPU9250 +#ifdef CONFIG_driver_mpu9250 int mx, my, mz; kout << "Temperature: " << mpu9250.getTemperature() << endl; kout << "Accel X " << mpu9250.getAccelX() << endl; @@ -129,18 +129,18 @@ void loop(void) kout << "Magnet Z " << mz << endl; #endif -#ifdef DRIVER_MAX44009 +#ifdef CONFIG_driver_max44009 kout.printf_float(max44009.getLux()); kout << endl; #endif -#ifdef DRIVER_TSL2591 +#ifdef CONFIG_driver_tsl2591 tsl2591.read(); kout << dec << "TSL2591 CH0: " << tsl2591.ch0 << " / CH1: " << tsl2591.ch1; kout << hex << " (status: 0x" << tsl2591.getStatus() << ")" << endl; #endif -#ifdef DRIVER_SCD4X +#ifdef CONFIG_driver_scd4x scd4x.read(); kout << dec << "CO₂: " << scd4x.co2 << " ppm" << endl; kout << "Temperature: "; @@ -167,7 +167,7 @@ int main(void) kout << "I2C setup OK" << endl; #endif -#ifdef DRIVER_BME280 +#ifdef CONFIG_driver_bme280 bme280.intf = BME280_I2C_INTF; bme280.read = bme680_i2c_read; bme280.write = bme680_i2c_write; @@ -186,7 +186,7 @@ int main(void) bme280.enterNormalMode(); #endif -#ifdef DRIVER_BME680 +#ifdef CONFIG_driver_bme680 bme680.intf = BME680_I2C_INTF; bme680.read = bme680_i2c_read; bme680.write = bme680_i2c_write; @@ -209,7 +209,7 @@ int main(void) bme680.setSensorSettings(BME680_OST_SEL | BME680_OSP_SEL | BME680_OSH_SEL | BME680_GAS_SENSOR_SEL); #endif -#ifdef DRIVER_CCS811 +#ifdef CONFIG_driver_ccs811 kout << hex; kout << "CCS811 HWID: " << ccs811.getManufacturerID() << endl; arch.delay_ms(65); @@ -223,22 +223,22 @@ int main(void) arch.delay_ms(50); #endif -#ifdef DRIVER_HDC1080 +#ifdef CONFIG_driver_hdc1080 hdc1080.init(); if (hdc1080.getManufacturerID() != 0x5449) { kout << "[!] invalid HDC1080 manufacturer ID: " << hex << hdc1080.getManufacturerID() << endl; } #endif -#ifdef DRIVER_MPU9250 +#ifdef CONFIG_driver_mpu9250 mpu9250.init(); #endif -#ifdef DRIVER_TSL2591 +#ifdef CONFIG_driver_tsl2591 tsl2591.init(); #endif -#ifdef DRIVER_SCD4X +#ifdef CONFIG_driver_scd4x scd4x.start(); #endif diff --git a/src/app/i2cbench/main.cc b/src/app/i2cbench/main.cc index db2ad51..ccc479b 100644 --- a/src/app/i2cbench/main.cc +++ b/src/app/i2cbench/main.cc @@ -11,19 +11,19 @@ #else #include "driver/soft_i2c.h" #endif -#ifdef DRIVER_LM75 +#ifdef CONFIG_driver_lm75 #include "driver/lm75.h" #endif -#ifdef DRIVER_AM2320 +#ifdef CONFIG_driver_am2320 #include "driver/am2320.h" #endif #ifdef DRIVER_EEPROM24LC64 #include "driver/eeprom24lc64.h" #endif -#ifdef DRIVER_MAX44009 +#ifdef CONFIG_driver_max44009 #include "driver/max44009.h" #endif -#ifdef DRIVER_MMSIMPLE +#ifdef CONFIG_driver_mmsimple #include "driver/mmsimple.h" #endif @@ -33,12 +33,12 @@ void loop(void) { -#ifdef DRIVER_LM75 +#ifdef CONFIG_driver_lm75 kout.printf_float(lm75.getTemp()); kout << endl; //lm75.setOS(I2CBENCH_SETOS); #endif -#ifdef DRIVER_AM2320 +#ifdef CONFIG_driver_am2320 am2320.read(); if (am2320.getStatus() == 0) { kout.printf_float(am2320.getTemp()); @@ -49,7 +49,7 @@ void loop(void) kout << "AM2320 error " << dec << am2320.getStatus() << endl; } #endif -#ifdef DRIVER_MAX44009 +#ifdef CONFIG_driver_max44009 kout.printf_float(max44009.getLux()); kout << endl; #endif @@ -59,7 +59,7 @@ void loop(void) kout << "Address " << page << endl; page = (page + 32) % (256*32); #endif -#ifdef DRIVER_MMSIMPLE +#ifdef CONFIG_driver_mmsimple moody.toggleBlue(); #endif } diff --git a/src/app/luxlog/Makefile.inc b/src/app/luxlog/Makefile.inc index 0d3e2df..cc27fd0 100644 --- a/src/app/luxlog/Makefile.inc +++ b/src/app/luxlog/Makefile.inc @@ -8,4 +8,5 @@ ifdef app loop = 1 override arch_drivers += ,i2c CONFIG_driver_max44009 = y + COMMON_FLAGS += -DCONFIG_driver_max44009 endif diff --git a/src/app/mpu9250_motionlog/Makefile.inc b/src/app/mpu9250_motionlog/Makefile.inc index 3ae4770..93b8d33 100644 --- a/src/app/mpu9250_motionlog/Makefile.inc +++ b/src/app/mpu9250_motionlog/Makefile.inc @@ -7,4 +7,5 @@ ifdef app override arch_drivers += ,i2c CONFIG_driver_mpu9250 = y + COMMON_FLAGS += -DCONFIG_driver_mpu9250 endif diff --git a/src/app/nrf24l01test/Makefile.inc b/src/app/nrf24l01test/Makefile.inc index 9e58868..58d2e6a 100644 --- a/src/app/nrf24l01test/Makefile.inc +++ b/src/app/nrf24l01test/Makefile.inc @@ -9,6 +9,7 @@ ifdef app override timer_s = 1 override arch_drivers += ,spi CONFIG_driver_nrf24l01 = y + COMMON_FLAGS += -DCONFIG_driver_nrf24l01 endif ifeq (${tx}, 1) diff --git a/src/app/sharp96-bad-apple/Makefile.inc b/src/app/sharp96-bad-apple/Makefile.inc index 703d341..d88ba11 100644 --- a/src/app/sharp96-bad-apple/Makefile.inc +++ b/src/app/sharp96-bad-apple/Makefile.inc @@ -7,6 +7,7 @@ ifdef app override arch_drivers += spi,timer CONFIG_driver_sharp96 = y + COMMON_FLAGS += -DCONFIG_driver_sharp96 CONFIG_lib_inflate = y CONFIG_lib_inflate_lut = y CONFIG_arch_msp430fr5994lp_large_mode = y diff --git a/src/app/sharp96test/Makefile.inc b/src/app/sharp96test/Makefile.inc index c8ffb78..0c2f449 100644 --- a/src/app/sharp96test/Makefile.inc +++ b/src/app/sharp96test/Makefile.inc @@ -8,4 +8,5 @@ ifdef app loop = 1 override arch_drivers += ,spi CONFIG_driver_sharp96 = y + COMMON_FLAGS += -DCONFIG_driver_sharp96 endif diff --git a/src/app/ssd1306-bad-apple/Makefile.inc b/src/app/ssd1306-bad-apple/Makefile.inc index bbe2db7..65cd435 100644 --- a/src/app/ssd1306-bad-apple/Makefile.inc +++ b/src/app/ssd1306-bad-apple/Makefile.inc @@ -7,6 +7,7 @@ ifdef app override arch_drivers += i2c,timer CONFIG_driver_ssd1306 = y + COMMON_FLAGS += -DCONFIG_driver_ssd1306 CONFIG_driver_ssd1306_width = 128 CONFIG_driver_ssd1306_height = 64 CONFIG_lib_inflate = y diff --git a/src/app/ssd1306test/Makefile.inc b/src/app/ssd1306test/Makefile.inc index ebdcbd8..8c4936b 100644 --- a/src/app/ssd1306test/Makefile.inc +++ b/src/app/ssd1306test/Makefile.inc @@ -8,6 +8,7 @@ ifdef app loop = 1 override arch_drivers += ,i2c CONFIG_driver_ssd1306 = y + COMMON_FLAGS += -DCONFIG_driver_ssd1306 CONFIG_driver_ssd1306_width = 128 CONFIG_driver_ssd1306_height = 64 endif |