Contiki 3.x
button-sensor.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2012, Texas Instruments Incorporated - http://www.ti.com/
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  *
14  * 3. Neither the name of the copyright holder nor the names of its
15  * contributors may be used to endorse or promote products derived
16  * from this software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
23  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
27  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29  * OF THE POSSIBILITY OF SUCH DAMAGE.
30  *
31  * This file is part of the Contiki operating system.
32  *
33  */
34 /*---------------------------------------------------------------------------*/
35 /**
36  * \addtogroup openmote-cc2538
37  * @{
38  *
39  * \defgroup openmote-button-sensor OpenMote-CC2538 user button driver
40  *
41  * The user button will generate a sensors_changed event on press as
42  * well as on release.
43  *
44  * @{
45  *
46  * \file
47  * Header for the OpenMote-CC2538 button driver
48  */
49 /*---------------------------------------------------------------------------*/
50 #ifndef BUTTON_SENSOR_H_
51 #define BUTTON_SENSOR_H_
52 /*---------------------------------------------------------------------------*/
53 #include "lib/sensors.h"
54 /*---------------------------------------------------------------------------*/
55 #define BUTTON_SENSOR "Button"
56 
57 extern const struct sensors_sensor button_sensor;
58 /*---------------------------------------------------------------------------*/
59 extern process_event_t button_press_duration_exceeded;
60 /*---------------------------------------------------------------------------*/
61 #define BUTTON_SENSOR_CONFIG_TYPE_INTERVAL 0x0100
62 
63 #define BUTTON_SENSOR_VALUE_TYPE_LEVEL 0
64 #define BUTTON_SENSOR_VALUE_TYPE_PRESS_DURATION 1
65 
66 #define BUTTON_SENSOR_PRESSED_LEVEL 0
67 #define BUTTON_SENSOR_RELEASED_LEVEL 8
68 /*---------------------------------------------------------------------------*/
69 #endif /* BUTTON_SENSOR_H_ */
70 /*---------------------------------------------------------------------------*/
71 /**
72  * @}
73  * @}
74  */
const struct sensors_sensor button_sensor
Copyright (c) 2014, Analog Devices, Inc.
Definition: button-sensor.c:5