PiPower  ac0ff3c (Mon Feb 11 21:44:30 2019 -0500)
/home/travis/build/larsks/pipower/input.h
Go to the documentation of this file.
1 
4 #ifndef _input_h
5 #define _input_h
6 
7 #include <stdint.h>
8 #include "bool.h"
9 
10 #ifdef __cplusplus
11 extern "C" {
12 #endif
13 
14 typedef struct Input {
15  uint8_t pin;
16  bool state,
17  last_state;
18 } Input;
19 
20 void input_new(Input *input, int pin, bool pullup);
21 extern void input_delete(Input *);
22 extern void input_update(Input *);
23 extern bool input_went_high(Input *);
24 extern bool input_went_low(Input *);
25 extern bool input_is_high(Input *);
26 extern bool input_is_low(Input *);
27 
28 #ifdef __cplusplus
29 }
30 #endif
31 
32 #endif
void input_update(Input *)
Read the state of the pin.
Definition: input.c:31
bool input_went_high(Input *)
Return true if the pin state has gone high.
Definition: input.c:40
Definition: input.h:14
bool last_state
Pin state last time we checked.
Definition: input.h:16
bool state
Current pin state.
Definition: input.h:16
bool input_is_high(Input *)
Return true if the pin is high.
Definition: input.c:58
void input_new(Input *input, int pin, bool pullup)
Create a new Input object.
Definition: input.c:13
bool input_went_low(Input *)
Return true if the pin state has gone low.
Definition: input.c:51
a simple replacement for stdbool.h.
bool input_is_low(Input *)
Return true if the pin is low.
Definition: input.c:63
uint8_t pin
Pin associated with this input.
Definition: input.h:15