Contiki-NG
Macros | Typedefs | Functions | Variables
button-hal.h File Reference

Header file for the button HAL. More...

#include "contiki.h"
#include "dev/gpio-hal.h"
#include "sys/clock.h"
#include "sys/ctimer.h"
#include <stdint.h>
#include <stdbool.h>
#include <string.h>

Go to the source code of this file.

Macros

#define BUTTON_HAL_DEBOUNCE_DURATION   (CLOCK_SECOND >> 6)
 Controls the software debounce timer duration. More...
 
#define BUTTON_HAL_WITH_DESCRIPTION   1
 Controls whether buttons will have human-readable names. More...
 
#define BUTTON_HAL_ID_BUTTON_ZERO   0x00
 Optional button IDs.
 
#define BUTTON_HAL_GET_DESCRIPTION(b)   (b)->description
 Retrieve the textual description of a button. More...
 

Typedefs

typedef struct button_hal_button_s button_hal_button_t
 A logical representation of a user button.
 

Functions

void button_hal_init (void)
 Initialise the button HAL.
 
button_hal_button_tbutton_hal_get_by_id (uint8_t unique_id)
 Retrieve a button by ID. More...
 
button_hal_button_tbutton_hal_get_by_index (uint8_t index)
 Retrieve a button by its index. More...
 
uint8_t button_hal_get_state (button_hal_button_t *button)
 Get the state of a button (pressed / released) More...
 

Variables

const uint8_t button_hal_button_count
 The number of buttons on a device.
 
process_event_t button_hal_press_event
 A broadcast event generated when a button gets pressed.
 
process_event_t button_hal_release_event
 A broadcast event generated when a button gets released.
 
process_event_t button_hal_periodic_event
 A broadcast event generated every second while a button is kept pressed.
 

Detailed Description

Header file for the button HAL.

Definition in file button-hal.h.