Markus Pilz / Mbed 2 deprecated PS2toUSBHIDAdapter

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers PS2Keyboard.cpp Source File

PS2Keyboard.cpp

00001 /**
00002  * PS/2 keyboard interface control class (Version 0.0.1)
00003  *
00004  * Copyright (C) 2010 Shinichiro Nakamura (CuBeatSystems)
00005  * http://shinta.main.jp/
00006  *
00007  * Modified by pilzm
00008  */
00009 #include "PS2Keyboard.h"
00010 
00011 PS2Keyboard::PS2Keyboard(PinName clk_pin, PinName dat_pin)
00012         : ps2kb_init(clk_pin, dat_pin), ps2kb(clk_pin, dat_pin) {
00013 }
00014 
00015 PS2Keyboard::~PS2Keyboard() {
00016 }
00017 
00018 bool PS2Keyboard::processing(keyboard_event_t *p) {
00019     bool emit = true;
00020     int sc = ps2kb.getc();
00021     if (0 <= sc) {
00022         p->scancode=sc;
00023     }
00024     return emit;
00025 }