summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafaël Carré <rafael.carre@gmail.com>2010-05-05 02:27:18 +0000
committerRafaël Carré <rafael.carre@gmail.com>2010-05-05 02:27:18 +0000
commitaec0af541335731031d879ca491cd46d5ea7ba16 (patch)
tree1f2e0d9201a26d89b5c1951e2bf49add3d5fdcbb
parente6bb174c628a4d628c20353e8fab6d45458cc764 (diff)
downloadrockbox-aec0af541335731031d879ca491cd46d5ea7ba16.tar.gz
rockbox-aec0af541335731031d879ca491cd46d5ea7ba16.tar.bz2
rockbox-aec0af541335731031d879ca491cd46d5ea7ba16.zip
as3525 FM i2c : don't assume SCL and SDA are on the same GPIO
This seems to be the case for the Fuzev2 git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25817 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/target/arm/as3525/fmradio-i2c-as3525.c44
1 files changed, 26 insertions, 18 deletions
diff --git a/firmware/target/arm/as3525/fmradio-i2c-as3525.c b/firmware/target/arm/as3525/fmradio-i2c-as3525.c
index 622f339633..c86e3f53ab 100644
--- a/firmware/target/arm/as3525/fmradio-i2c-as3525.c
+++ b/firmware/target/arm/as3525/fmradio-i2c-as3525.c
@@ -32,26 +32,34 @@
#include "fmradio_i2c.h"
#if defined(SANSA_CLIP) || defined(SANSA_C200V2)
-#define I2C_GPIO(x) GPIOB_PIN(x)
-#define I2C_GPIO_DIR GPIOB_DIR
+#define I2C_SCL_GPIO(x) GPIOB_PIN(x)
+#define I2C_SDA_GPIO(x) GPIOB_PIN(x)
+#define I2C_SCL_GPIO_DIR GPIOB_DIR
+#define I2C_SDA_GPIO_DIR GPIOB_DIR
#define I2C_SCL_PIN 4
#define I2C_SDA_PIN 5
#elif defined(SANSA_CLIPV2) || defined(SANSA_CLIPPLUS)
-#define I2C_GPIO(x) GPIOB_PIN(x)
-#define I2C_GPIO_DIR GPIOB_DIR
+#define I2C_SCL_GPIO(x) GPIOB_PIN(x)
+#define I2C_SDA_GPIO(x) GPIOB_PIN(x)
+#define I2C_SCL_GPIO_DIR GPIOB_DIR
+#define I2C_SDA_GPIO_DIR GPIOB_DIR
#define I2C_SCL_PIN 6
#define I2C_SDA_PIN 7
#elif defined(SANSA_M200V4)
-#define I2C_GPIO(x) GPIOD_PIN(x)
-#define I2C_GPIO_DIR GPIOD_DIR
+#define I2C_SCL_GPIO(x) GPIOD_PIN(x)
+#define I2C_SDA_GPIO(x) GPIOD_PIN(x)
+#define I2C_SCL_GPIO_DIR GPIOD_DIR
+#define I2C_SDA_GPIO_DIR GPIOD_DIR
#define I2C_SCL_PIN 7
#define I2C_SDA_PIN 6
#elif defined(SANSA_FUZE) || defined(SANSA_E200V2)
-#define I2C_GPIO(x) GPIOA_PIN(x)
-#define I2C_GPIO_DIR GPIOA_DIR
+#define I2C_SCL_GPIO(x) GPIOA_PIN(x)
+#define I2C_SDA_GPIO(x) GPIOA_PIN(x)
+#define I2C_SCL_GPIO_DIR GPIOA_DIR
+#define I2C_SDA_GPIO_DIR GPIOA_DIR
#define I2C_SCL_PIN 6
#define I2C_SDA_PIN 7
@@ -63,52 +71,52 @@ static int fm_i2c_bus;
static void fm_scl_hi(void)
{
- I2C_GPIO(I2C_SCL_PIN) = 1 << I2C_SCL_PIN;
+ I2C_SCL_GPIO(I2C_SCL_PIN) = 1 << I2C_SCL_PIN;
}
static void fm_scl_lo(void)
{
- I2C_GPIO(I2C_SCL_PIN) = 0;
+ I2C_SCL_GPIO(I2C_SCL_PIN) = 0;
}
static void fm_sda_hi(void)
{
- I2C_GPIO(I2C_SDA_PIN) = 1 << I2C_SDA_PIN;
+ I2C_SDA_GPIO(I2C_SDA_PIN) = 1 << I2C_SDA_PIN;
}
static void fm_sda_lo(void)
{
- I2C_GPIO(I2C_SDA_PIN) = 0;
+ I2C_SDA_GPIO(I2C_SDA_PIN) = 0;
}
static void fm_sda_input(void)
{
- I2C_GPIO_DIR &= ~(1 << I2C_SDA_PIN);
+ I2C_SDA_GPIO_DIR &= ~(1 << I2C_SDA_PIN);
}
static void fm_sda_output(void)
{
- I2C_GPIO_DIR |= 1 << I2C_SDA_PIN;
+ I2C_SDA_GPIO_DIR |= 1 << I2C_SDA_PIN;
}
static void fm_scl_input(void)
{
- I2C_GPIO_DIR &= ~(1 << I2C_SCL_PIN);
+ I2C_SCL_GPIO_DIR &= ~(1 << I2C_SCL_PIN);
}
static void fm_scl_output(void)
{
- I2C_GPIO_DIR |= 1 << I2C_SCL_PIN;
+ I2C_SCL_GPIO_DIR |= 1 << I2C_SCL_PIN;
}
static int fm_sda(void)
{
- return I2C_GPIO(I2C_SDA_PIN);
+ return I2C_SDA_GPIO(I2C_SDA_PIN);
}
static int fm_scl(void)
{
- return I2C_GPIO(I2C_SCL_PIN);
+ return I2C_SCL_GPIO(I2C_SCL_PIN);
}
/* simple and crude delay, used for all delays in the generic i2c driver */