Loading...
Searching...
No Matches
hsc.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2020 Deutsches Zentrum für Luft- und Raumfahrt e.V. (DLR)
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
22
23#include "saul.h"
24#include "periph/i2c.h"
25
26#ifdef __cplusplus
27extern "C" {
28#endif
29
33typedef struct {
35 uint8_t i2c_addr;
36 uint8_t hsc_range;
38
42typedef struct {
44} hsc_t;
45
56int hsc_init(hsc_t *dev, const hsc_params_t *params);
57
68int hsc_read_temperature(const hsc_t *dev, int16_t *dest);
69
80int hsc_read_pressure(const hsc_t *dev, int32_t *dest);
81
86#if !defined(CONFIG_HSC_I2C_ADDR) || defined(DOXYGEN)
87#define CONFIG_HSC_I2C_ADDR (0x28)
88#endif
89#if !defined(CONFIG_HSC_RANGE) || defined(DOXYGEN)
90#define CONFIG_HSC_RANGE (40U)
91#endif
93
94#ifdef __cplusplus
95}
96#endif
97
Definition of the generic [S]ensor [A]ctuator [U]ber [L]ayer.
int hsc_read_pressure(const hsc_t *dev, int32_t *dest)
Read pressure value from the given HSC device, returned in uBar.
int hsc_init(hsc_t *dev, const hsc_params_t *params)
Initialize the given HSC device.
int hsc_read_temperature(const hsc_t *dev, int16_t *dest)
Read temperature value from the given HSC device, returned in 0.1°C.
uint_fast8_t i2c_t
Default i2c_t type definition.
Definition i2c.h:155
Low-level I2C peripheral driver interface definition.
Device initialization parameters.
Definition hsc.h:33
uint8_t i2c_addr
I2C address.
Definition hsc.h:35
i2c_t i2c_dev
I2C device which is used.
Definition hsc.h:34
uint8_t hsc_range
Pressure range in mBar.
Definition hsc.h:36
Device descriptor for the HSC sensor.
Definition hsc.h:42
hsc_params_t params
Device initialization parameters.
Definition hsc.h:43