Rotary encoder library. Add: void setInterval(timestamp_t t) for Nucleo F401RE
Fork of RotaryEncoder by
Diff: RotaryEncoder.h
- Revision:
- 5:60c44df48016
- Parent:
- 4:7a50a5d3682c
- Child:
- 6:cfc8f362bce6
--- a/RotaryEncoder.h Sun Jun 12 08:48:43 2016 +0000 +++ b/RotaryEncoder.h Sat Sep 22 23:39:43 2018 +0000 @@ -93,8 +93,18 @@ * * @param The interval in microseconds. */ - void setInterval(timestamp_t t) { - ticker.attach_us(this, &RotaryEncoder::func_ticker, t); + void setInterval(us_timestamp_t t) { + interval = t; + ticker.attach_us(callback(this, &RotaryEncoder::func_ticker), t); + } + + /** + * Get the ticker interval. + * + * @return the ticker interval. + */ + us_timestamp_t getInterval() const { + return interval; } private: @@ -104,6 +114,7 @@ const int max; int val; Ticker ticker; + us_timestamp_t interval; uint8_t code;