From 55e1ccc3c9cb917bbbb70b4c13b6ccb26b8e4221 Mon Sep 17 00:00:00 2001
From: TamTamHero <10632523+TamtamHero@users.noreply.github.com>
Date: Sun, 13 Apr 2025 14:03:46 +0200
Subject: [PATCH] Expose reset function for external use

---
 bmx280.c         | 12 ++++++------
 include/bmx280.h |  6 ++++++
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/bmx280.c b/bmx280.c
index ba29c94..cdabcfc 100644
--- a/bmx280.c
+++ b/bmx280.c
@@ -338,12 +338,6 @@ static esp_err_t bmx280_probe(bmx280_t *bmx280)
     #endif
 }
 
-static esp_err_t bmx280_reset(bmx280_t *bmx280)
-{
-    const static uint8_t din[] = { BMX280_RESET_VEC };
-    return bmx280_write(bmx280, BMX280_REG_RESET, din, sizeof din);
-}
-
 static esp_err_t bmx280_calibrate(bmx280_t *bmx280)
 {
     // Honestly, the best course of action is to read the high and low banks
@@ -448,6 +442,12 @@ bmx280_t* bmx280_create_master(i2c_master_bus_handle_t bus_handle)
 }
 #endif
 
+esp_err_t bmx280_reset(bmx280_t *bmx280)
+{
+    const static uint8_t din[] = { BMX280_RESET_VEC };
+    return bmx280_write(bmx280, BMX280_REG_RESET, din, sizeof din);
+}
+
 void bmx280_close(bmx280_t *bmx280)
 {
     #if CONFIG_USE_I2C_MASTER_DRIVER
diff --git a/include/bmx280.h b/include/bmx280.h
index 2333d16..2f8118b 100644
--- a/include/bmx280.h
+++ b/include/bmx280.h
@@ -57,6 +57,12 @@ BMXAPI bmx280_t* bmx280_create_legacy(i2c_port_t port);
 #define bmx280_create_master(port) static_assert(0, "You have the wrong driver configuration for using the new I2C master driver.")
 #endif
 
+/**
+ * Restart the sensor, effectively puting it into sleep mode.
+ * @param bmx280 The instance to reset.
+ */
+esp_err_t bmx280_reset(bmx280_t *bmx280);
+
 /**
  * Destroy your the instance.
  * @param bmx280 The instance to destroy.