diff options
author | Dominik Wenger <domonoky@googlemail.com> | 2008-10-25 15:57:18 +0000 |
---|---|---|
committer | Dominik Wenger <domonoky@googlemail.com> | 2008-10-25 15:57:18 +0000 |
commit | 3ae419d9557e7db0312407bcda29237d31e6b4be (patch) | |
tree | e21f4474d7e2b66ceab3357ab209955e0f7ed084 /firmware/target/arm/as3525/sansa-m200v2 | |
parent | b208000c3649526d0eeb73a328e4052759bc773c (diff) | |
download | rockbox-3ae419d9557e7db0312407bcda29237d31e6b4be.tar.gz rockbox-3ae419d9557e7db0312407bcda29237d31e6b4be.zip |
fill in button and backlight functions for m200 "v2"
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18874 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm/as3525/sansa-m200v2')
3 files changed, 60 insertions, 6 deletions
diff --git a/firmware/target/arm/as3525/sansa-m200v2/backlight-target.h b/firmware/target/arm/as3525/sansa-m200v2/backlight-target.h index 9533d0a6b5..50404f7090 100644 --- a/firmware/target/arm/as3525/sansa-m200v2/backlight-target.h +++ b/firmware/target/arm/as3525/sansa-m200v2/backlight-target.h @@ -23,15 +23,18 @@ static inline bool _backlight_init(void) { + GPIOD_DIR |= (1<<1); return true; } static inline void _backlight_on(void) { + GPIOD_PIN(1) = (1<<1); } static inline void _backlight_off(void) { + GPIOD_PIN(1) = 0x00; } #endif diff --git a/firmware/target/arm/as3525/sansa-m200v2/button-m200v2.c b/firmware/target/arm/as3525/sansa-m200v2/button-m200v2.c index cd31d06720..c5d6c4941d 100644 --- a/firmware/target/arm/as3525/sansa-m200v2/button-m200v2.c +++ b/firmware/target/arm/as3525/sansa-m200v2/button-m200v2.c @@ -26,18 +26,68 @@ 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 btn = BUTTON_NONE; + 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 btn; + return result; } bool button_hold(void) { - /* TODO */ - return false; + bool ret = false; + + GPIOA_PIN(6) = (1<<6); + if (GPIOA_PIN(2)) + ret = true; + GPIOA_PIN(6) = 0x00; + + return ret; } diff --git a/firmware/target/arm/as3525/sansa-m200v2/button-target.h b/firmware/target/arm/as3525/sansa-m200v2/button-target.h index acf80b2ed7..779f7400bb 100644 --- a/firmware/target/arm/as3525/sansa-m200v2/button-target.h +++ b/firmware/target/arm/as3525/sansa-m200v2/button-target.h @@ -40,10 +40,11 @@ bool button_hold(void); #define BUTTON_LEFT 0x00000020 #define BUTTON_RIGHT 0x00000040 #define BUTTON_SELECT 0x00000080 +#define BUTTON_HOLD 0x00000100 #define BUTTON_MAIN (BUTTON_MENU|BUTTON_VOLUP|BUTTON_VOLDOWN\ |BUTTON_PLAYPAUSE|BUTTON_REPEATAB|BUTTON_LEFT\ - |BUTTON_RIGHT|BUTTON_SELECT) + |BUTTON_RIGHT|BUTTON_SELECT|BUTTON_HOLD) #define BUTTON_REMOTE 0 |