Contiki 3.x
Files | Functions | Variables
SensorTag 2.0 Button Sensor

One of the buttons can be configured as general purpose or as an on/off key. More...

Files

file  button-sensor.c
 Driver for the Sensortag-CC26xx buttons.
 
file  button-sensor.h
 Header file for the Sensortag-CC26xx Button Driver.
 

Functions

static void button_press_handler (uint8_t ioid)
 Handler for Sensortag-CC26XX button presses.
 
static void config_buttons (int type, int c, uint32_t key)
 Configuration function for the button sensor for all buttons. More...
 
static int config_left (int type, int value)
 Configuration function for the left button. More...
 
static int config_right (int type, int value)
 Configuration function for the right button. More...
 
static int status (int type, uint32_t key_io_id)
 Status function for all buttons. More...
 
static int status_left (int type)
 Status function for the left button. More...
 
static int status_right (int type)
 Status function for the right button. More...
 

Variables

const struct sensors_sensor button_left_sensor
 Exports a global symbol to be used by the sensor API.
 

Detailed Description

One of the buttons can be configured as general purpose or as an on/off key.

Function Documentation

static void config_buttons ( int  type,
int  c,
uint32_t  key 
)
static

Configuration function for the button sensor for all buttons.

Parameters
typeThis function does nothing unless type == SENSORS_ACTIVE
c0: disable the button, non-zero: enable
keyOne of BOARD_KEY_LEFT, BOARD_KEY_RIGHT etc

Definition at line 131 of file button-sensor.c.

References button_press_handler(), and gpio_interrupt_register_handler().

Referenced by config_left(), and config_right().

static int config_left ( int  type,
int  value 
)
static

Configuration function for the left button.

Parameters are passed onto config_buttons, which does the actual configuration Parameters are ignored. They have been included because the prototype is dictated by the core sensor API. The return value is also required by the API but otherwise ignored.

Parameters
typepassed to config_buttons as-is
valuepassed to config_buttons as-is
Returns
ignored

Definition at line 170 of file button-sensor.c.

References config_buttons().

static int config_right ( int  type,
int  value 
)
static

Configuration function for the right button.

Parameters are passed onto config_buttons, which does the actual configuration Parameters are ignored. They have been included because the prototype is dictated by the core sensor api. The return value is also required by the API but otherwise ignored.

Parameters
typepassed to config_buttons as-is
valuepassed to config_buttons as-is
Returns
ignored

Definition at line 192 of file button-sensor.c.

References config_buttons().

static int status ( int  type,
uint32_t  key_io_id 
)
static

Status function for all buttons.

Parameters
typeSENSORS_ACTIVE or SENSORS_READY
key_io_idBOARD_IOID_KEY_LEFT, BOARD_IOID_KEY_RIGHT etc
Returns
1 if the button's port interrupt is enabled (edge detect)

This function will only be called by status_left, status_right and the called will pass the correct key_io_id

Definition at line 209 of file button-sensor.c.

Referenced by status_left(), and status_right().

static int status_left ( int  type)
static

Status function for the left button.

Parameters
typeSENSORS_ACTIVE or SENSORS_READY
Returns
1 if the button's port interrupt is enabled (edge detect)

This function will call status. It will pass type verbatim and it will also pass the correct key_io_id

Definition at line 257 of file button-sensor.c.

References status().

static int status_right ( int  type)
static

Status function for the right button.

Parameters
typeSENSORS_ACTIVE or SENSORS_READY
Returns
1 if the button's port interrupt is enabled (edge detect)

This function will call status. It will pass type verbatim and it will also pass the correct key_io_id

Definition at line 271 of file button-sensor.c.

References status().