sources and files for the bombatuino project
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
#include "Arduino.h"
#include "bombatuino_ROTARY_ENCODER.h"
ROTARY_ENCODER::ROTARY_ENCODER(XcrementFunction incrementFunction, XcrementFunction decrementFunction) { _increment = incrementFunction; _decrement = decrementFunction; _pinA = LOW; _pinB = LOW; _oldA = LOW; }
void ROTARY_ENCODER::setPinB(int value) { _pinB = value; onPinChange(); }
void ROTARY_ENCODER::setPinA(int value) { _pinA = value; onPinChange(); }
void ROTARY_ENCODER::onPinChange() { if ((_oldA == LOW) && (_pinA == HIGH)) { if (_pinB == LOW) { (*_increment)(); } else { (*_decrement)(); } } _oldA = _pinA; }
|