aboutsummaryrefslogtreecommitdiffstats
path: root/include/keypad.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/keypad.h')
-rw-r--r--include/keypad.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/include/keypad.h b/include/keypad.h
index 5eec1fc..2e5fa9c 100644
--- a/include/keypad.h
+++ b/include/keypad.h
@@ -1,3 +1,23 @@
+/**
+ * @file keypad.h
+ * Manages the GPIO keypad
+ *
+ * Copyright (C) 2018 Clyne Sullivan
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
#ifndef KEYPAD_H_
#define KEYPAD_H_
@@ -16,9 +36,21 @@
#define KS (uint16_t)(1 << 10)
#define KP (uint16_t)(1 << 11)
+/**
+ * Initializes GPIO for the keypad. Must be called before any keypad reading.
+ */
void keypad_init(void);
+/**
+ * Reads the state of the keypad and returns it.
+ * @return the keypad's state
+ */
uint16_t keypad_get(void);
+
+/**
+ * Tests if the given key is currently pressed, returning non-zero if it is.
+ * @return non-zero if pressed
+ */
uint8_t keypad_isdown(uint16_t);
#endif // KEYPAD_H_