From fa90b5c2434cb4a0e2ae5b324ac99cb5fad333c9 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Thu, 22 Oct 2020 13:18:29 -0600 Subject: [PATCH] emul: spi: bmi160: Move to top-level directory This emulator currently only supports SPI. Before making it also support I2C, move it up a directory to avoid I2C uses missing it. Signed-off-by: Simon Glass --- subsys/emul/CMakeLists.txt | 4 ++++ subsys/emul/Kconfig | 11 +++++++++++ subsys/emul/{spi => }/emul_bmi160.c | 0 subsys/emul/spi/CMakeLists.txt | 2 -- subsys/emul/spi/Kconfig | 8 -------- 5 files changed, 15 insertions(+), 10 deletions(-) rename subsys/emul/{spi => }/emul_bmi160.c (100%) 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.