PiPower
ac0ff3c (Mon Feb 11 21:44:30 2019 -0500)
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
/home/travis/build/larsks/pipower/button.h
Go to the documentation of this file.
1
8
#ifndef _button_h
9
#define _button_h
10
11
#include <stdint.h>
12
#include "
bool.h
"
13
14
#ifdef __cplusplus
15
extern
"C"
{
16
#endif
17
18
typedef
struct
Button
{
19
uint8_t
pin
,
20
history
,
21
poll_freq
,
22
last_poll
;
23
}
Button
;
24
25
void
button_new
(
Button
*button, uint8_t
pin
, uint8_t
poll_freq
);
26
extern
void
button_destroy(
Button
*);
27
extern
void
button_update
(
Button
*);
28
extern
bool
button_is_pressed
(
Button
*);
29
extern
bool
button_is_released
(
Button
*);
30
extern
bool
button_is_up
(
Button
*);
31
extern
bool
button_is_down
(
Button
*);
32
33
#ifdef __cplusplus
34
}
35
#endif
36
37
#endif // _button_h
button_is_released
bool button_is_released(Button *)
Return true if button has been released.
Definition:
button.c:60
button_is_up
bool button_is_up(Button *)
Return true if button is up.
Definition:
button.c:72
Button::history
uint8_t history
Button state history.
Definition:
button.h:19
Button::pin
uint8_t pin
Pin to which button is attached.
Definition:
button.h:19
button_is_down
bool button_is_down(Button *)
Return true if button is down.
Definition:
button.c:77
Button::last_poll
uint8_t last_poll
Time at which we last checked button state.
Definition:
button.h:19
button_update
void button_update(Button *)
Push current button state onto history.
Definition:
button.c:37
Button::poll_freq
uint8_t poll_freq
How often (in ms) to check button state.
Definition:
button.h:19
button_is_pressed
bool button_is_pressed(Button *)
Return true if button has been pressed.
Definition:
button.c:48
button_new
void button_new(Button *button, uint8_t pin, uint8_t poll_freq)
Create a new Button object.
Definition:
button.c:23
bool.h
a simple replacement for stdbool.h.
Button
Definition:
button.h:18
Generated by
1.8.11