add test
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
#define SCD30_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include "driver/i2c_master.h"
|
||||
|
||||
// Data structure to hold SCD30 sensor data
|
||||
typedef struct {
|
||||
@@ -10,9 +11,34 @@ typedef struct {
|
||||
float humidity; // Relative humidity in percentage
|
||||
} scd30_data_t;
|
||||
|
||||
// Function prototypes
|
||||
void scd30_init(void);
|
||||
void scd30_start_measurement(void);
|
||||
int scd30_read_data(scd30_data_t *data);
|
||||
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
|
||||
Reference in New Issue
Block a user