COSA
An Object-Oriented Platform for Arduino Programming
|
#include <Rotary.hh>
Classes | |
class | SignalPin |
Public Types | |
enum | Direction { NONE = 0x00, CW = 0x10, CCW = 0x20 } |
enum | Mode { HALF_CYCLE, FULL_CYCLE } |
Public Member Functions | |
Encoder (Board::InterruptPin clk, Board::InterruptPin dt, Mode mode=FULL_CYCLE) | |
Mode | mode () const |
void | mode (Mode mode) |
void | enable () |
void | disable () |
virtual void | on_event (uint8_t type, uint16_t value) |
Protected Member Functions | |
Direction | detect () |
Protected Attributes | |
SignalPin | m_clk |
SignalPin | m_dt |
uint8_t | m_state |
Mode | m_mode |
Static Protected Attributes | |
static const uint8_t | half_cycle_table [6][4] |
static const uint8_t | full_cycle_table [7][4] |
Rotary Encoder using pin change interrupts. Handles half and full cycle detection. Will push an Event::CHANGE_TYPE with the direction of the change.
|
inline |
|
protected |
Detect Rotary Encoder state change. Reads current input pin values and performs a possible state change. Return turn direction or none.
Definition at line 222 of file Rotary.cpp.
|
inline |
|
inline |
|
inline |
|
inline |
|
inlinevirtualinherited |
Default null event handler. Should be redefined by sub-classes. Called by Event::dispatch().
[in] | type | the event type. |
[in] | value | the event value. |
Reimplemented in Menu::RotaryController, Rotary::Dial< T >, AnalogPin, Job, TWI::Slave, ProtoThread, AnalogPins, and Periodic.
|
staticprotected |
Full-cycle state transition tables.
Full-cycle state table (emits a code at 00 only)
|
staticprotected |
|
protected |