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
9#pragma once
10
34
35#include "periph/i2c.h"
36#include "periph/gpio.h"
37
38#ifdef __cplusplus
39extern "C" {
40#endif
41
50#ifndef CONFIG_HM330X_INDOOR_ENVIRONMENT
51#define CONFIG_HM330X_INDOOR_ENVIRONMENT 1
52#endif
53
58typedef struct {
59 uint16_t mc_pm_1;
60 uint16_t mc_pm_2p5;
61 uint16_t mc_pm_10;
62 uint16_t amc_pm_1;
63 uint16_t amc_pm_2p5;
64 uint16_t amc_pm_10;
65#if IS_USED(MODULE_HM3302)
66 uint16_t nc_pm_0p3;
67 uint16_t nc_pm_0p5;
68 uint16_t nc_pm_1;
69 uint16_t nc_pm_2p5;
70 uint16_t nc_pm_5;
71 uint16_t nc_pm_10;
72#endif
74
78typedef struct {
80 gpio_t reset_pin;
81 gpio_t set_pin;
83
87typedef struct {
89} hm330x_t;
90
101int hm330x_init(hm330x_t *dev, const hm330x_params_t *params);
102
114
121
128
135
136#ifdef __cplusplus
137}
138#endif
139
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:144
Low-level I2C peripheral driver interface definition.
Set of measured particulate matter values as sent by the device.
Definition hm330x.h:58
uint16_t amc_pm_10
PM10 ug/m3 (atmospheric environment) <= 10µm [µg/m^3].
Definition hm330x.h:64
uint16_t amc_pm_2p5
PM2.5 ug/m3 (atmospheric environment) <= 2.5µm [µg/m^3].
Definition hm330x.h:63
uint16_t mc_pm_1
PM1.0 ug/m3 (ultrafine particles) <= 1µm [µg/m^3].
Definition hm330x.h:59
uint16_t mc_pm_2p5
PM2.5 ug/m3 (combustion particles, organic compounds, metals) <= 2.5µm [µg/m^3].
Definition hm330x.h:60
uint16_t mc_pm_10
PM10 ug/m3 (dust, pollen, mould spores) <= 10µm [µg/m^3].
Definition hm330x.h:61
uint16_t amc_pm_1
PM1.0 ug/m3 (atmospheric environment) <= 1µm [µg/m^3].
Definition hm330x.h:62
Device initialization parameters.
Definition hm330x.h:78
i2c_t i2c
The I2C device.
Definition hm330x.h:79
gpio_t set_pin
Set/Enable pin, active high.
Definition hm330x.h:81
gpio_t reset_pin
Reset pin, active low.
Definition hm330x.h:80
Device descriptor for the driver.
Definition hm330x.h:87
hm330x_params_t params
parameters of the sensor device
Definition hm330x.h:88