Function rc_button_set_callbacks#
Defined in File button.h
Function Documentation#
-
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.
These functions should be short and return quickly. On every press and release a new thread is created to run your callback functions. If your callbacks take too long to return then multiple instances of them will run in parallel which may or may not be desirable.
- Parameters:
chip – [in] The gpio chip
pin – [in] The gpio pin for that chip
press_func – [in] callback when button is pressed, set to NULL if no callback is desired.
release_func – [in] callback when button is released, set to NULL if no callback is desired.
- Returns:
0 on success, -1 on failure.