Newer
Older
#ifndef ROTARYENCODER_h
#define ROTARYENCODER_h
/**
* [void description]
* @param _cb [description]
*/
// {newPin2, newPin1, oldPin2, oldPin1}
int movements[5][4][4] = {
{ // No movement
{0, 0, 0, 0},
{0, 1, 0, 1},
{1, 0, 1, 0},
{1, 1, 1, 1}
},
{ // +1
{0, 0, 0, 1},
{0, 1, 1, 1},
{1, 0, 0, 0},
{1, 1, 1, 0}
},
{ // -1
{0, 0, 1, 0},
{0, 1, 0, 0},
{1, 0, 1, 1},
{1, 1, 0, 1}
},
{ // +2
{0, 0, 1, 1},
{1, 1, 0, 0}
},
{ // -2
{0, 1, 1, 0},
{1, 0, 0, 1}
},
};
static const uint8_t kEventStableUpdate = 0;
static const uint8_t kEventUnstableUpdate = 1;
RotaryEncoder(int pinA, int pinB, int id = 99);
void setEventHandler(void (*function)(RotaryEncoder*, uint8_t, int));