Contiki-Inga 3.x
pressure-sensor.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2012, TU Braunschweig.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  * 3. Neither the name of the Institute nor the names of its contributors
14  * may be used to endorse or promote products derived from this software
15  * without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
18  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
21  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27  * SUCH DAMAGE.
28  */
29 
30 /**
31  * \file
32  * Pressure sensor interface definition
33  * \author
34  * Enrico Joerns <joerns@ibr.cs.tu-bs.de>
35  * Georg von Zengen
36  */
37 
38 /**
39  * \addtogroup inga_sensors
40  * @{
41  */
42 
43 /** \defgroup inga_pressure_driver Pressure and Temperature Sensor
44  *
45  * This sensor interface allows to control the gyroscope of the INGA sensor platform.
46  *
47  * \section query_measure Query measurements
48  * <code>acc_sensor.value(channel)</code>
49  *
50  * The sensor provides 3 data channels.
51  * - 2 channels for pressure value (high/low)
52  * - One channel for temperature
53  *
54  * \section usage Example Usage
55  *
56 \code
57 #include <sensors.h>
58 [...]
59 struct sensors_sensor pressure_sensor = find_sensor("Press");
60 ACTIVATE_SENSOR(pressure_sensor);
61 [...]
62 int32_t pressval = ((int32_t) pressure_sensor.value(PRESS_H) << 16);
63 pressval |= (pressure_sensor.value(PRESS_L) & 0xFFFF);
64 \endcode
65  * @{ */
66 
67 #ifndef __PRESS_SENSOR_H__
68 #define __PRESS_SENSOR_H__
69 
70 #include "lib/sensors.h"
71 
72 extern const struct sensors_sensor pressure_sensor;
73 
74 #define PRESSURE_SENSOR "Press"
75 
76 /** \name Sensor values
77  * @{ */
78 /** Returns Temperature [C] */
79 #define TEMP 0
80 /** Returns Pressure [High] [Pa] */
81 #define PRESS_H 2
82 /** Returns Pressure [Low] [Pa] */
83 #define PRESS_L 1
84 /** @} */
85 
86 /** \name Configuration types
87  * @{ */
88 /** Selects the operation mode. */
89 #define PRESSURE_CONF_OPERATION_MODE 10
90 /** @} */
91 
92 /** \name OPERATION_MODE values
93  * \anchor op_mode_values
94  * @{ */
95 #define PRESSURE_MODE_ULTRA_LOW_POWER 0
96 #define PRESSURE_MODE_STANDARD 1
97 #define PRESSURE_MODE_HIGH_RES 2
98 #define PRESSURE_MODE_ULTRA_HIGH_RES 3
99 /** @} */
100 
101 
102 /** @} */
103 /** @} */
104 
105 #endif /* __PRESS-SENSOR_H__ */