Markus Tschuchnik
/
TinfTest
Tschuchnik
Diff: main.cpp
- Revision:
- 0:3e843e64ce84
- Child:
- 1:26e8a018be37
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Nov 29 17:16:04 2018 +0000 @@ -0,0 +1,48 @@ +#include "mbed.h" + +class IsA : BusOut{ + + IsA():BusOut(LED1, LED2, LED3, LED4){}; + + void LedOff(){write(0x00);} + + void LedOn(int lVal){write(lval)}; + void LedOn(){write(0x0f);} + + }; + +class IsAnEvent : public InterruptIn { + volatile int16_t _pressed; + void _RisingISR(); + public: + IsAnEvent() : InterruptIn(p15) {}; + IsAnEvent(PinName pin) : InterruptIn(pin) { + rise(callback(this, &IsAnEvent::_RisingISR)); + _pressed=0; + }; + int CheckFlag(); + void InitIsr(); +}; + +void IsAnEvent::InitIsr() { + rise(callback(this, &IsAnEvent::_RisingISR)); +} + +void IsAnEvent::_RisingISR() { + wait_ms(50); + if( read() ) + _pressed = true; +} +int IsAnEvent::CheckFlag() { + if( _pressed ) { + _pressed = false; + return 1; + } + return 0; +} + +int main() { + while(1) { + + } +}