Loading...
Searching...
No Matches
hsc.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2020 Deutsches Zentrum für Luft- und Raumfahrt e.V. (DLR)
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
26#include "saul.h"
27#include "periph/i2c.h"
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
36typedef struct {
38 uint8_t i2c_addr;
39 uint8_t hsc_range;
41
45typedef struct {
47} hsc_t;
48
59int hsc_init(hsc_t *dev, const hsc_params_t *params);
60
71int hsc_read_temperature(const hsc_t *dev, int16_t *dest);
72
83int hsc_read_pressure(const hsc_t *dev, int32_t *dest);
84
89#if !defined(CONFIG_HSC_I2C_ADDR) || defined(DOXYGEN)
90#define CONFIG_HSC_I2C_ADDR (0x28)
91#endif
92#if !defined(CONFIG_HSC_RANGE) || defined(DOXYGEN)
93#define CONFIG_HSC_RANGE (40U)
94#endif
97#ifdef __cplusplus
98}
99#endif
100
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:144
Low-level I2C peripheral driver interface definition.
Device initialization parameters.
Definition hsc.h:36
uint8_t i2c_addr
I2C address.
Definition hsc.h:38
i2c_t i2c_dev
I2C device which is used.
Definition hsc.h:37
uint8_t hsc_range
Pressure range in mBar.
Definition hsc.h:39
Device descriptor for the HSC sensor.
Definition hsc.h:45
hsc_params_t params
Device initialization parameters.
Definition hsc.h:46