LibDriver BUTTON
Loading...
Searching...
No Matches
button basic driver function

button basic driver modules More...

Collaboration diagram for button basic driver function:

Data Structures

struct  button_s
 button structure definition More...
struct  button_time_s
 button time structure definition More...
struct  button_decode_s
 button decode structure definition More...
struct  button_handle_s
 button handle structure definition More...
struct  button_info_s
 button information structure definition More...

Macros

#define BUTTON_LENGTH   16
 button length definition

Typedefs

typedef struct button_s button_t
 button structure definition
typedef struct button_time_s button_time_t
 button time structure definition
typedef struct button_decode_s button_decode_t
 button decode structure definition
typedef struct button_handle_s button_handle_t
 button handle structure definition
typedef struct button_info_s button_info_t
 button information structure definition

Enumerations

enum  button_status_t {
  BUTTON_STATUS_PRESS = (1 << 0) , BUTTON_STATUS_RELEASE = (1 << 1) , BUTTON_STATUS_SINGLE_CLICK = (1 << 2) , BUTTON_STATUS_DOUBLE_CLICK = (1 << 3) ,
  BUTTON_STATUS_TRIPLE_CLICK = (1 << 4) , BUTTON_STATUS_REPEAT_CLICK = (1 << 5) , BUTTON_STATUS_SHORT_PRESS_START = (1 << 6) , BUTTON_STATUS_SHORT_PRESS_END = (1 << 7) ,
  BUTTON_STATUS_LONG_PRESS_START = (1 << 8) , BUTTON_STATUS_LONG_PRESS_HOLD = (1 << 9) , BUTTON_STATUS_LONG_PRESS_END = (1 << 10)
}
 check range More...

Functions

uint8_t button_info (button_info_t *info)
 get chip's information
uint8_t button_irq_handler (button_handle_t *handle, uint8_t press_release)
 irq handler
uint8_t button_period_handler (button_handle_t *handle)
 period handler
uint8_t button_init (button_handle_t *handle)
 initialize the chip
uint8_t button_deinit (button_handle_t *handle)
 close the chip
uint8_t button_set_timeout (button_handle_t *handle, uint32_t us)
 set timeout
uint8_t button_get_timeout (button_handle_t *handle, uint32_t *us)
 get timeout
uint8_t button_set_interval (button_handle_t *handle, uint32_t us)
 set interval
uint8_t button_get_interval (button_handle_t *handle, uint32_t *us)
 get interval
uint8_t button_set_short_time (button_handle_t *handle, uint32_t us)
 set short time
uint8_t button_get_short_time (button_handle_t *handle, uint32_t *us)
 get short time
uint8_t button_set_long_time (button_handle_t *handle, uint32_t us)
 set long time
uint8_t button_get_long_time (button_handle_t *handle, uint32_t *us)
 get long time
uint8_t button_set_repeat_time (button_handle_t *handle, uint32_t us)
 set repeat time
uint8_t button_get_repeat_time (button_handle_t *handle, uint32_t *us)
 get repeat time

Detailed Description

button basic driver modules

Macro Definition Documentation

◆ BUTTON_LENGTH

#define BUTTON_LENGTH   16

button length definition

16

Definition at line 63 of file driver_button.h.

Typedef Documentation

◆ button_decode_t

button decode structure definition

◆ button_handle_t

button handle structure definition

◆ button_info_t

typedef struct button_info_s button_info_t

button information structure definition

◆ button_t

typedef struct button_s button_t

button structure definition

◆ button_time_t

typedef struct button_time_s button_time_t

button time structure definition

Enumeration Type Documentation

◆ button_status_t

check range

button status enumeration definition

Enumerator
BUTTON_STATUS_PRESS 

press

BUTTON_STATUS_RELEASE 

release

BUTTON_STATUS_SINGLE_CLICK 

single click

BUTTON_STATUS_DOUBLE_CLICK 

double click

BUTTON_STATUS_TRIPLE_CLICK 

triple click

BUTTON_STATUS_REPEAT_CLICK 

repeat click

BUTTON_STATUS_SHORT_PRESS_START 

short press start

BUTTON_STATUS_SHORT_PRESS_END 

short press end

BUTTON_STATUS_LONG_PRESS_START 

long press start

BUTTON_STATUS_LONG_PRESS_HOLD 

long press hold

BUTTON_STATUS_LONG_PRESS_END 

