uMIDI
The swiss army knife for quick and easy developement of MIDI applications.
|
Interface for rotary encoders. More...
Go to the source code of this file.
Data Structures | |
struct | encoder_config |
Configuration of an encoder. More... | |
struct | encoder_state |
Internal state of an encoder. More... | |
struct | encoder |
An encoder instance. More... | |
Enumerations | |
enum | encoder_action { ENCODER_ACTION_NONE, ENCODER_ACTION_PUSH, ENCODER_ACTION_CW, ENCODER_ACTION_CCW } |
An encoder action. More... | |
enum | encoder_type { ENCODER_TYPE_3_PHASE = 3, ENCODER_TYPE_4_PHASE = 4 } |
Valid encoder types. More... | |
Functions | |
void | init_encoder (struct encoder *encoder) |
Initializes the encoder. More... | |
enum encoder_action | poll_encoder (struct encoder *encoder) |
Polls the encoder inputs. More... | |
Interface for rotary encoders.
enum encoder_action |
enum encoder_type |
void init_encoder | ( | struct encoder * | encoder | ) |
Initializes the encoder.
Configures GPIO pins and registers the callbacks.
encoder | the encoder instance to initialize |
enum encoder_action poll_encoder | ( | struct encoder * | encoder | ) |
Polls the encoder inputs.
Checks if the encoder was rotated or pushed and updates the saved state. This function also executes registered callbacks, so you can define those in the encoder configuration passed to init_encoder and register this function in a background task, discarding its return value.
encoder | the encoder to poll |