#ifndef SCD30_H #define SCD30_H #include #include "driver/i2c_master.h" // Data structure to hold SCD30 sensor data typedef struct { float co2; // CO2 concentration in ppm float temp; // Temperature in degrees Celsius float humidity; // Relative humidity in percentage } scd30_data_t; typedef struct { i2c_master_bus_handle_t bus_handle; i2c_master_dev_handle_t dev_handle; } scd30_handle_t; /** * @brief Initialize the SCD30 sensor * * @param sda_gpio SDA GPIO number * @param scl_gpio SCL GPIO number * @return scd30_handle_t* Pointer to the sensor handle */ scd30_handle_t *scd30_init(int sda_gpio, int scl_gpio); /** * @brief Start continuous measurement * * @param handle Sensor handle */ void scd30_start_measurement(scd30_handle_t *handle); /** * @brief Read data from the SCD30 sensor * * @param handle Sensor handle * @param data Pointer to store the read data * @return int 0 on success, -1 on error */ int scd30_read_data(scd30_handle_t *handle, scd30_data_t *data); #endif // SCD30_H