This library is togle sw on/off edge and level decision. input sw level noise and chatting cancel. MDX-20 controler用
Fork of DigitalSw by
Diff: DigitalSw.cpp
- Revision:
- 7:b8d12d3d6ff0
- Parent:
- 6:55845c4ef887
diff -r 55845c4ef887 -r b8d12d3d6ff0 DigitalSw.cpp --- a/DigitalSw.cpp Sun Dec 11 01:28:31 2016 +0000 +++ b/DigitalSw.cpp Sun Dec 11 07:32:41 2016 +0000 @@ -21,6 +21,7 @@ } else { _sw.mode(PullDown); } + reset(); _sw.rise(this, &DigitalSw::swLevelUp); _sw.fall(this, &DigitalSw::swLevelDown); @@ -32,10 +33,11 @@ { _onEdge = 0; _offEdge = 0; - _levelNow = 1; - _levelOld = 1; + _levelNow = _sw.read(); + _levelOld = _sw.read(); } + int16_t DigitalSw::getLevel(void) { if(_levelNow == 0){