From 6ea2ead13ee526449da483b99fe90d912b5e4e03 Mon Sep 17 00:00:00 2001 From: Artemis Tosini Date: Wed, 22 Nov 2023 21:31:59 +0000 Subject: [PATCH] Setup structure for scd30 driver --- CMakeLists.txt | 1 + Kconfig | 2 ++ boards/xtensa/minico2/minico2.dts | 10 ++++++++++ drivers/CMakeLists.txt | 1 + drivers/Kconfig | 3 +++ drivers/sensor/CMakeLists.txt | 1 + drivers/sensor/Kconfig | 3 +++ drivers/sensor/scd30/CMakeLists.txt | 3 +++ drivers/sensor/scd30/Kconfig | 8 ++++++++ drivers/sensor/scd30/scd30.c | 0 dts/bindings/sensirion,scd30.yaml | 3 +++ prj.conf | 1 + 12 files changed, 36 insertions(+) create mode 100644 Kconfig create mode 100644 drivers/CMakeLists.txt create mode 100644 drivers/Kconfig create mode 100644 drivers/sensor/CMakeLists.txt create mode 100644 drivers/sensor/Kconfig create mode 100644 drivers/sensor/scd30/CMakeLists.txt create mode 100644 drivers/sensor/scd30/Kconfig create mode 100644 drivers/sensor/scd30/scd30.c create mode 100644 dts/bindings/sensirion,scd30.yaml diff --git a/CMakeLists.txt b/CMakeLists.txt index 8d8ae89..a6f36ee 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,5 +6,6 @@ set(BOARD minico2) find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +add_subdirectory(drivers) project(minico2) target_sources(app PRIVATE src/main.c) diff --git a/Kconfig b/Kconfig new file mode 100644 index 0000000..cebb8ac --- /dev/null +++ b/Kconfig @@ -0,0 +1,2 @@ +source "Kconfig.zephyr" +rsource "drivers/Kconfig" diff --git a/boards/xtensa/minico2/minico2.dts b/boards/xtensa/minico2/minico2.dts index 9cca8cc..8b78b43 100644 --- a/boards/xtensa/minico2/minico2.dts +++ b/boards/xtensa/minico2/minico2.dts @@ -45,6 +45,15 @@ scl-gpios = <&gpio0 33 GPIO_OPEN_DRAIN>; pinctrl-0 = <&i2c0_default>; pinctrl-names = "default"; + + #address-cells = <1>; + #size-cells = <0>; + + scd30: scd30@61 { + status = "okay"; + compatible = "sensirion,scd30"; + reg = <0x61>; + }; }; &spi2 { @@ -56,6 +65,7 @@ #size-cells = <0>; epd: sd16xxfb@0 { + status = "okay"; compatible = "gooddisplay,gdey0213b74", "solomon,ssd1680"; spi-max-frequency = <4000000>; reg = <0>; diff --git a/drivers/CMakeLists.txt b/drivers/CMakeLists.txt new file mode 100644 index 0000000..3dc4e16 --- /dev/null +++ b/drivers/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory_ifdef(CONFIG_SENSOR sensor) diff --git a/drivers/Kconfig b/drivers/Kconfig new file mode 100644 index 0000000..9948023 --- /dev/null +++ b/drivers/Kconfig @@ -0,0 +1,3 @@ +menu "Drivers" +rsource "sensor/Kconfig" +endmenu diff --git a/drivers/sensor/CMakeLists.txt b/drivers/sensor/CMakeLists.txt new file mode 100644 index 0000000..073b8d9 --- /dev/null +++ b/drivers/sensor/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory_ifdef(CONFIG_SCD30 scd30) diff --git a/drivers/sensor/Kconfig b/drivers/sensor/Kconfig new file mode 100644 index 0000000..fdb5f50 --- /dev/null +++ b/drivers/sensor/Kconfig @@ -0,0 +1,3 @@ +if SENSOR +rsource "scd30/Kconfig" +endif diff --git a/drivers/sensor/scd30/CMakeLists.txt b/drivers/sensor/scd30/CMakeLists.txt new file mode 100644 index 0000000..315eab1 --- /dev/null +++ b/drivers/sensor/scd30/CMakeLists.txt @@ -0,0 +1,3 @@ +zephyr_library() + +zephyr_library_sources(scd30.c) diff --git a/drivers/sensor/scd30/Kconfig b/drivers/sensor/scd30/Kconfig new file mode 100644 index 0000000..13cc066 --- /dev/null +++ b/drivers/sensor/scd30/Kconfig @@ -0,0 +1,8 @@ +config SCD30 + bool "SCD30 CO2, Temperature, and Humidity Sensor" + default y + depends on DT_HAS_SENSIRION_SCD30_ENABLED + select I2C + select CRC + help + Enable driver for the SCD30 CO2, temperature, and humidity sensors. diff --git a/drivers/sensor/scd30/scd30.c b/drivers/sensor/scd30/scd30.c new file mode 100644 index 0000000..e69de29 diff --git a/dts/bindings/sensirion,scd30.yaml b/dts/bindings/sensirion,scd30.yaml new file mode 100644 index 0000000..338550a --- /dev/null +++ b/dts/bindings/sensirion,scd30.yaml @@ -0,0 +1,3 @@ +description: Sensirion SCD30 CO2, humidity, and temperature sensor +compatible: "sensirion,scd30" +include: [sensor-device.yaml, i2c-device.yaml] diff --git a/prj.conf b/prj.conf index 91c3c15..0af243e 100644 --- a/prj.conf +++ b/prj.conf @@ -1 +1,2 @@ +CONFIG_SENSOR=y CONFIG_GPIO=y