long press end

Definition at line 76 of file driver_button.h.

Function Documentation

◆ button_deinit()

uint8_t button_deinit ( button_handle_t * handle)

close the chip

Parameters
[in]*handlepointer to a button handle structure
Returns
status code
  • 0 success
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 544 of file driver_button.c.

◆ button_get_interval()

uint8_t button_get_interval ( button_handle_t * handle,
uint32_t * us )

get interval

Parameters
[in]*handlepointer to a button handle structure
[out]*uspointer to a time buffer
Returns
status code
  • 0 success
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 648 of file driver_button.c.

◆ button_get_long_time()

uint8_t button_get_long_time ( button_handle_t * handle,
uint32_t * us )

get long time

Parameters
[in]*handlepointer to a button handle structure
[out]*uspointer to a time buffer
Returns
status code
  • 0 success
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 752 of file driver_button.c.

◆ button_get_repeat_time()

uint8_t button_get_repeat_time ( button_handle_t * handle,
uint32_t * us )

get repeat time

Parameters
[in]*handlepointer to a button handle structure
[out]*uspointer to a time buffer
Returns
status code
  • 0 success
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 804 of file driver_button.c.

◆ button_get_short_time()

uint8_t button_get_short_time ( button_handle_t * handle,
uint32_t * us )

get short time

Parameters
[in]*handlepointer to a button handle structure
[out]*uspointer to a time buffer
Returns
status code
  • 0 success
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 700 of file driver_button.c.

◆ button_get_timeout()

uint8_t button_get_timeout ( button_handle_t * handle,
uint32_t * us )

get timeout

Parameters
[in]*handlepointer to a button handle structure
[out]*uspointer to a time buffer
Returns
status code
  • 0 success
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 596 of file driver_button.c.

◆ button_info()

uint8_t button_info ( button_info_t * info)

get chip's information

Parameters
[out]*infopointer to a button info structure
Returns
status code
  • 0 success
  • 2 handle is NULL
Note
none

Definition at line 828 of file driver_button.c.

◆ button_init()

uint8_t button_init ( button_handle_t * handle)

initialize the chip

Parameters
[in]*handlepointer to a button handle structure
Returns
status code
  • 0 success
  • 1 gpio initialization failed
  • 2 handle is NULL
  • 3 linked functions is NULL
Note
none

Definition at line 487 of file driver_button.c.

◆ button_irq_handler()

uint8_t button_irq_handler ( button_handle_t * handle,
uint8_t press_release )

irq handler

Parameters
[in]*handlepointer to a button handle structure
[in]press_releasepress or release
Returns
status code
  • 0 success
  • 1 run failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 trigger error
  • 5 trigger too fast
Note
press is 1 release is 0

Definition at line 360 of file driver_button.c.

◆ button_period_handler()

uint8_t button_period_handler ( button_handle_t * handle)

period handler

Parameters
[in]*handlepointer to a button handle structure
Returns
status code
  • 0 success
  • 1 run failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 check error
Note
none

Definition at line 108 of file driver_button.c.

◆ button_set_interval()

uint8_t button_set_interval ( button_handle_t * handle,
uint32_t us )

set interval

Parameters
[in]*handlepointer to a button handle structure
[in]usset time
Returns
status code
  • 0 success
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 622 of file driver_button.c.

◆ button_set_long_time()

uint8_t button_set_long_time ( button_handle_t * handle,
uint32_t us )

set long time

Parameters
[in]*handlepointer to a button handle structure
[in]usset time
Returns
status code
  • 0 success
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 726 of file driver_button.c.

◆ button_set_repeat_time()

uint8_t button_set_repeat_time ( button_handle_t * handle,
uint32_t us )

set repeat time

Parameters
[in]*handlepointer to a button handle structure
[in]usset time
Returns
status code
  • 0 success
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 778 of file driver_button.c.

◆ button_set_short_time()

uint8_t button_set_short_time ( button_handle_t * handle,
uint32_t us )

set short time

Parameters
[in]*handlepointer to a button handle structure
[in]usset time
Returns
status code
  • 0 success
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 674 of file driver_button.c.

◆ button_set_timeout()

uint8_t button_set_timeout ( button_handle_t * handle,
uint32_t us )

set timeout

Parameters
[in]*handlepointer to a button handle structure
[in]usset time
Returns
status code
  • 0 success
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 570 of file driver_button.c.