CheeseBoard
A library for use with the CheeseBoard Cheddar platform
CbRotaryInput.h
1 #pragma once
2 
3 #include <Encoder.h>
4 #include <DebouncedButton.h>
5 #include <stdint.h>
6 
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 
void(* t_rotaryCb)(int8_t, int32_t)
Definition: CbRotaryInput.h:34
void(* t_buttonCb)(uint16_t)
Definition: CbRotaryInput.h:25
int32_t getEncoderPosition()
CbRotaryInputClass(uint8_t buttonPin, uint8_t aPin, uint8_t bPin)
void begin(t_buttonCb buttonCb=NULL, t_rotaryCb rotaryCb=NULL)