PS2 Library
PS2Keyboard.h@0:ce15490e89e9, 2011-02-27 (annotated)
- Committer:
- wjohnsto
- Date:
- Sun Feb 27 23:34:31 2011 +0000
- Revision:
- 0:ce15490e89e9
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
wjohnsto | 0:ce15490e89e9 | 1 | /** |
wjohnsto | 0:ce15490e89e9 | 2 | * PS/2 keyboard interface control class (Version 0.0.1) |
wjohnsto | 0:ce15490e89e9 | 3 | * |
wjohnsto | 0:ce15490e89e9 | 4 | * Copyright (C) 2010 Shinichiro Nakamura (CuBeatSystems) |
wjohnsto | 0:ce15490e89e9 | 5 | * http://shinta.main.jp/ |
wjohnsto | 0:ce15490e89e9 | 6 | */ |
wjohnsto | 0:ce15490e89e9 | 7 | #ifndef _PS2_KEYBOARD_H_ |
wjohnsto | 0:ce15490e89e9 | 8 | #define _PS2_KEYBOARD_H_ |
wjohnsto | 0:ce15490e89e9 | 9 | |
wjohnsto | 0:ce15490e89e9 | 10 | #include "PS2KB_INIT.h" |
wjohnsto | 0:ce15490e89e9 | 11 | #include "PS2KB.h" |
wjohnsto | 0:ce15490e89e9 | 12 | |
wjohnsto | 0:ce15490e89e9 | 13 | class PS2Keyboard { |
wjohnsto | 0:ce15490e89e9 | 14 | public: |
wjohnsto | 0:ce15490e89e9 | 15 | PS2Keyboard(PinName clk_pin, PinName dat_pin); |
wjohnsto | 0:ce15490e89e9 | 16 | ~PS2Keyboard(); |
wjohnsto | 0:ce15490e89e9 | 17 | typedef enum { |
wjohnsto | 0:ce15490e89e9 | 18 | KeyMake, |
wjohnsto | 0:ce15490e89e9 | 19 | KeyBreak |
wjohnsto | 0:ce15490e89e9 | 20 | } Type; |
wjohnsto | 0:ce15490e89e9 | 21 | typedef struct { |
wjohnsto | 0:ce15490e89e9 | 22 | Type type; |
wjohnsto | 0:ce15490e89e9 | 23 | int length; |
wjohnsto | 0:ce15490e89e9 | 24 | char scancode[8]; |
wjohnsto | 0:ce15490e89e9 | 25 | } keyboard_event_t; |
wjohnsto | 0:ce15490e89e9 | 26 | bool processing(keyboard_event_t *p); |
wjohnsto | 0:ce15490e89e9 | 27 | private: |
wjohnsto | 0:ce15490e89e9 | 28 | PS2KB_INIT ps2kb_init; |
wjohnsto | 0:ce15490e89e9 | 29 | PS2KB ps2kb; |
wjohnsto | 0:ce15490e89e9 | 30 | int count; |
wjohnsto | 0:ce15490e89e9 | 31 | char scancode[8]; |
wjohnsto | 0:ce15490e89e9 | 32 | }; |
wjohnsto | 0:ce15490e89e9 | 33 | |
wjohnsto | 0:ce15490e89e9 | 34 | #endif |