|
Contiki 3.x
|
The user button will generate a sensors_changed event on press as well as on release. More...
Files | |
| file | button-sensor.c |
| Driver for for the OpenMote-CC2538 user button. | |
| file | button-sensor.h |
| Header for the OpenMote-CC2538 button driver. | |
Functions | |
| static int | value (int type) |
| Retrieves the value of the button pin. More... | |
| static void | btn_callback (uint8_t port, uint8_t pin) |
| Callback registered with the GPIO module. More... | |
| static int | config_user (int type, int value) |
| Init function for the User button. More... | |
Variables | |
| const struct sensors_sensor | button_sensor |
| Copyright (c) 2014, Analog Devices, Inc. More... | |
The user button will generate a sensors_changed event on press as well as on release.
|
static |
Callback registered with the GPIO module.
Gets fired with a button port/pin generates an interrupt
| port | The port number that generated the interrupt |
| pin | The pin number that generated the interrupt. This is the pin absolute number (i.e. 0, 1, ..., 7), not a mask |
Definition at line 106 of file button-sensor.c.
References button_sensor, ctimer_set(), ctimer_stop(), DEBOUNCE_DURATION, NULL, timer_expired(), timer_set(), and value().
Referenced by config_user().
|
static |
Init function for the User button.
| type | SENSORS_ACTIVE: Activate / Deactivate the sensor (value == 1 or 0 respectively) |
| value | Depends on the value of the type argument |
Definition at line 136 of file button-sensor.c.
References btn_callback(), BUTTON_USER_PORT, GPIO_DETECT_EDGE, GPIO_DISABLE_INTERRUPT, GPIO_ENABLE_INTERRUPT, gpio_register_callback(), GPIO_SET_INPUT, GPIO_SOFTWARE_CONTROL, GPIO_TRIGGER_BOTH_EDGES, IOC_OVERRIDE_PUE, ioc_set_over(), nvic_interrupt_disable(), nvic_interrupt_enable(), process_alloc_event(), and value().
|
static |
Retrieves the value of the button pin.
| type | Returns the pin level or the counter of press duration events. type == BUTTON_SENSOR_VALUE_TYPE_LEVEL or type == BUTTON_SENSOR_VALUE_TYPE_PRESS_DURATION respectively |
Definition at line 86 of file button-sensor.c.
References GPIO_READ_PIN.
Referenced by btn_callback(), and config_user().
| const struct sensors_sensor button_sensor |
Copyright (c) 2014, Analog Devices, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted (subject to the limitations in the disclaimer below) provided that the following conditions are met:
NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted (subject to the limitations in the disclaimer below) provided that the following conditions are met:
NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Copyright (c) 2014, Analog Devices, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted (subject to the limitations in the disclaimer below) provided that the following conditions are met:
NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Copyright (c) 2014, Analog Devices, Inc.
Definition at line 5 of file button-sensor.c.
1.8.6