diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2010-08-17 13:23:41 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2010-08-17 13:23:41 +0000 |
commit | 4e26a3b42cb49974f63d1b8727d7b1d1830c9c81 (patch) | |
tree | 12c7970c2a76583baff5108acedd0d4cc395abf7 /os/hal/src | |
parent | 8b45c58317683148179c9964e67c8f7d0683257b (diff) | |
download | ChibiOS-4e26a3b42cb49974f63d1b8727d7b1d1830c9c81.tar.gz ChibiOS-4e26a3b42cb49974f63d1b8727d7b1d1830c9c81.tar.bz2 ChibiOS-4e26a3b42cb49974f63d1b8727d7b1d1830c9c81.zip |
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2133 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/src')
-rw-r--r-- | os/hal/src/i2c.c | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/os/hal/src/i2c.c b/os/hal/src/i2c.c index 03d882446..cc48c4147 100644 --- a/os/hal/src/i2c.c +++ b/os/hal/src/i2c.c @@ -104,19 +104,24 @@ void i2cStop(I2CDriver *i2cp) { }
/**
- * @brief Initiates a master bus transaction. + * @brief Initiates a master bus transaction.
+ * @details This function sends a start bit followed by an one or two bytes
+ * header.
*
* @param[in] i2cp pointer to the @p I2CDriver object
+ * @param[in] header transaction header
* @param[in] callback operation complete callback
*/
-void i2cMasterStartI(I2CDriver *i2cp, i2ccallback_t callback) {
+void i2cMasterStartI(I2CDriver *i2cp,
+ uint16_t header,
+ i2ccallback_t callback) {
chDbgCheck((i2cp != NULL) && (callback != NULL), "i2cMasterStartI");
- chDbgAssert((i2cp->i2c_state == I2C_READY) || (i2cp->i2c_state == I2C_MREADY),
+ chDbgAssert(i2cp->i2c_state == I2C_READY,
"i2cMasterStartI(), #1", "invalid state");
i2cp->id_callback = callback;
- i2c_lld_master_start(i2cp);
+ i2c_lld_master_start(i2cp, header);
}
/**
@@ -135,6 +140,24 @@ void i2cMasterStopI(I2CDriver *i2cp, i2ccallback_t callback) { i2c_lld_master_stop(i2cp);
}
+
+/**
+ * @brief Sends a restart bit.
+ * @details Restart bits are required by some types of I2C transactions.
+ *
+ * @param[in] i2cp pointer to the @p I2CDriver object
+ * @param[in] callback operation complete callback
+ */
+void i2cMasterRestartI(I2CDriver *i2cp, i2ccallback_t callback) {
+
+ chDbgCheck((i2cp != NULL) && (callback != NULL), "i2cMasterRestartI");
+ chDbgAssert(i2cp->i2c_state == I2C_MREADY,
+ "i2cMasterRestartI(), #1", "invalid state");
+
+ i2cp->id_callback = callback;
+ i2c_lld_master_restart(i2cp);
+}
+
/**
* @brief Master transmission.
*
|