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.
Abgeleitete Event Klasse
Der folgende Code zeigt die von Interrupt-Klasse abgeleitete Klasse für die interruptgesteuerte Tastenabfrage:
IsAnEvent Klasse
#include "mbed.h" 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; }