KM3NeT CLB  2.0
KM3NeT CLB v2 Embedded Software
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
dpbasic.h
Go to the documentation of this file.
1 /*
2  * KM3NeT CLB v2 Firmware
3  * ----------------------
4  *
5  * Copyright 2013 KM3NeT Collaboration
6  *
7  * All Rights Reserved.
8  *
9  *
10  * File : dp_i2c.h
11  * Created : 21 mrt. 2013
12  * Author : Vincent van Beveren
13  */
14 
15 
16 #ifndef DPBASIC_H_
17 #define DPBASIC_H_
18 
19 /**
20  * @file
21  *
22  * @ingroup i2cdrivers
23  *
24  * This driver is to read the DigiPicco I2C sensor.
25  *
26  * Usage:
27  *
28  * @code
29  * DpbData data;
30  *
31  * if (!dpbRead(I2C2, DPB_I2C_ADR_DEFAULT, &data) return false; // error
32  *
33  * printf("Temperature: %d.%d C, Humidity: %d %% RH\n", data.temp / 10, data.temp % 10, data.humid);
34  *
35  * @endcode
36  *
37  *
38  * @note This driver is no longer used, as the dp-basic sensor is no longer used.
39  */
40 
41 
42 #include "drv/wb/i2c.h"
43 #include <stdint.h>
44 #include <errorcode.h>
45 
46 #define E_DPB_INVALID ( E_DPB + 1 ) ///!< Invalid readout value.
47 #define E_DPB_INVALID_DESCR "Invalid value"
48 
49 
50 #define DPB_I2C_ADR_DEFAULT 0x78
51 
52 #define DPB_MIN_TEMP_C -400 ///< Min value in DpbData.temp, in tenth of degrees.
53 #define DPB_MAX_TEMP_C 1250 ///< Max value in DpbData.temp, in tenth of degrees.
54 
55 #define DPB_MIN_HUMID_RH 0 ///< Min value in DpbData.humid, in percent RH.
56 #define DPB_MAN_HUMID_RH 100 ///< Max value in DpbData.humid, in percent RH.
57 
58 
59 
60 /**
61  * Structure defines data from the DigiPicco sensor.
62  *
63  * Values scaled to accurately represent the capabilities of the sensor. Temperature accuracy
64  * is +/- 0.5 deg C, and humidity is +/- 3% RH.
65  */
66 typedef struct
67 {
68  int16_t temp; ///< temperature in degrees celcuis times 10.
69  int8_t humid; ///< humidity in percent (0-100).
70 } DpbData;
71 
72 
73 /**
74  * Read the DigiPicco I2C Basic temperature and humidity control device.
75  *
76  * @return true on success, false on error.
77  */
78 bool dpbRead(I2C_Device * dev, i2cAddr addr, DpbData * data);
79 
80 #endif /* DPBASIC */
Structure defines data from the DigiPicco sensor.
Definition: dpbasic.h:66
Structure defines OpenCores I2C Device.
Definition: dev_i2c.h:55
int16_t temp
temperature in degrees celcuis times 10.
Definition: dpbasic.h:68
uint8_t i2cAddr
I2C address type.
Definition: i2c.h:93
bool dpbRead(I2C_Device *dev, i2cAddr addr, DpbData *data)
Read the DigiPicco I2C Basic temperature and humidity control device.
Definition: dpbasic.c:21
This module is responsible for distributing error codes.
int8_t humid
humidity in percent (0-100).
Definition: dpbasic.h:69
OpenCores I2C device driver.