encoder - Driver for incremental rotary encoders

group encoder

ESP-IDF HW timer-based driver for rotary encoders.

Copyright (C) 2019 Ruslan V. Uss unclerus@gmail.com

BSD Licensed as described in the file LICENSE

Enums

enum rotary_encoder_btn_state_t

Button state.

Values:

enumerator RE_BTN_RELEASED

Button currently released.

enumerator RE_BTN_PRESSED

Button currently pressed.

enumerator RE_BTN_LONG_PRESSED

Button currently long pressed.

enum rotary_encoder_event_type_t

Event type.

Values:

enumerator RE_ET_CHANGED

Encoder turned.

enumerator RE_ET_BTN_RELEASED

Button released.

enumerator RE_ET_BTN_PRESSED

Button pressed.

enumerator RE_ET_BTN_LONG_PRESSED

Button long pressed (press time (us) > RE_BTN_LONG_PRESS_TIME_US)

enumerator RE_ET_BTN_CLICKED

Button was clicked.

Functions

esp_err_t rotary_encoder_init(QueueHandle_t queue)

Initialize library.

Parameters

queue – Event queue to send encoder events

Returns

ESP_OK on success

esp_err_t rotary_encoder_add(rotary_encoder_t *re)

Add new rotary encoder.

Parameters

re – Encoder descriptor

Returns

ESP_OK on success

esp_err_t rotary_encoder_remove(rotary_encoder_t *re)

Remove previously added rotary encoder.

Parameters

re – Encoder descriptor

Returns

ESP_OK on success

struct rotary_encoder_t
#include <encoder.h>

Rotary encoder descriptor.

struct rotary_encoder_event_t
#include <encoder.h>

Event.