1 /* 2 * Common functions for keypad description access. These are provided in a 3 * header file for convenient incorporation into libraries without worrying 4 * about linkage, symbol visibility, and so on. 5 * 6 * Copyright (C) 2018 Paul Boddie <paul@boddie.org.uk> 7 * 8 * This program is free software; you can redistribute it and/or 9 * modify it under the terms of the GNU General Public License as 10 * published by the Free Software Foundation; either version 2 of 11 * the License, or (at your option) any later version. 12 * 13 * This program is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU General Public License for more details. 17 * 18 * You should have received a copy of the GNU General Public License 19 * along with this program; if not, write to the Free Software 20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, 21 * Boston, MA 02110-1301, USA 22 */ 23 24 #pragma once 25 26 #include "keypad.h" 27 28 /* Obtain the common instance. */ 29 30 void *keypad_get(void) 31 { 32 return reinterpret_cast<void *>(Keypad_generic::get_keypad()); 33 } 34 35 /* Number of keypad columns. */ 36 37 int keypad_columns(void *keypad) 38 { 39 return static_cast<Keypad_generic *>(keypad)->columns(); 40 } 41 42 /* Number of keypad rows, used by each value in the column array. */ 43 44 int keypad_rows(void *keypad) 45 { 46 return static_cast<Keypad_generic *>(keypad)->rows(); 47 } 48 49 /* Keycode accessors. */ 50 51 int keypad_code(void *keypad, int column, int row) 52 { 53 return static_cast<Keypad_generic *>(keypad)->code(column, row); 54 }