COSA
An Object-Oriented Platform for Arduino Programming
|
#include <Menu.hh>
Public Types | |
enum | Direction { NONE = 0x00, CW = 0x10, CCW = 0x20 } |
enum | Mode { HALF_CYCLE, FULL_CYCLE } |
Public Member Functions | |
RotaryController (Menu::Walker *walker, Job::Scheduler *scheduler, Board::InterruptPin clk=Board::PCI4, Board::InterruptPin dt=Board::PCI3, Board::DigitalPin sw=Board::D2) | |
virtual void | on_event (uint8_t type, uint16_t direction) |
void | begin () |
Mode | mode () const |
void | mode (Mode mode) |
void | enable () |
void | disable () |
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] |
Menu walker controller for the Rotary encoder with push button. Rotary encoder CW is mapped to DOWN_KEY, CCW to UP_KEY. The push button is mapped to SELECT_KEY.
|
inherited |
|
inherited |
|
inline |
Construct rotary encoder event adapter for menu walker.
[in] | walker | to control. |
[in] | scheduler | for button sampling. |
[in] | clk | rotary encoder clock pin (Default PCI4). |
[in] | dt | rotary encoder data pin (Default PCI3). |
[in] | sw | rotary encoder switch pin (Default D2). |
|
inline |
|
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 |
|
virtual |
Rotary change event handler. Forward change as a key; CW is mapped to DOWN_KEY and CCW to UP_KEY (and reverse for RANGE).
[in] | type | the event type. |
[in] | direction | the event value. |
Reimplemented from Event::Handler.
|
staticprotectedinherited |
Full-cycle state transition tables.
Full-cycle state table (emits a code at 00 only)
|
staticprotectedinherited |
|
protectedinherited |