Adacallback support fromISR call

- change Prioprity for loop() to LOW
- defer interrupt for both hw and sw encoder to ada callback
This commit is contained in:
hathach committed 2017-09-15 17:56:24 +07:00
1 parent 9b71709c13
commit b2e49f2fc9
8 files changed
+26 -12

No files matched your search

+7 -4
View File
@@ -124,17 +124,20 @@ void SwRotaryEncoder::_irq_handler(void)
if ( val != _a_last )
{
int32_t step = 0;
if ( val != digitalRead(_pinb) )
{
_abs++;
if (_cb) _cb(1);
step = 1;
}else
{
_abs--;
if (_cb) _cb(-1);
step = -1;
}
_abs += step;
_a_last = val;
if (_cb) ada_callback_fromISR(NULL, _cb, step);
}
}