aboutsummaryrefslogtreecommitdiffstats
path: root/libmaple/stm32f1/include/series
diff options
context:
space:
mode:
authorMarti Bolivar <mbolivar@leaflabs.com>2012-06-21 16:04:18 -0400
committerMarti Bolivar <mbolivar@leaflabs.com>2012-06-22 14:06:10 -0400
commit4d133982271fd063779174d1695e14c7821c6da6 (patch)
treec08584759d953e6e1eed61d6af540a57903388d4 /libmaple/stm32f1/include/series
parent70f22b667a7d91c68d663c1bf9ef1c0bdcbdd377 (diff)
downloadlibrambutan-4d133982271fd063779174d1695e14c7821c6da6.tar.gz
librambutan-4d133982271fd063779174d1695e14c7821c6da6.zip
I2C: Deprecate I2C_REMAP flag.
This is ad-hoc and nonportable. If you really want I2C mapped elsewhere, then mess with the I2C device fields and call afio_remap() yourself. (This is also cleaner for F2). Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
Diffstat (limited to 'libmaple/stm32f1/include/series')
-rw-r--r--libmaple/stm32f1/include/series/i2c.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/libmaple/stm32f1/include/series/i2c.h b/libmaple/stm32f1/include/series/i2c.h
index 315a7e3..a0822e8 100644
--- a/libmaple/stm32f1/include/series/i2c.h
+++ b/libmaple/stm32f1/include/series/i2c.h
@@ -34,6 +34,7 @@
#define _LIBMAPLE_STM32F1_I2C_H_
#include <libmaple/i2c_common.h>
+#include <libmaple/gpio.h>
#include <libmaple/stm32.h>
/*
@@ -66,4 +67,19 @@ static inline uint32 _i2c_bus_clk(i2c_dev *dev) {
#define _I2C_HAVE_IRQ_FIXUP 1
void _i2c_irq_priority_fixup(i2c_dev *dev);
+/*
+ * Deprecated functionality
+ */
+
+/* Flag to use alternate pin mapping in i2c_master_enable(). */
+#define _I2C_HAVE_DEPRECATED_I2C_REMAP 1
+#define I2C_REMAP 0x4
+static inline void _i2c_handle_remap(i2c_dev *dev, uint32 flags) {
+ if ((dev == I2C1) && (flags & I2C_REMAP)) {
+ afio_remap(AFIO_REMAP_I2C1);
+ I2C1->sda_pin = 9;
+ I2C1->scl_pin = 8;
+ }
+}
+
#endif /* _LIBMAPLE_STM32F1_I2C_H_ */