Open Andrei-Pozolotin opened 5 years ago
please add support for reactive callbacks, i.e.:
class RotaryReactor: public Rotary { private: static void noop() { } void (*reactorPositive)() = &noop; void (*reactorNegative)() = &noop; public: RotaryReactor(char pinA, char pinB) : Rotary(pinA, pinB) { } void attachReactorPositive(void (*reactor)()) { reactorPositive = reactor; } void attachReactorNegative(void (*reactor)()) { reactorNegative = reactor; } void react() { unsigned char result = this->process(); if (result == DIR_CW) { reactorPositive(); } else if (result == DIR_CCW) { reactorNegative(); } } };
please add support for reactive callbacks, i.e.: