Loading...
Searching...
No Matches
hm330x.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2021 Inria
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
31
32#include "modules.h"
33#include "periph/i2c.h"
34#include "periph/gpio.h"
35
36#ifdef __cplusplus
37extern "C" {
38#endif
39
48#ifndef CONFIG_HM330X_INDOOR_ENVIRONMENT
49#define CONFIG_HM330X_INDOOR_ENVIRONMENT 1
50#endif
51
56typedef struct {
57 uint16_t mc_pm_1;
58 uint16_t mc_pm_2p5;
59 uint16_t mc_pm_10;
60 uint16_t amc_pm_1;
61 uint16_t amc_pm_2p5;
62 uint16_t amc_pm_10;
63#if IS_USED(MODULE_HM3302)
64 uint16_t nc_pm_0p3;
65 uint16_t nc_pm_0p5;
66 uint16_t nc_pm_1;
67 uint16_t nc_pm_2p5;
68 uint16_t nc_pm_5;
69 uint16_t nc_pm_10;
70#endif
72
76typedef struct {
78 gpio_t reset_pin;
79 gpio_t set_pin;
81
85typedef struct {
87} hm330x_t;
88
99int hm330x_init(hm330x_t *dev, const hm330x_params_t *params);
100
112
119
126
133
134#ifdef __cplusplus
135}
136#endif
137
Low-level GPIO peripheral driver interface definitions.
void hm330x_sleep(hm330x_t *dev)
Set Device to Sleep.
int hm330x_read(hm330x_t *dev, hm330x_data_t *data)
Read particle matter measurements.
void hm330x_wakeup(hm330x_t *dev)
Wakeup Device.
void hm330x_reset(hm330x_t *dev)
Reset the sensor.
int hm330x_init(hm330x_t *dev, const hm330x_params_t *params)
Initialize the given device.
uint_fast8_t i2c_t
Default i2c_t type definition.
Definition i2c.h:155
Low-level I2C peripheral driver interface definition.
Common macros and compiler attributes/pragmas configuration.
Set of measured particulate matter values as sent by the device.
Definition hm330x.h:56
uint16_t amc_pm_10
PM10 ug/m3 (atmospheric environment) <= 10µm [µg/m^3].
Definition hm330x.h:62
uint16_t amc_pm_2p5
PM2.5 ug/m3 (atmospheric environment) <= 2.5µm [µg/m^3].
Definition hm330x.h:61
uint16_t mc_pm_1
PM1.0 ug/m3 (ultrafine particles) <= 1µm [µg/m^3].
Definition hm330x.h:57
uint16_t mc_pm_2p5
PM2.5 ug/m3 (combustion particles, organic compounds, metals) <= 2.5µm [µg/m^3].
Definition hm330x.h:58
uint16_t mc_pm_10
PM10 ug/m3 (dust, pollen, mould spores) <= 10µm [µg/m^3].
Definition hm330x.h:59
uint16_t amc_pm_1
PM1.0 ug/m3 (atmospheric environment) <= 1µm [µg/m^3].
Definition hm330x.h:60
Device initialization parameters.
Definition hm330x.h:76
i2c_t i2c
The I2C device.
Definition hm330x.h:77
gpio_t set_pin
Set/Enable pin, active high.
Definition hm330x.h:79
gpio_t reset_pin
Reset pin, active low.
Definition hm330x.h:78
Device descriptor for the driver.
Definition hm330x.h:85
hm330x_params_t params
parameters of the sensor device
Definition hm330x.h:86