pushbutton.h 595 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. * button.h
  3. *
  4. * Created on: 28.04.2016
  5. * Author: terfloth
  6. */
  7. #ifndef PUSHBUTTON_H_
  8. #define PUSHBUTTON_H_
  9. #include "Arduino.h"
  10. #ifdef __cplusplus
  11. extern "C" {
  12. #endif
  13. struct pushbutton;
  14. typedef struct {
  15. boolean state;
  16. int pin;
  17. unsigned long debounce_delay;
  18. boolean debounce_state;
  19. unsigned long last_debounce_time;
  20. void (*callback)(struct pushbutton*);
  21. } pushbutton_t;
  22. extern void read_pushbutton(pushbutton_t *button);
  23. extern void setup_pushbutton(pushbutton_t *button, int pin, void (*callback)(pushbutton_t*));
  24. #ifdef __cplusplus
  25. }
  26. #endif
  27. #endif /* PUSHBUTTON_H_ */