adding rotary encoder + better jack gpio handling

This commit is contained in:
philippe44
2020-02-05 00:17:48 -08:00
parent 5f84dc3cb0
commit ed4eb6a42e
12 changed files with 752 additions and 66 deletions

View File

@@ -18,7 +18,7 @@
#pragma once
// button type (pressed = LOW or HIGH)
// button type (pressed = LOW or HIGH, matches GPIO level)
#define BUTTON_LOW 0
#define BUTTON_HIGH 1
@@ -36,3 +36,9 @@ NOTE: shifter buttons *must* be created before shiftee
void button_create(void *client, int gpio, int type, bool pull, int debounce, button_handler handler, int long_press, int shifter_gpio);
void *button_remap(void *client, int gpio, button_handler handler, int long_press, int shifter_gpio);
void *button_get_client(int gpio);
bool button_is_pressed(int gpio, void *client);
typedef enum { ROTARY_LEFT, ROTARY_RIGHT, ROTARY_PRESSED, ROTARY_RELEASED } rotary_event_e;
typedef void (*rotary_handler)(void *id, rotary_event_e event, bool long_press);
bool create_rotary(void *id, int A, int B, int SW, int long_press, rotary_handler handler);