From aa6ddc1c3d245816c46143af7d00471d84602091 Mon Sep 17 00:00:00 2001
From: m24024310 <mohamed.menacer@etu.univ-amu.fr>
Date: Thu, 13 Mar 2025 10:14:11 +0100
Subject: [PATCH] commit 3

---
 CMakeLists.txt                                |  14 +
 README.rst                                    |  23 ++
 .../adafruit_feather_m0_basic_proto.overlay   |  14 +
 boards/bbc_microbit_v2.overlay                |  66 ++++
 boards/intel_adl_crb.overlay                  |  13 +
 boards/intel_rpl_p_crb.overlay                |  13 +
 boards/rpi_pico.overlay                       |  10 +
 core                                          | Bin 0 -> 2171428864 bytes
 prj.conf                                      |  17 +
 src/main.c                                    | 294 ++++++++++++++++++
 10 files changed, 464 insertions(+)
 create mode 100644 CMakeLists.txt
 create mode 100644 README.rst
 create mode 100644 boards/adafruit_feather_m0_basic_proto.overlay
 create mode 100644 boards/bbc_microbit_v2.overlay
 create mode 100644 boards/intel_adl_crb.overlay
 create mode 100644 boards/intel_rpl_p_crb.overlay
 create mode 100644 boards/rpi_pico.overlay
 create mode 100644 core
 create mode 100644 prj.conf
 create mode 100644 src/main.c

diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..109c422
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,14 @@
+#
+# Copyright (c) 2023 Nordic Semiconductor ASA
+#
+# SPDX-License-Identifier: Apache-2.0
+
+cmake_minimum_required(VERSION 3.20.0)
+
+find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
+project(Projet)
+
+FILE(GLOB app_sources src/*.c)
+target_sources(app PRIVATE ${app_sources})
+
+target_include_directories(app PRIVATE include)
diff --git a/README.rst b/README.rst
new file mode 100644
index 0000000..8b91fb4
--- /dev/null
+++ b/README.rst
@@ -0,0 +1,23 @@
+.. _bluetooth-bthome-sensor-template-sample:
+
+Bluetooth: BTHome sensor template
+#################################
+
+Template for a `BTHome <https://bthome.io/>`_ sensor.
+
+Requirements
+************
+
+* A board with BLE support
+* A BTHome compatible listener, for example `Home Assistant <https://www.home-assistant.io/>`_ with the BTHome integration running.
+
+Building and Running
+********************
+
+This sample can be found under :zephyr_file:`samples/bluetooth/bthome_sensor_template` in the Zephyr tree.
+
+See :ref:`bluetooth samples section <bluetooth-samples>` for details.
+
+When the sample is running, navigate to Devices & Services under settings in Home
+Assistant. There you will be asked to configure the BTHome sensor if everything
+went well.
diff --git a/boards/adafruit_feather_m0_basic_proto.overlay b/boards/adafruit_feather_m0_basic_proto.overlay
new file mode 100644
index 0000000..ca73008
--- /dev/null
+++ b/boards/adafruit_feather_m0_basic_proto.overlay
@@ -0,0 +1,14 @@
+/*
+ * Copyright (c) 2020 Jacek Ozimek <jacek.ozmk@gmail.com>
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+ &feather_i2c {
+    bme280: bme280@76 {
+        /* 0x76 - SDO <-> GND */
+        /* 0x77 - SDO <-> VCC */
+        compatible = "bosch,bme280";
+        reg = <0x76>;
+    };
+};
\ No newline at end of file
diff --git a/boards/bbc_microbit_v2.overlay b/boards/bbc_microbit_v2.overlay
new file mode 100644
index 0000000..11d9220
--- /dev/null
+++ b/boards/bbc_microbit_v2.overlay
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2024 Centro de Inovacao EDGE
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+/ {
+	aliases {
+		adc0 = &adc;
+	};
+};
+
+&adc {
+	status="okay";
+	#address-cells = <1>;
+	#size-cells = <0>;
+
+	channel@0 {
+		reg = <0>;
+		zephyr,gain = "ADC_GAIN_1_6";
+		zephyr,reference = "ADC_REF_INTERNAL";
+		zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
+		zephyr,input-positive = <NRF_SAADC_VDD>;
+		zephyr,oversampling = <8>;
+	};
+};
+
+
+
+
+//------------
+
+&pinctrl {
+    spi1_default_alt: spi1_default_alt {
+        group1 {
+            psels = <NRF_PSEL(SPIM_SCK, 0, 17)>,  // P13 : SCL -> SPI Clock (SCK)
+                    <NRF_PSEL(SPIM_MOSI, 0, 13)>, // P15 : SDA -> SPI MOSI
+                    <NRF_PSEL(SPIM_MISO, 0, 1)>; // P14: SDO -> SPI MISO
+        };
+    };
+
+    spi1_sleep_alt: spi1_sleep_alt {
+        group1 {
+            psels = <NRF_PSEL(SPIM_SCK, 0, 17)>,  // P13 : SCL -> SPI Clock (SCK)
+                    <NRF_PSEL(SPIM_MOSI, 0, 13)>, // P15 : SDA -> SPI MOSI
+                    <NRF_PSEL(SPIM_MISO, 0, 1)>; // P14 : SDO -> SPI MISO
+            low-power-enable;
+        };
+    };
+};
+
+&spi1 {
+    compatible = "nordic,nrf-spi";
+    status = "okay";
+    pinctrl-0 = <&spi1_default_alt>;
+    pinctrl-1 = <&spi1_sleep_alt>;
+    pinctrl-names = "default", "sleep";
+    cs-gpios = <&gpio1 2 GPIO_ACTIVE_LOW>;  /* CSB connecté à P16 */
+
+    bme280@0 {
+        compatible = "bosch,bme280";
+        reg = <0>;
+        spi-max-frequency = <1000000>; /* conservatively set to 1MHz */
+        status = "okay";
+    };
+};
\ No newline at end of file
diff --git a/boards/intel_adl_crb.overlay b/boards/intel_adl_crb.overlay
new file mode 100644
index 0000000..6c4edf6
--- /dev/null
+++ b/boards/intel_adl_crb.overlay
@@ -0,0 +1,13 @@
+/*
+ * Copyright (c) 2023 Intel Corporation
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+ &i2c0 {
+    bme280@76 {
+        compatible = "bosch,bme280";
+        reg = <0x76>;
+        status = "okay";
+    };
+};
\ No newline at end of file
diff --git a/boards/intel_rpl_p_crb.overlay b/boards/intel_rpl_p_crb.overlay
new file mode 100644
index 0000000..cb3bf82
--- /dev/null
+++ b/boards/intel_rpl_p_crb.overlay
@@ -0,0 +1,13 @@
+/*
+ * Copyright (c) 2023 Intel Corporation
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+ &i2c1 {
+    bme280@76 {
+        compatible = "bosch,bme280";
+        reg = <0x76>;
+        status = "okay";
+    };
+};
\ No newline at end of file
diff --git a/boards/rpi_pico.overlay b/boards/rpi_pico.overlay
new file mode 100644
index 0000000..baa67d6
--- /dev/null
+++ b/boards/rpi_pico.overlay
@@ -0,0 +1,10 @@
+&spi0 {
+    status = "okay";
+    cs-gpios = <&gpio0 17 GPIO_ACTIVE_LOW>;
+    pinctrl-0 = <&spi0_default>;
+    bme280@0 {
+        compatible = "bosch,bme280";
+        reg = <0>;
+        spi-max-frequency = <1000000>; /* conservatively set to 1MHz */
+    };
+};
\ No newline at end of file
diff --git a/core b/core
new file mode 100644
index 0000000000000000000000000000000000000000..684467142d0835140df7ea2d5a2c07842fab7eee
GIT binary patch