Main Page | Modules | Class Hierarchy | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

otRotaryEncoder Class Reference
[Rotary encoder, incremental with quadrature outputs., Rotary encoder, incremental with quadrature outputs.]

Incremental rotary encoder library.

#include <otRotaryEncoder.h>


Public Member Functions

 otRotaryEncoder ()
void init (U8 encoderChannel, U8 switchBit, U8 sen=4)
S16 read (bool invert=true)
S16 counts (bool invert=true)
void clear ()
bool button (bool release=true)
void release ()
bool check ()


Constructor & Destructor Documentation

otRotaryEncoder.otRotaryEncoder (   ) 
 

Create the class


Member Function Documentation

bool otRotaryEncoder.button (  bool  release = true  ) 
 

Read switch button status

Parameters:
release If true wait the button release
Returns:
True if the switch is pressed

bool otRotaryEncoder.check (   ) 
 

Check button action

Returns:
True if pressed, false if not

void otRotaryEncoder.clear (   ) 
 

Clear encoder counts

S16 otRotaryEncoder.counts (  bool  invert = true  ) 
 

Read encoder counts

Parameters:
invert If true invert the output
Returns:
Encoder counts

void otRotaryEncoder.init (  U8  encoderChannel,
U8  switchBit,
U8  sen = 4
) 
 

Init the library

Parameters:
encoderChannel Set 0 to 3 to select an encoder channel. For 0 channel connect quadrature signal to PX0-PX1, for 1 to PX2-PX3, ...
switchBit Set 0 to 7 to set a bit on PX port to read button switch
sen Set the sensitivity of the encoder

S16 otRotaryEncoder.read (  bool  invert = true  ) 
 

Read encoder

Parameters:
invert If true invert the output
Returns:
0 for no action, 1 if clock wise, -1 for counter clock wise

void otRotaryEncoder.release (   ) 
 

Wait button release


The documentation for this class was generated from the following file: footer
otStudio - Library Reference - (C) 2020-25 Officina Turini, All Rights Reserved
Document built with Doxygen 1.4.0