1 /* 2 * Copyright (c) 2009, Google Inc. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * * Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * * Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in 12 * the documentation and/or other materials provided with the 13 * distribution. 14 * * Neither the name of Google, Inc. nor the names of its contributors 15 * may be used to endorse or promote products derived from this 16 * software without specific prior written permission. 17 * 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 24 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 25 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 26 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 27 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 28 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29 * SUCH DAMAGE. 30 */ 31 32 #ifndef __DEV_KEYS_H 33 #define __DEV_KEYS_H 34 35 #include <sys/types.h> 36 37 /* these are just the ascii values for the chars */ 38 #define KEY_0 0x30 39 #define KEY_1 0x31 40 #define KEY_2 0x32 41 #define KEY_3 0x33 42 #define KEY_4 0x34 43 #define KEY_5 0x35 44 #define KEY_6 0x36 45 #define KEY_7 0x37 46 #define KEY_8 0x38 47 #define KEY_9 0x39 48 49 #define KEY_A 0x61 50 51 #define KEY_ESC 0x100 52 #define KEY_F1 0x101 53 #define KEY_F2 0x102 54 #define KEY_F3 0x103 55 #define KEY_F4 0x104 56 #define KEY_F5 0x105 57 #define KEY_F6 0x106 58 #define KEY_F7 0x107 59 #define KEY_F8 0x108 60 #define KEY_F9 0x109 61 62 #define KEY_LEFT 0x110 63 #define KEY_RIGHT 0x111 64 #define KEY_UP 0x112 65 #define KEY_DOWN 0x113 66 #define KEY_CENTER 0x114 67 68 #define KEY_VOLUMEUP 0x115 69 #define KEY_VOLUMEDOWN 0x116 70 #define KEY_MUTE 0x117 71 72 #define KEY_SOFT1 0x11a 73 #define KEY_SOFT2 0x11b 74 #define KEY_STAR 0x11c 75 #define KEY_SHARP 0x11d 76 #define KEY_MAIL 0x11e 77 78 #define KEY_SEND 0x120 79 #define KEY_CLEAR 0x121 80 #define KEY_HOME 0x122 81 #define KEY_BACK 0x123 82 83 #define MAX_KEYS 0x1ff 84 85 void keys_init(void); 86 void keys_post_event(uint16_t code, int16_t value); 87 int keys_get_state(uint16_t code); 88 89 #endif /* __DEV_KEYS_H */ 90