Robot Control Library
button.h File Reference

Go to the source code of this file.

Macros

#define RC_BTN_PIN_PAUSE   2,5
 
#define RC_BTN_PIN_MODE   2,4
 
#define RC_BTN_STATE_PRESSED   1
 
#define RC_BTN_STATE_RELEASED   0
 
#define RC_BTN_POLARITY_NORM_HIGH   1
 
#define RC_BTN_POLARITY_NORM_LOW   0
 
#define RC_BTN_DEBOUNCE_DEFAULT_US   2000
 

Functions

int rc_button_init (int chip, int pin, char polarity, int debounce_us)
 Initializes a single button handler. More...
 
void rc_button_cleanup (void)
 Closes all button handlers. Call at the end of your program before returning. More...
 
int rc_button_set_callbacks (int chip, int pin, void(*press_func)(void), void(*release_func)(void))
 Sets the callback functions to be called when the button is pressed or released. More...
 
int rc_button_get_state (int chip, int pin)
 used to query the position of a button. More...
 
int rc_button_wait_for_event (int chip, int pin, int press_or_release)
 blocking function call, returns when press or release happens More...