31 lines
747 B
C
31 lines
747 B
C
|
#pragma once
|
||
|
|
||
|
#include <zephyr/drivers/i2c.h>
|
||
|
#include <zephyr/drivers/gpio.h>
|
||
|
|
||
|
#define SCD30_READ_DELAY K_MSEC(3)
|
||
|
|
||
|
#define SCD30_CMD_START 0x0010
|
||
|
#define SCD30_CMD_STOP 0x0104
|
||
|
#define SCD30_CMD_INTERVAL 0x4600
|
||
|
#define SCD30_CMD_CHECK_DATA_READY 0x0202
|
||
|
#define SCD30_CMD_READ_MEASUREMENT 0x0300
|
||
|
#define SCD30_CMD_ASC 0x5306
|
||
|
#define SCD30_CMD_SET_TEMP_OFFSET 0x5403
|
||
|
#define SCD30_CMD_SET_ALTITUDE 0x5102
|
||
|
#define SCD30_CMD_READ_VERSION 0xd100
|
||
|
#define SCD30_CMD_SOFT_RESET 0xd304
|
||
|
|
||
|
struct scd30_config {
|
||
|
struct i2c_dt_spec bus;
|
||
|
struct gpio_dt_spec rdy_gpio;
|
||
|
uint8_t asc_enabled;
|
||
|
uint16_t sampling_interval;
|
||
|
};
|
||
|
|
||
|
struct scd30_data {
|
||
|
float t_sample;
|
||
|
float rh_sample;
|
||
|
float co2_sample;
|
||
|
};
|