/*
* Copyright (c) 2005 Jesse Off. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
*
* The matrix keypad is a primitive type of keying device
* commonly used in systems as a small, cheap, easy-to-build and rugged
* way to get user input in a variety of embedded environments. This
* driver can work for any size of keypad. A one key keypad (aka
* button) can also be used. The theory of operation is described
* thusly:
*
* 1) The keypad is connected to the NetBSD embedded system
* with digital I/O (DIO) pins connected to each column of
* the keypad and also to each row of the keypad.
*
* 2) When a button is pressed, a short is made between a
* column line and the intersecting row line.
*
* 3) Software is responsible to poll each row/column individually
* and also to debounce any key presses.
*
* To correctly wire up such a thing requires the input DIO
* lines to have pull-up resistors, otherwise an input may be read as a random
* value if not currently being shorted by a button press.
*/