aboutsummaryrefslogtreecommitdiffstats
path: root/libmaple/include
diff options
context:
space:
mode:
authorMarti Bolivar <mbolivar@leaflabs.com>2012-06-21 17:04:32 -0400
committerMarti Bolivar <mbolivar@leaflabs.com>2012-06-22 14:06:10 -0400
commit001997b815e70f6a7707e765982b6f321afb961a (patch)
tree7a6fc846bbfaaf18350dffa334adf9e0ad6f91dd /libmaple/include
parent9ba028ef647bc033e5ec078acd7de9d5c28432a9 (diff)
downloadlibrambutan-001997b815e70f6a7707e765982b6f321afb961a.tar.gz
librambutan-001997b815e70f6a7707e765982b6f321afb961a.zip
i2c_dev: deprecate .gpio_port.
This won't work on F2, which at times has SDA and SCL on different ports (e.g. I2C3 SDA on PC9, SCL on PA8). Add .sda_port and .scl_port replacements, which are used when the now-deprecated .gpio_port is null. Use them correctly everywhere, with some new i2c_private.h helper functionality. Sigh. The F1 I2C code tries too hard to guess what you wanted; it's not porting well at all. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
Diffstat (limited to 'libmaple/include')
-rw-r--r--libmaple/include/libmaple/i2c_common.h19
1 files changed, 18 insertions, 1 deletions
diff --git a/libmaple/include/libmaple/i2c_common.h b/libmaple/include/libmaple/i2c_common.h
index 2f36f80..5d99530 100644
--- a/libmaple/include/libmaple/i2c_common.h
+++ b/libmaple/include/libmaple/i2c_common.h
@@ -65,7 +65,24 @@ typedef struct i2c_dev {
struct i2c_msg *msg; /**< Messages */
uint32 error_flags; /**< Error flags, set on I2C error condition */
volatile uint32 timestamp; /**< For internal use */
- struct gpio_dev *gpio_port; /**< SDA, SCL pins' GPIO port */
+
+ /**
+ * @brief Deprecated. Use .scl_port or .sda_port instead.
+ * If non-null, this will be used as SDA, SCL pins' GPIO port. If
+ * null, then .sda_port will be used for SDA, and .sda_port for
+ * SDA. */
+ struct gpio_dev *gpio_port;
+
+ /**
+ * @brief SDA GPIO device (but see .gpio_port).
+ */
+ struct gpio_dev *sda_port;
+
+ /**
+ * @brief SCL GPIO device (but see .gpio_port).
+ */
+ struct gpio_dev *scl_port;
+
uint16 msgs_left; /**< Messages left */
uint8 sda_pin; /**< SDA bit on gpio_port */
uint8 scl_pin; /**< SCL bit on gpio_port */