Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
You are viewing an older revision! See the latest version
Event Klasse
// ---------------- Event Klasse --------------------------
class SwEvent {
InterruptIn _isr;
int16_t _pressed;
void _RisingISR();
public:
SwEvent(PinName pin) : _isr(pin) {
_pressed=0;
}
int CheckFlag(); // das muss im do-Zweig (while(true) Schleife) ständig abgefragt werden
void Init();
};
int SwEvent::CheckFlag() {
if( _pressed )
{ _pressed=0; return 1; }
return 0;
}
void SwEvent::Init() {
_isr.rise(this, &SwEvent::_RisingISR);
}
void SwEvent::_RisingISR() {
if( _isr.read() )
_pressed = 1;
}
SwEvent sw1(P0_10);