1

change keyboard demo to event listener

This commit is contained in:
2022-07-11 22:51:03 +02:00
parent 60bb0cea78
commit 5ca6d25c7c
9 changed files with 58 additions and 14 deletions

View File

@ -8,8 +8,8 @@
* Autor: Michael Schoettner, HHU, 26.10.2018 *
*****************************************************************************/
#include "lib/Input.h"
#include "user/demo/KeyboardDemo.h"
#include "lib/Input.h"
void KeyboardDemo::run() {
@ -18,7 +18,9 @@ void KeyboardDemo::run() {
kout << "Keyboard Demo: " << endl;
while (true) {
kout << getch();
kout << listener.waitForKeyEvent();
// kout << getch();
kout.flush();
}
}

View File

@ -13,14 +13,18 @@
#include "kernel/Globals.h"
#include "kernel/threads/Thread.h"
#include "user/KeyEventListener.h"
class KeyboardDemo : public Thread {
private:
KeyboardDemo(const KeyboardDemo& copy) = delete;
KeyEventListener listener;
public:
KeyboardDemo() {
KeyboardDemo() : listener(*this) {
kout << "Initialized KeyboardDemo" << endl;
kevman.subscribe(listener);
}
void run() override;