LibDriver BUTTON
Loading...
Searching...
No Matches
driver_button.c File Reference

driver button source file More...

#include "driver_button.h"
Include dependency graph for driver_button.c:

Go to the source code of this file.

Macros

#define CHIP_NAME   "General BUTTON"
 chip information definition
#define MANUFACTURER_NAME   "General"
#define SUPPLY_VOLTAGE_MIN   1.8f
#define SUPPLY_VOLTAGE_MAX   5.5f
#define MAX_CURRENT   1.0f
#define TEMPERATURE_MIN   -40.0f
#define TEMPERATURE_MAX   125.0f
#define DRIVER_VERSION   1000
#define BUTTON_SHORT_TIME   (1000 * 1000)
 button check definition
#define BUTTON_LONG_TIME   (3 * 1000 * 1000)
#define BUTTON_REPEAT_TIME   (200 * 1000)
#define BUTTON_INTERVAL   (5 * 1000)
#define BUTTON_TIMEOUT   (1000 * 1000)

Functions

uint8_t button_period_handler (button_handle_t *handle)
 period handler
uint8_t button_irq_handler (button_handle_t *handle, uint8_t press_release)
 irq 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
uint8_t button_info (button_info_t *info)
 get chip's information

Detailed Description

driver button source file

Copyright (c) 2015 - present LibDriver All rights reserved

The MIT License (MIT)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Version
1.0.0
Author
Shifeng Li
Date
2023-11-30

history

Date Version Author Description
2023/11/30 1.0 Shifeng Li first upload

Definition in file driver_button.c.

Macro Definition Documentation

◆ BUTTON_INTERVAL

#define BUTTON_INTERVAL   (5 * 1000)

5ms

Definition at line 57 of file driver_button.c.

◆ BUTTON_LONG_TIME

#define BUTTON_LONG_TIME   (3 * 1000 * 1000)

3s

Definition at line 55 of file driver_button.c.

◆ BUTTON_REPEAT_TIME

#define BUTTON_REPEAT_TIME   (200 * 1000)

200ms

Definition at line 56 of file driver_button.c.

◆ BUTTON_SHORT_TIME

#define BUTTON_SHORT_TIME   (1000 * 1000)

button check definition

1s

Definition at line 54 of file driver_button.c.

◆ BUTTON_TIMEOUT

#define BUTTON_TIMEOUT   (1000 * 1000)

1s

Definition at line 58 of file driver_button.c.

◆ CHIP_NAME

#define CHIP_NAME   "General BUTTON"

chip information definition

chip name

Definition at line 42 of file driver_button.c.

◆ DRIVER_VERSION

#define DRIVER_VERSION   1000

driver version

Definition at line 49 of file driver_button.c.

◆ MANUFACTURER_NAME

#define MANUFACTURER_NAME   "General"

manufacturer name

Definition at line 43 of file driver_button.c.

◆ MAX_CURRENT

#define MAX_CURRENT   1.0f

chip max current

Definition at line 46 of file driver_button.c.

◆ SUPPLY_VOLTAGE_MAX

#define SUPPLY_VOLTAGE_MAX   5.5f

chip max supply voltage

Definition at line 45 of file driver_button.c.

◆ SUPPLY_VOLTAGE_MIN

#define SUPPLY_VOLTAGE_MIN   1.8f

chip min supply voltage

Definition at line 44 of file driver_button.c.

◆ TEMPERATURE_MAX

#define TEMPERATURE_MAX   125.0f

chip max operating temperature

Definition at line 48 of file driver_button.c.

◆ TEMPERATURE_MIN

#define TEMPERATURE_MIN   -40.0f

chip min operating temperature

Definition at line 47 of file driver_button.c.