KeyboardTest: a test program for KeyboardManager lib

Dependencies:   mbed KeyboardManager

main.cpp

Committer:
osmeest
Date:
2011-01-23
Revision:
3:c20e3d23ce5f
Parent:
1:842d3b0ce532
Child:
4:392068d3f56d

File content as of revision 3:c20e3d23ce5f:

#include "kbd_mgr/KeyboardManager.h"

#include <iostream>

using namespace std;
using namespace kbd_mgr;

class KeyHandler : public KeyPressEventHandler {
public:
    virtual void operator()(int key, bool state) {
        cout << "Key state change: " << key << " " << (state ? "Down" : "Up") << "\r" << endl;
    }
};

int main() {
    cout << "\n\r\nKeyboardTest " __DATE__ "-" __TIME__ "\r" << endl;

    PinName outPinsArray[] = { p8, p7, p6, p5 };
    KeyboardManager::OutPinsSet outPins(&outPinsArray[0], &outPinsArray[4]); 
    KeyHandler handler;

    KeyboardManager kbd(Port0, 4, 15, outPins, &handler);
    
    kbd.start();
    
    while(1) {
        wait(10);
    }
}