summaryrefslogtreecommitdiffstats
path: root/firmware/target/arm/as3525/sansa-m200v2/button-m200v4.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2008-11-10 09:27:40 +0000
committerDaniel Stenberg <daniel@haxx.se>2008-11-10 09:27:40 +0000
commit044ba22b93e5b8fdd74c5f8d59d3b63b9d148c41 (patch)
tree25f2f4d264f06a5f081a58433b2f2b8ea8967596 /firmware/target/arm/as3525/sansa-m200v2/button-m200v4.c
parentab7ac8b8bd5b2fe2b209820ab83cb7cca958abf8 (diff)
downloadrockbox-044ba22b93e5b8fdd74c5f8d59d3b63b9d148c41.tar.gz
rockbox-044ba22b93e5b8fdd74c5f8d59d3b63b9d148c41.zip
"mv m200v2 m200v4"
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19060 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm/as3525/sansa-m200v2/button-m200v4.c')
-rw-r--r--firmware/target/arm/as3525/sansa-m200v2/button-m200v4.c93
1 files changed, 93 insertions, 0 deletions
diff --git a/firmware/target/arm/as3525/sansa-m200v2/button-m200v4.c b/firmware/target/arm/as3525/sansa-m200v2/button-m200v4.c
new file mode 100644
index 0000000000..c5d6c4941d
--- /dev/null
+++ b/firmware/target/arm/as3525/sansa-m200v2/button-m200v4.c
@@ -0,0 +1,93 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2008 by ??
+ *
+ * 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 2
+ * of the License, or (at your option) any later version.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+
+#include "config.h"
+#include "cpu.h"
+#include "button.h"
+#include "adc.h"
+
+void button_init_device(void)
+{
+ GPIOA_DIR &= ~((1<<3) | (1<<2) | (1<<1) | (1<<0)); /* A3-A0 is input */
+ GPIOA_DIR |= ((1<<6) | (1<<5) | (1<<4)); /* A4-A6 row outputs */
+}
+
+int button_read_device(void)
+{
+ int result = BUTTON_NONE;
+
+ /* direct GPIO connections */
+ if (GPIOA_PIN(3))
+ result |= BUTTON_MENU;
+
+ /* This is a keypad using A4-A6 as columns and A0-A2 as rows */
+ GPIOA_PIN(4) = (1<<4);
+
+ /* A4A0 is unused */
+
+ if (GPIOA_PIN(1))
+ result |= BUTTON_VOLDOWN;
+
+ if (GPIOA_PIN(2))
+ result |= BUTTON_PLAYPAUSE;
+
+ GPIOA_PIN(4) = 0x00;
+
+ GPIOA_PIN(5) = (1<<5);
+
+ if (GPIOA_PIN(0))
+ result |= BUTTON_LEFT;
+
+ if (GPIOA_PIN(1))
+ result |= BUTTON_SELECT;
+
+ if (GPIOA_PIN(2))
+ result |= BUTTON_RIGHT;
+
+ GPIOA_PIN(5) = 0x00;
+
+
+ GPIOA_PIN(6) = (1<<6);
+
+ if (GPIOA_PIN(0))
+ result |= BUTTON_REPEATAB;
+
+ if (GPIOA_PIN(1))
+ result |= BUTTON_VOLUP;
+
+ if (GPIOA_PIN(2))
+ result |= BUTTON_HOLD;
+ GPIOA_PIN(6) = 0x00;
+
+ return result;
+}
+
+bool button_hold(void)
+{
+ bool ret = false;
+
+ GPIOA_PIN(6) = (1<<6);
+ if (GPIOA_PIN(2))
+ ret = true;
+ GPIOA_PIN(6) = 0x00;
+
+ return ret;
+}