mac-plus-ps2/mac_plus_ps2/PS2Keyboard.h

60 lines
2.0 KiB
C++

/*
PS2Keyboard.h - PS2Keyboard library
Copyright (c) 2007 Free Software Foundation. All right reserved.
Written by Christian Weichel <info@32leaves.net>
** Mostly rewritten Paul Stoffregen <paul@pjrc.com>, June 2010
** Modified for use with Arduino 13 by L. Abraham Smith, <n3bah@microcompdesign.com> *
** Modified for easy interrup pin assignement on method begin(datapin,irq_pin). Cuningan <cuninganreset@gmail.com> **
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef PS2Keyboard_h
#define PS2Keyboard_h
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h" // for attachInterrupt, FALLING
#else
#include "WProgram.h"
#endif
#include "utility/int_pins.h"
/**
* Purpose: Provides an easy access to PS2 keyboards
* Author: Christian Weichel
*/
class PS2Keyboard {
public:
/**
* This constructor does basically nothing. Please call the begin(int,int)
* method before using any other method of this class.
*/
PS2Keyboard();
/**
* Starts the keyboard "service" by registering the external interrupt.
* setting the pin modes correctly and driving those needed to high.
* The propably best place to call this method is in the setup routine.
*/
static void begin(uint8_t dataPin, uint8_t irq_pin);
static int getScanCode();
};
#endif