CheeseBoard
A library for use with the CheeseBoard Cheddar platform
src
CbRotaryInput.h
1
#pragma once
2
3
#include <Encoder.h>
4
#include <DebouncedButton.h>
5
#include <stdint.h>
6
18
class
CbRotaryInputClass
{
19
public
:
25
typedef
void (*
t_buttonCb
)(uint16_t);
26
34
typedef
void (*
t_rotaryCb
)(int8_t, int32_t);
35
42
CbRotaryInputClass
(uint8_t buttonPin, uint8_t aPin, uint8_t bPin);
43
51
void
begin
(
t_buttonCb
buttonCb=NULL,
t_rotaryCb
rotaryCb=NULL);
52
57
void
update
();
58
64
int32_t
getEncoderPosition
();
65
70
bool
buttonPushed
();
71
72
private
:
73
DebouncedButton _button;
74
Encoder _encoder;
75
int32_t _position;
76
t_buttonCb
_buttonCb;
77
t_rotaryCb
_rotatyCb;
78
79
};
80
82
extern
CbRotaryInputClass
CbRotaryInput;
83
CbRotaryInputClass::t_rotaryCb
void(* t_rotaryCb)(int8_t, int32_t)
Definition:
CbRotaryInput.h:34
CbRotaryInputClass::t_buttonCb
void(* t_buttonCb)(uint16_t)
Definition:
CbRotaryInput.h:25
CbRotaryInputClass::getEncoderPosition
int32_t getEncoderPosition()
Definition:
CbRotaryInput.cpp:49
CbRotaryInputClass::CbRotaryInputClass
CbRotaryInputClass(uint8_t buttonPin, uint8_t aPin, uint8_t bPin)
Definition:
CbRotaryInput.cpp:7
CbRotaryInputClass::update
void update()
Definition:
CbRotaryInput.cpp:27
CbRotaryInputClass::begin
void begin(t_buttonCb buttonCb=NULL, t_rotaryCb rotaryCb=NULL)
Definition:
CbRotaryInput.cpp:19
CbRotaryInputClass::buttonPushed
bool buttonPushed()
Definition:
CbRotaryInput.cpp:54
CbRotaryInputClass
Definition:
CbRotaryInput.h:18
Generated by
1.8.13