Loading...
Searching...
No Matches
hm330x.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2021 Inria
3 *
4 * This file is subject to the terms and conditions of the GNU Lesser
5 * General Public License v2.1. See the file LICENSE in the top level
6 * directory for more details.
7 */
8
33#ifndef HM330X_H
34#define HM330X_H
35
36#include "periph/i2c.h"
37#include "periph/gpio.h"
38
39#ifdef __cplusplus
40extern "C" {
41#endif
42
51#ifndef CONFIG_HM330X_INDOOR_ENVIRONMENT
52#define CONFIG_HM330X_INDOOR_ENVIRONMENT 1
53#endif
54
59typedef struct {
60 uint16_t mc_pm_1;
61 uint16_t mc_pm_2p5;
62 uint16_t mc_pm_10;
63 uint16_t amc_pm_1;
64 uint16_t amc_pm_2p5;
65 uint16_t amc_pm_10;
66#if IS_USED(MODULE_HM3302)
67 uint16_t nc_pm_0p3;
68 uint16_t nc_pm_0p5;
69 uint16_t nc_pm_1;
70 uint16_t nc_pm_2p5;
71 uint16_t nc_pm_5;
72 uint16_t nc_pm_10;
73#endif
75
79typedef struct {
81 gpio_t reset_pin;
82 gpio_t set_pin;
84
88typedef struct {
90} hm330x_t;
91
102int hm330x_init(hm330x_t *dev, const hm330x_params_t *params);
103
115
122
129
136
137#ifdef __cplusplus
138}
139#endif
140
141#endif /* HM330X_H */
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:151
Low-level I2C peripheral driver interface definition.
Set of measured particulate matter values as sent by the device.
Definition hm330x.h:59
uint16_t amc_pm_10
PM10 ug/m3 (atmospheric environment) <= 10µm [µg/m^3].
Definition hm330x.h:65
uint16_t amc_pm_2p5
PM2.5 ug/m3 (atmospheric environment) <= 2.5µm [µg/m^3].
Definition hm330x.h:64
uint16_t mc_pm_1
PM1.0 ug/m3 (ultrafine particles) <= 1µm [µg/m^3].
Definition hm330x.h:60
uint16_t mc_pm_2p5
PM2.5 ug/m3 (combustion particles, organic compounds, metals) <= 2.5µm [µg/m^3].
Definition hm330x.h:61
uint16_t mc_pm_10
PM10 ug/m3 (dust, pollen, mould spores) <= 10µm [µg/m^3].
Definition hm330x.h:62
uint16_t amc_pm_1
PM1.0 ug/m3 (atmospheric environment) <= 1µm [µg/m^3].
Definition hm330x.h:63
Device initialization parameters.
Definition hm330x.h:79
i2c_t i2c
The I2C device.
Definition hm330x.h:80
gpio_t set_pin
Set/Enable pin, active high.
Definition hm330x.h:82
gpio_t reset_pin
Reset pin, active low.
Definition hm330x.h:81
Device descriptor for the driver.
Definition hm330x.h:88
hm330x_params_t params
parameters of the sensor device
Definition hm330x.h:89