From 001997b815e70f6a7707e765982b6f321afb961a Mon Sep 17 00:00:00 2001 From: Marti Bolivar Date: Thu, 21 Jun 2012 17:04:32 -0400 Subject: 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 --- libmaple/include/libmaple/i2c_common.h | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'libmaple/include/libmaple') 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 */ -- cgit v1.2.3