| CheeseBoard
    A library for use with the CheeseBoard Cheddar platform | 
#include <CbRotaryInput.h>
| Public Types | |
| typedef void(* | t_buttonCb) (uint16_t) | 
| typedef void(* | t_rotaryCb) (int8_t, int32_t) | 
| Public Member Functions | |
| CbRotaryInputClass (uint8_t buttonPin, uint8_t aPin, uint8_t bPin) | |
| void | begin (t_buttonCb buttonCb=NULL, t_rotaryCb rotaryCb=NULL) | 
| void | update () | 
| int32_t | getEncoderPosition () | 
| bool | buttonPushed () | 
Handy wrapper class for the dual functions of the rotary encoder device:
This class lets a user register callbacks to be triggered when the rotary encoder is moved and/or the button is pushed.
Definition at line 18 of file CbRotaryInput.h.
| typedef void(* CbRotaryInputClass::t_buttonCb) (uint16_t) | 
A function pointer to a fuction which can be used as a callback for button presses.
The parameter to the function is the number of milliseconds the button was pushed for.
Definition at line 25 of file CbRotaryInput.h.
| typedef void(* CbRotaryInputClass::t_rotaryCb) (int8_t, int32_t) | 
A function pointer to a fuction which can be used as a callback for rotary movement events.
The parameters to the function are:
| int8_t | the direction of turn. -1 mean widdershins, +1 means anti-widdershins. | 
| int32_t | the current position of the rotary dial. It starts at 0 and accumulates. | 
Definition at line 34 of file CbRotaryInput.h.
| CbRotaryInputClass::CbRotaryInputClass | ( | uint8_t | buttonPin, | 
| uint8_t | aPin, | ||
| uint8_t | bPin | ||
| ) | 
Constructor.
| buttonPin | the pin to which the button leg of the encoder input is attached. | 
| aPin | the pin to which the A leg of the rotary encoder input is attached. | 
| bPin | the pin to which the B leg of the rotary encoder input is attached. | 
Definition at line 7 of file CbRotaryInput.cpp.
| void CbRotaryInputClass::begin | ( | t_buttonCb | buttonCb = NULL, | 
| t_rotaryCb | rotaryCb = NULL | ||
| ) | 
Initializtion.
| buttonCb | pointer to function which will be called when the button is pushed. | 
| rotaryCb | pointer to function which will be called when the encoder is moved. | 
This function is typically called from begin() in sketches.
Definition at line 19 of file CbRotaryInput.cpp.
| bool CbRotaryInputClass::buttonPushed | ( | ) | 
Test if the button is currently pushed.
Definition at line 54 of file CbRotaryInput.cpp.
| int32_t CbRotaryInputClass::getEncoderPosition | ( | ) | 
Fetch the current position of the rotary encoder
Definition at line 49 of file CbRotaryInput.cpp.
| void CbRotaryInputClass::update | ( | ) | 
Update the state of the CbRotaryInputClass.
Should be called frequently (at least every few ms), typically from loop().
Definition at line 27 of file CbRotaryInput.cpp.
 1.8.13
 1.8.13