From 15c753b2aa1729a8a793ea2f1078dfe84e23d2e5 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 28 May 2021 15:51:30 +0200 Subject: driver configuration is now kconfig-first --- src/app/bme680-max44009-logger/Makefile.inc | 1 + src/app/button-and-motion-logger/Makefile.inc | 1 + src/app/ccs811test/Makefile.inc | 3 +- src/app/datalogger/main.cc | 58 +++++++++++++-------------- src/app/i2cbench/main.cc | 16 ++++---- src/app/luxlog/Makefile.inc | 1 + src/app/mpu9250_motionlog/Makefile.inc | 1 + src/app/nrf24l01test/Makefile.inc | 1 + src/app/sharp96-bad-apple/Makefile.inc | 1 + src/app/sharp96test/Makefile.inc | 1 + src/app/ssd1306-bad-apple/Makefile.inc | 1 + src/app/ssd1306test/Makefile.inc | 1 + 12 files changed, 48 insertions(+), 38 deletions(-) (limited to 'src') 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 -- cgit v1.2.3