32 #include "lib/sensors.h"
33 #include "dev/button-sensor.h"
34 #include "lib/simEnvChange.h"
36 const struct simInterface button_interface;
37 const struct sensors_sensor button_sensor;
38 static struct timer debouncetimer;
41 char simButtonChanged;
43 char simButtonIsActive;
52 configure(
int type,
int c)
54 if(type == SENSORS_ACTIVE) {
55 simButtonIsActive = c;
57 }
else if(type == SENSORS_HW_INIT) {
58 simButtonIsActive = 1;
68 return (type == SENSORS_ACTIVE) ? simButtonIsActive : 0;
72 doInterfaceActionsBeforeTick(
void)
75 if(simButtonChanged && simButtonIsActive && simButtonIsDown) {
78 sensors_changed(&button_sensor);
85 doInterfaceActionsAfterTick(
void)
90 SIM_INTERFACE(button_interface,
91 doInterfaceActionsBeforeTick,
92 doInterfaceActionsAfterTick);
94 SENSORS_SENSOR(button_sensor, BUTTON_SENSOR,
95 value, configure, status);