Rotary encoder with easyC library 1.0.0
Library for the rotary encoder witc easyC created by Soldered
Loading...
Searching...
No Matches
Rotary Class Reference

#include <Rotary-encoder-easyC-SOLDERED.h>

Inherits EasyC.

Public Member Functions

 Rotary ()
 Rotary specific native constructor.
 
long getCount ()
 Get counter from rotary encoder breakout.
 
byte getState ()
 Get state of the rotary encoder.
 
void resetCounter ()
 Reset the internal counter on the breakout.
 
- Public Member Functions inherited from EasyC
 EasyC ()
 Main constructor for easyC version.
 
void begin ()
 Initializes sensors on native or easyC on default address.
 
void begin (uint8_t _address)
 Initializes sensors on supplied i2c address.
 
int sendAddress (char regAddr)
 Private function to send a single byte to sensor.
 
int readData (char a[], int n)
 Private function to read n bytes over i2c.
 
int readRegister (char regAddr, char a[], size_t n)
 Private function to send over i2c and then read n bytes.
 
int sendData (const uint8_t *a, int n)
 Private function to write n bytes over i2c.
 

Protected Member Functions

void initializeNative ()
 Overloaded function for virtual in base class to initialize sensor specific.
 

Private Member Functions

void getData ()
 Get data from the breakout and store them in class variables.
 

Private Attributes

long rotaryCounter
 
byte rotaryState
 

Additional Inherited Members

- Public Attributes inherited from EasyC
int native = 0
 
bool beginDone = 0
 
int err
 
char address
 
const char defaultAddress = 0x30
 

Constructor & Destructor Documentation

◆ Rotary()

Rotary::Rotary ( )

Rotary specific native constructor.

Member Function Documentation

◆ getCount()

long Rotary::getCount ( )

Get counter from rotary encoder breakout.

Returns
Counter variable.

◆ getData()

void Rotary::getData ( )
private

Get data from the breakout and store them in class variables.

◆ getState()

byte Rotary::getState ( )

Get state of the rotary encoder.

Returns
0 If the rotary encoder doesn't move 1 If the button is presed once 2 If the button is pressed twice 3 If the button is long pressed 4 For long button press release 5 If the rotary encoder rotates counterclockwise 6 If the rotary encoder rotates clockwise

◆ initializeNative()

void Rotary::initializeNative ( )
protectedvirtual

Overloaded function for virtual in base class to initialize sensor specific.

Implements EasyC.

◆ resetCounter()

void Rotary::resetCounter ( )

Reset the internal counter on the breakout.

Member Data Documentation

◆ rotaryCounter

long Rotary::rotaryCounter
private

◆ rotaryState

byte Rotary::rotaryState
private

The documentation for this class was generated from the following files: