31 #include "lib/sensors.h"
32 #include "dev/button-sensor.h"
33 #include "lib/simEnvChange.h"
35 const struct simInterface button_interface;
36 const struct sensors_sensor button_sensor;
37 static struct timer debouncetimer;
40 char simButtonChanged;
42 char simButtonIsActive;
51 configure(
int type,
int c)
53 if(type == SENSORS_ACTIVE) {
54 simButtonIsActive = c;
56 }
else if(type == SENSORS_HW_INIT) {
57 simButtonIsActive = 1;
67 return (type == SENSORS_ACTIVE) ? simButtonIsActive : 0;
71 doInterfaceActionsBeforeTick(
void)
74 if(simButtonChanged && simButtonIsActive && simButtonIsDown) {
77 sensors_changed(&button_sensor);
84 doInterfaceActionsAfterTick(
void)
89 SIM_INTERFACE(button_interface,
90 doInterfaceActionsBeforeTick,
91 doInterfaceActionsAfterTick);
93 SENSORS_SENSOR(button_sensor, BUTTON_SENSOR,
94 value, configure, status);
void timer_set(struct timer *t, clock_time_t interval)
Set a timer.
int timer_expired(struct timer *t)
Check if a timer has expired.
#define CLOCK_SECOND
A second, measured in system clock time.