ds75lx.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2019 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 
23 #ifndef DS75LX_H
24 #define DS75LX_H
25 
26 #include "saul.h"
27 #include "periph/i2c.h"
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
36 typedef enum {
42 
46 typedef struct {
48  uint8_t addr;
51 
55 typedef struct {
57 } ds75lx_t;
58 
62 enum {
63  DS75LX_OK = 0,
65 };
66 
76 int ds75lx_init(ds75lx_t *dev, const ds75lx_params_t *params);
77 
87 int ds75lx_read_temperature(const ds75lx_t *dev, int16_t *temperature);
88 
97 int ds75lx_wakeup(const ds75lx_t *dev);
98 
107 int ds75lx_shutdown(const ds75lx_t *dev);
108 
109 #ifdef __cplusplus
110 }
111 #endif
112 
113 #endif /* DS75LX_H */
114 
ds75lx_resolution_t
ds75lx_resolution_t
Thermometer resolution.
Definition: ds75lx.h:36
DS75LX_RESOLUTION_10
@ DS75LX_RESOLUTION_10
10 bits resolution, 50ms max conversion time
Definition: ds75lx.h:38
DS75LX_RESOLUTION_11
@ DS75LX_RESOLUTION_11
11 bits resolution, 100ms max conversion time
Definition: ds75lx.h:39
i2c_t
unsigned int i2c_t
Default i2c_t type definition.
Definition: i2c.h:151
DS75LX_ERR_I2C
@ DS75LX_ERR_I2C
error when reading/writing I2C bus
Definition: ds75lx.h:64
ds75lx_wakeup
int ds75lx_wakeup(const ds75lx_t *dev)
Wakeup the sensor.
ds75lx_params_t::i2c
i2c_t i2c
I2C device which is used.
Definition: ds75lx.h:47
ds75lx_shutdown
int ds75lx_shutdown(const ds75lx_t *dev)
Shutdown the sensor.
ds75lx_init
int ds75lx_init(ds75lx_t *dev, const ds75lx_params_t *params)
Initialize the given DS75LX device.
ds75lx_params_t::addr
uint8_t addr
I2C address.
Definition: ds75lx.h:48
ds75lx_params_t::resolution
ds75lx_resolution_t resolution
Thermometer resolution.
Definition: ds75lx.h:49
DS75LX_OK
@ DS75LX_OK
everything was fine
Definition: ds75lx.h:63
saul.h
Definition of the generic [S]ensor [A]ctuator [U]ber [L]ayer.
ds75lx_read_temperature
int ds75lx_read_temperature(const ds75lx_t *dev, int16_t *temperature)
Read temperature value from the given DS75LX device, returned in c°C.
i2c.h
Low-level I2C peripheral driver interface definition.
ds75lx_t
Device descriptor for the DS75LX sensor.
Definition: ds75lx.h:55
DS75LX_RESOLUTION_12
@ DS75LX_RESOLUTION_12
12 bits resolution, 200ms max conversion time
Definition: ds75lx.h:40
ds75lx_t::params
ds75lx_params_t params
Device initialization parameters.
Definition: ds75lx.h:56
DS75LX_RESOLUTION_9
@ DS75LX_RESOLUTION_9
9 bits resolution, 25ms max conversion time
Definition: ds75lx.h:37
ds75lx_params_t
Device initialization parameters.
Definition: ds75lx.h:46