|
PiPower
ac0ff3c (Mon Feb 11 21:44:30 2019 -0500)
|
Simple debouncing routine from https://hackaday.com/2015/12/10/embed-with-elliot-debounce-your-noisy-buttons-part-ii/ More...
#include "bool.h"#include <stdint.h>#include <stdlib.h>#include <avr/io.h>#include "button.h"#include "millis.h"Macros | |
| #define | BUTTON_RELEASED 0b00000111 |
| History pattern when a button is released. | |
| #define | BUTTON_PRESSED 0b11000000 |
| History pattern when a button is pressed. | |
| #define | BUTTON_MASK 0b11000111 |
| Mask out noise in the button history. | |
| #define | BUTTON_UP 0b11111111 |
| History pattern when button is up. | |
| #define | BUTTON_DOWN 0b00000000 |
| History pattern when button is down. | |
Functions | |
| void | button_new (Button *button, uint8_t pin, uint8_t poll_freq) |
| Create a new Button object. More... | |
| void | button_update (Button *button) |
| Push current button state onto history. More... | |
| bool | button_is_pressed (Button *button) |
| Return true if button has been pressed. More... | |
| bool | button_is_released (Button *button) |
| Return true if button has been released. More... | |
| bool | button_is_up (Button *button) |
| Return true if button is up. | |
| bool | button_is_down (Button *button) |
| Return true if button is down. | |
Simple debouncing routine from https://hackaday.com/2015/12/10/embed-with-elliot-debounce-your-noisy-buttons-part-ii/
| bool button_is_pressed | ( | Button * | button | ) |
Return true if button has been pressed.
| bool button_is_released | ( | Button * | button | ) |
Return true if button has been released.
| void button_update | ( | Button * | button | ) |
Push current button state onto history.
1.8.11