Loading...
Searching...
No Matches
si70xx.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2016 Bas Stottelaar <basstottelaar@gmail.com>
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
31
32#include "periph/i2c.h"
33
34#ifdef __cplusplus
35extern "C" {
36#endif
37
41#if MODULE_SI7050 || MODULE_SI7051 || MODULE_SI7053 || MODULE_SI7054 || \
42 MODULE_SI7055
43/* Si705x sensors don't have a humidity sensor hardware, only temperature. */
44#define SI70XX_HAS_HUMIDITY_SENSOR 0
45#else
46#define SI70XX_HAS_HUMIDITY_SENSOR 1
47#endif
48
52enum {
56};
57
61typedef struct {
63 uint8_t address;
65
69typedef struct {
71} si70xx_t;
72
84int si70xx_init(si70xx_t *dev, const si70xx_params_t *params);
85
86#if SI70XX_HAS_HUMIDITY_SENSOR || DOXYGEN
96#endif /* SI70XX_HAS_HUMIDITY_SENSOR || DOXYGEN */
97
106
107#if SI70XX_HAS_HUMIDITY_SENSOR || DOXYGEN
118void si70xx_get_both(const si70xx_t *dev, uint16_t *humidity, int16_t *temperature);
119#endif /* SI70XX_HAS_HUMIDITY_SENSOR || DOXYGEN */
120
127uint64_t si70xx_get_serial(const si70xx_t *dev);
128
135uint8_t si70xx_get_id(const si70xx_t *dev);
136
143uint8_t si70xx_get_revision(const si70xx_t *dev);
144
145#ifdef __cplusplus
146}
147#endif
148
uint_fast8_t i2c_t
Default i2c_t type definition.
Definition i2c.h:155
uint8_t si70xx_get_revision(const si70xx_t *dev)
Read the firmware revision of the sensor.
void si70xx_get_both(const si70xx_t *dev, uint16_t *humidity, int16_t *temperature)
Read the relative humidity and temperature from the sensor.
int16_t si70xx_get_temperature(const si70xx_t *dev)
Read the current temperature from the sensor.
int si70xx_init(si70xx_t *dev, const si70xx_params_t *params)
Initialize and reset the sensor.
uint8_t si70xx_get_id(const si70xx_t *dev)
Read the sensor id, to identifier the sensor variant.
uint16_t si70xx_get_relative_humidity(const si70xx_t *dev)
Read the relative humidity from the sensor.
uint64_t si70xx_get_serial(const si70xx_t *dev)
Read the sensor serial number.
@ SI70XX_ERR_NODEV
No valid device found on I2C bus.
Definition si70xx.h:54
@ SI70XX_ERR_I2C
An error occurred when reading/writing on I2C bus.
Definition si70xx.h:55
@ SI70XX_OK
All OK.
Definition si70xx.h:53
Low-level I2C peripheral driver interface definition.
Device initialization parameters.
Definition si70xx.h:61
i2c_t i2c_dev
I2C bus the sensor is connected to.
Definition si70xx.h:62
uint8_t address
sensor address
Definition si70xx.h:63
Si70xx device descriptor.
Definition si70xx.h:69
si70xx_params_t params
Device parameters.
Definition si70xx.h:70