aboutsummaryrefslogtreecommitdiffstats
path: root/libmaple/include
diff options
context:
space:
mode:
authorMarti Bolivar <mbolivar@leaflabs.com>2012-06-21 15:04:39 -0400
committerMarti Bolivar <mbolivar@leaflabs.com>2012-06-22 14:06:10 -0400
commitbaf9dd6a8275160fdf5a4ff63efa2678f16b1cc3 (patch)
tree1ea72208adc17873ab2287f25cc3720cf40576bf /libmaple/include
parentf34ba402c9a39acc43828918313a30d2fbc4e186 (diff)
downloadlibrambutan-baf9dd6a8275160fdf5a4ff63efa2678f16b1cc3.tar.gz
librambutan-baf9dd6a8275160fdf5a4ff63efa2678f16b1cc3.zip
I2C: Add i2c_config_gpios(), i2c_master_release_bus().
These are necessary to pull out some calls to gpio_set_mode(). Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
Diffstat (limited to 'libmaple/include')
-rw-r--r--libmaple/include/libmaple/i2c.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/libmaple/include/libmaple/i2c.h b/libmaple/include/libmaple/i2c.h
index 9f65f13..8ce6674 100644
--- a/libmaple/include/libmaple/i2c.h
+++ b/libmaple/include/libmaple/i2c.h
@@ -288,6 +288,31 @@ static inline void i2c_disable_ack(i2c_dev *dev) {
dev->regs->CR1 &= ~I2C_CR1_ACK;
}
+/* GPIO control */
+
+/**
+ * @brief Configure device GPIOs.
+ *
+ * Configure GPIO bits dev->sda_pin and dev->scl_pin on GPIO device
+ * dev->gpio_port for use with I2C device dev.
+ *
+ * @param dev I2C Device
+ * @see i2c_release_gpios()
+ */
+extern void i2c_config_gpios(const i2c_dev *dev);
+
+/**
+ * @brief Release GPIOs controlling an I2C bus
+ *
+ * Releases the I2C bus controlled by dev as master, and disconnects
+ * GPIO bits dev->sda_pin and dev->scl_pin on GPIO device
+ * dev->gpio_port from I2C device dev.
+ *
+ * @param dev I2C device
+ * @see i2c_config_gpios()
+ */
+extern void i2c_master_release_bus(const i2c_dev *dev);
+
/* Miscellaneous low-level routines */
void i2c_init(i2c_dev *dev);