summaryrefslogtreecommitdiffstats
path: root/firmware
diff options
context:
space:
mode:
authorRafaël Carré <rafael.carre@gmail.com>2011-12-14 21:04:04 +0000
committerRafaël Carré <rafael.carre@gmail.com>2011-12-14 21:04:04 +0000
commit273fbadb5537743829f9830de5247626a11aedca (patch)
tree850fe2271b3de1e19fba220bbc776107f396c48f /firmware
parentb366d63f035eda1cf7e4882463ea4a521b19fd85 (diff)
downloadrockbox-273fbadb5537743829f9830de5247626a11aedca.tar.gz
rockbox-273fbadb5537743829f9830de5247626a11aedca.zip
Clipv2: fix buttons broken by me in r31235
output pins were not correct xor pin readout with initial value (reversed between the 2 clips) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31255 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r--firmware/target/arm/as3525/button-clip.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/firmware/target/arm/as3525/button-clip.c b/firmware/target/arm/as3525/button-clip.c
index b6679ca359..04be8450fd 100644
--- a/firmware/target/arm/as3525/button-clip.c
+++ b/firmware/target/arm/as3525/button-clip.c
@@ -30,13 +30,13 @@
#if defined(SANSA_CLIP)
# define OUT_PIN GPIOC_PIN
# define OUT_DIR GPIOC_DIR
-# define OUT_INITIAL 0
+# define INITIAL 0
# define IN_PIN GPIOB_PIN
# define IN_DIR GPIOB_DIR
#elif defined(SANSA_CLIPV2)
# define OUT_PIN GPIOD_PIN
# define OUT_DIR GPIOD_DIR
-# define OUT_INITIAL 1
+# define INITIAL 1
# define IN_PIN GPIOD_PIN
# define IN_DIR GPIOD_DIR
#endif
@@ -45,7 +45,7 @@ static const int rows[3] = {
#if defined(SANSA_CLIP)
4, 5, 6
#elif defined(SANSA_CLIPV2)
- 5, 6, 4
+ 3, 4, 5
#endif
};
@@ -55,7 +55,7 @@ void button_init_device(void)
IN_DIR &= ~((1<<2) | (1<<1) | (1<<0));
for (int i = 0; i < 3; i++) {
- OUT_PIN(rows[i]) = OUT_INITIAL << rows[i];
+ OUT_PIN(rows[i]) = INITIAL << rows[i];
OUT_DIR |= 1 << rows[i];
}
@@ -95,16 +95,16 @@ int button_read_device(void)
};
for (int i = 0; i<3; i++)
- if (IN_PIN(i))
+ if (IN_PIN(i) ^ (INITIAL << i))
buttons |= matrix[row][i];
else
buttons &= ~matrix[row][i];
/* prepare next row */
- OUT_PIN(rows[row]) = 0 << rows[row];
+ OUT_PIN(rows[row]) = INITIAL << rows[row];
row++;
row %= 3;
- OUT_PIN(rows[row]) = 1 << rows[row];
+ OUT_PIN(rows[row]) = (!INITIAL) << rows[row];
return buttons;
}