COSA
An Object-Oriented Platform for Arduino Programming
|
#include <Rotary.hh>
Public Types | |
enum | Direction { NONE = 0x00, CW = 0x10, CCW = 0x20 } |
enum | Mode { HALF_CYCLE, FULL_CYCLE } |
Public Member Functions | |
Dial (Board::InterruptPin clk, Board::InterruptPin dt, Mode mode, T initial, T min, T max, T step) | |
T | value () const |
T | step () const |
void | step (T step) |
virtual void | on_change (T value) |
Mode | mode () const |
void | mode (Mode mode) |
void | enable () |
void | disable () |
Protected Member Functions | |
virtual void | on_event (uint8_t type, uint16_t value) |
Direction | detect () |
Protected Attributes | |
T | m_value |
T | m_min |
T | m_max |
T | m_step |
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] |
Use Rotary Encoder as a simple dial (integer value). Allows a dial within a given number(T) range (min, max) and a given initial value.
[in] | T | value type. |
|
inherited |
|
inherited |
|
inline |
Construct Rotary Dial connected to given interrupt pins with given mode, min, max, initial and step value. The mode is one of the Rotary Encoder modes; HALF_CYCLE or FULL_CYCLE.
[in] | clk | interrupt pin. |
[in] | dt | interrupt pin. |
[in] | mode | step. |
[in] | initial | value. |
[in] | min | value. |
[in] | max | value. |
[in] | step | value. |
|
protectedinherited |
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.
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlinevirtual |
|
inlineprotectedvirtual |
Update the dial value on change. The event value is the direction (CW or CCW).
[in] | type | the event type. |
[in] | value | the event value. |
Reimplemented from Event::Handler.
|
inline |
|
inline |
|
inline |
|
staticprotectedinherited |
Full-cycle state transition tables.
Full-cycle state table (emits a code at 00 only)
|
staticprotectedinherited |
|
protectedinherited |
|
protected |
|
protected |
|
protected |
|
protected |