Contiki-NG
adc-sensors.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015, Zolertia - http://www.zolertia.com
3  * Copyright (c) 2015, University of Bristol - http://www.bristol.ac.uk
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the distribution.
14  *
15  * 3. Neither the name of the copyright holder nor the names of its
16  * contributors may be used to endorse or promote products derived
17  * from this software without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
22  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
23  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
24  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
28  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
30  * OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 /*---------------------------------------------------------------------------*/
33 /**
34  * \addtogroup zoul-sensors
35  * @{
36  *
37  * \defgroup zoul-adc-sensors Zoul adc wrapper to use analogue sensors
38  *
39  * The ADC wrapper implement analogue sensors on top of the ADC interface,
40  * obscuring the ADC configuration and required calculations to obtain actual
41  * sensor values. The driver allows to reuse the adc-wrapper implementation and
42  * add sensors easily, without duplicating code, providing also a simplified
43  * interface and exposing the available ADC assigned channels by a given
44  * platform.
45  *
46  * To use a given sensor simply use: adc_sensors.configure(SENSOR_NAME, pin_no),
47  * where pin_no is a given pin in the PA port, check out the board.h for more
48  * information on available pins. To read a value just use
49  * adc_sensors.value(SENSOR_NAME), the expected result would be the sensor value
50  * already converted to the sensor variable type, check the adc-wrapper file
51  * for more information.
52  *
53  * @{
54  *
55  * \file
56  * Header file for the Zoul ADC sensors API
57  */
58 /*---------------------------------------------------------------------------*/
59 #ifndef ADC_SENSORS_H_
60 #define ADC_SENSORS_H_
61 /*---------------------------------------------------------------------------*/
62 #include "lib/sensors.h"
63 #include "dev/soc-adc.h"
64 #include "dev/adc-zoul.h"
65 /*---------------------------------------------------------------------------*/
66 #define ADC_WRAPPER_SUCCESS 0x00
67 #define ADC_WRAPPER_ERROR (-1)
68 #define ADC_WRAPPER_EXTERNAL_VREF 5000
69 #define ADC_WRAPPER_EXTERNAL_VREF_CROSSVAL 3000
70 /*---------------------------------------------------------------------------*/
71 #define ANALOG_GROVE_LIGHT 0x01
72 #define ANALOG_PHIDGET_ROTATION_1109 0x02
73 #define ANALOG_GROVE_LOUDNESS 0x03
74 #define ANALOG_VAC_SENSOR 0x04
75 #define ANALOG_AAC_SENSOR 0x05
76 /* -------------------------------------------------------------------------- */
77 #define ADC_SENSORS "ADC sensors API"
78 /* -------------------------------------------------------------------------- */
79 extern const struct sensors_sensor adc_sensors;
80 /*---------------------------------------------------------------------------*/
81 #endif /* ADC_SENSORS_H_ */
82 /*---------------------------------------------------------------------------*/
83 /**
84  * @}
85  * @}
86  */
87 
Header file with register declarations for the cc2538 ADC and H/W RNG.
Header file for the Zoul ADC interface.