diff --git a/subsys/emul/CMakeLists.txt b/subsys/emul/CMakeLists.txt index 93bd566828e..c759ea9a074 100644 --- a/subsys/emul/CMakeLists.txt +++ b/subsys/emul/CMakeLists.txt @@ -3,5 +3,9 @@ zephyr_library() zephyr_library_sources_ifdef(CONFIG_EMUL emul.c) + +zephyr_include_directories_ifdef(CONFIG_EMUL_BMI160 ${ZEPHYR_BASE}/drivers/sensor/bmi160) +zephyr_library_sources_ifdef(CONFIG_EMUL_BMI160 emul_bmi160.c) + add_subdirectory(i2c) add_subdirectory(spi) diff --git a/subsys/emul/Kconfig b/subsys/emul/Kconfig index 5ede4b16f2e..7cc3fd89d65 100644 --- a/subsys/emul/Kconfig +++ b/subsys/emul/Kconfig @@ -34,6 +34,17 @@ module = EMUL module-str = emul source "subsys/logging/Kconfig.template.log_config" +config EMUL_BMI160 + bool "Emulate a Bosch BMI160 accelerometer" + help + This is an emulator for the Bosch BMI160 accelerometer. + + It provides readings which follow a simple sequence, thus allowing + test code to check that things are working as expected. + + It supports both I2C and SPI which is why it is not in one of the + i2c/ or spi/ directories. + source "subsys/emul/i2c/Kconfig" source "subsys/emul/spi/Kconfig" diff --git a/subsys/emul/spi/emul_bmi160.c b/subsys/emul/emul_bmi160.c similarity index 100% rename from subsys/emul/spi/emul_bmi160.c rename to subsys/emul/emul_bmi160.c diff --git a/subsys/emul/spi/CMakeLists.txt b/subsys/emul/spi/CMakeLists.txt index bdbc3590eb1..7e6cf90c6b4 100644 --- a/subsys/emul/spi/CMakeLists.txt +++ b/subsys/emul/spi/CMakeLists.txt @@ -2,5 +2,3 @@ # Once we have more than 10 devices we should consider splitting them into # subdirectories to match the drivers/ structure. -zephyr_include_directories_ifdef(CONFIG_EMUL_BMI160 ${ZEPHYR_BASE}/drivers/sensor/bmi160) -zephyr_library_sources_ifdef(CONFIG_EMUL_BMI160 emul_bmi160.c) diff --git a/subsys/emul/spi/Kconfig b/subsys/emul/spi/Kconfig index ca524cceae8..3f18272e2da 100644 --- a/subsys/emul/spi/Kconfig +++ b/subsys/emul/spi/Kconfig @@ -2,11 +2,3 @@ # Copyright 2020 Google LLC # SPDX-License-Identifier: Apache-2.0 - -config EMUL_BMI160 - bool "Emulate a Bosch BMI160 accelerometer" - help - This is an emulator for the Bosch BMI160 accelerometer. - - It provides readings which follow a simple sequence, thus allowing - test code to check that things are working as expected.