/*
 * Rotary encoder library for Arduino.
 * http://www.buxtronix.net/2011/10/rotary-encoders-done-properly.html
 */

#ifndef rotary_h
#define rotary_h

// #include "Arduino.h"

// Enable this to emit codes twice per step.
//#define HALF_STEP

// Enable weak pullups
#define ENABLE_PULLUPS

// Values returned by 'process'
// No complete step yet.
enum StepType
{
	// No step
	DIR_NONE = 0x0,
	
	// Clockwise step.
	DIR_CW = 0x10,
	
	// Anti-clockwise step.
	DIR_CCW = 0x20,
};

class Rotary
{
	unsigned char state;

public:
    Rotary();
    
    StepType process(int bits);
};

#endif
 
