Contiki 3.x
Files | Functions | Variables
cc2538dk Button Driver

Driver for the SmartRF06EB buttons. More...

Files

file  button-sensor.c
 Driver for the SmartRF06EB buttons.
 
file  button-sensor.h
 Header file for the cc2538dk Button Driver.
 

Functions

static void config (uint32_t port_base, uint32_t pin_mask)
 Common initialiser for all buttons. More...
 
static void btn_callback (uint8_t port, uint8_t pin)
 Callback registered with the GPIO module. More...
 
static int config_select (int type, int value)
 Init function for the select button. More...
 
static int config_left (int type, int value)
 Init function for the left button. More...
 
static int config_right (int type, int value)
 Init function for the right button. More...
 
static int config_up (int type, int value)
 Init function for the up button. More...
 
static int config_down (int type, int value)
 Init function for the down button. More...
 
void button_sensor_init ()
 Common initialiser for all SmartRF Buttons.
 

Variables

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

Detailed Description

Driver for the SmartRF06EB buttons.

Function Documentation

static void btn_callback ( uint8_t  port,
uint8_t  pin 
)
static

Callback registered with the GPIO module.

Gets fired with a button port/pin generates an interrupt

Parameters
portThe port number that generated the interrupt
pinThe pin number that generated the interrupt. This is the pin absolute number (i.e. 0, 1, ..., 7), not a mask

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

References BUTTON_DOWN_PORT, BUTTON_LEFT_PORT, button_left_sensor, BUTTON_RIGHT_PORT, BUTTON_SELECT_PORT, button_select_sensor, BUTTON_UP_PORT, CLOCK_SECOND, timer_expired(), and timer_set().

Referenced by config_down(), config_left(), config_right(), config_select(), and config_up().

static void config ( uint32_t  port_base,
uint32_t  pin_mask 
)
static

Common initialiser for all buttons.

Parameters
port_baseGPIO port's register offset
pin_maskPin mask corresponding to the button's pin

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

References GPIO_DETECT_EDGE, GPIO_DETECT_RISING, GPIO_ENABLE_INTERRUPT, GPIO_SET_INPUT, GPIO_SOFTWARE_CONTROL, and GPIO_TRIGGER_SINGLE_EDGE.

Referenced by config_down(), config_left(), config_right(), config_select(), and config_up().

static int config_down ( int  type,
int  value 
)
static

Init function for the down button.

Parameters are ignored. They have been included because the prototype is dictated by the core sensor api. The return value is also not required by the API but otherwise ignored.

Parameters
typeignored
valueignored
Returns
ignored

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

References btn_callback(), BUTTON_DOWN_PORT, config(), gpio_register_callback(), IOC_OVERRIDE_PUE, ioc_set_over(), and nvic_interrupt_enable().

static int config_left ( int  type,
int  value 
)
static

Init function for the left button.

Parameters are ignored. They have been included because the prototype is dictated by the core sensor api. The return value is also not required by the API but otherwise ignored.

Parameters
typeignored
valueignored
Returns
ignored

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

References btn_callback(), BUTTON_LEFT_PORT, config(), gpio_register_callback(), IOC_OVERRIDE_PUE, ioc_set_over(), and nvic_interrupt_enable().

static int config_right ( int  type,
int  value 
)
static

Init function for the right button.

Parameters are ignored. They have been included because the prototype is dictated by the core sensor api. The return value is also not required by the API but otherwise ignored.

Parameters
typeignored
valueignored
Returns
ignored

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

References btn_callback(), BUTTON_RIGHT_PORT, config(), gpio_register_callback(), IOC_OVERRIDE_PUE, ioc_set_over(), and nvic_interrupt_enable().

static int config_select ( int  type,
int  value 
)
static

Init function for the select button.

Parameters are ignored. They have been included because the prototype is dictated by the core sensor api. The return value is also not required by the API but otherwise ignored.

Parameters
typeignored
valueignored
Returns
ignored

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

References btn_callback(), BUTTON_SELECT_PORT, config(), gpio_register_callback(), IOC_OVERRIDE_PUE, ioc_set_over(), and nvic_interrupt_enable().

static int config_up ( int  type,
int  value 
)
static

Init function for the up button.

Parameters are ignored. They have been included because the prototype is dictated by the core sensor api. The return value is also not required by the API but otherwise ignored.

Parameters
typeignored
valueignored
Returns
ignored

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

References btn_callback(), BUTTON_UP_PORT, config(), gpio_register_callback(), IOC_OVERRIDE_PUE, ioc_set_over(), and nvic_interrupt_enable().