From ed23d0e97fffab797361ae54dc36d5c7f42a2762 Mon Sep 17 00:00:00 2001 From: leo Date: Tue, 20 Dec 2022 11:01:33 +0100 Subject: [PATCH] MMC56x3 temp --- components/MMC56x3/MMC56x3.c | 16 ++++++++++++++++ components/MMC56x3/MMC56x3_hal.c | 15 +++++++++++++++ components/MMC56x3/include/MMC56x3_hal.h | 6 +++++- main/CO2_Sense.c | 8 ++++++-- 4 files changed, 42 insertions(+), 3 deletions(-) diff --git a/components/MMC56x3/MMC56x3.c b/components/MMC56x3/MMC56x3.c index bc4f3e3..8ac03b3 100644 --- a/components/MMC56x3/MMC56x3.c +++ b/components/MMC56x3/MMC56x3.c @@ -1,10 +1,17 @@ +#include #include #include "MMC56x3.h" #include "MMC56x3_hal.h" #include "esp_err.h" +#include "esp_log.h" #define PRODUCT_ID_1 0x39 #define TEMPERATURE 0x09 +#define IC0 0x1B +#define STATUS1 0x18 + +#define TAKE_MEAS_T 1 +#define MEAS_T_DONE 7 esp_err_t MMC56x3_get_product_ID(uint8_t* id){ ESP_ERROR_CHECK(i2c_read_reg(PRODUCT_ID_1, id, 1)); @@ -12,6 +19,15 @@ esp_err_t MMC56x3_get_product_ID(uint8_t* id){ } esp_err_t MMC56x3_get_temperature(uint8_t* temp){ + uint8_t startMeas = 1<battery_conf); uint8_t id=0; MMC56x3_get_product_ID(&id); + uint8_t temp; + MMC56x3_get_temperature(&temp); ESP_LOGI("MAIN", "MMC5603 product id %d", id); + ESP_LOGI("MAIN", "MMC measured temp is %d", temp); + init_scd4x(); + scd4x_power_down(); switch(conf->sensor->mode){ case SCD4X_NORMAL_MODE: ESP_ERROR_CHECK(scd4x_start_periodic_measurement());