aboutsummaryrefslogtreecommitdiffstats
path: root/libmaple/include/libmaple/i2c.h
diff options
context:
space:
mode:
authorMarti Bolivar <mbolivar@leaflabs.com>2012-06-20 14:05:34 -0400
committerMarti Bolivar <mbolivar@leaflabs.com>2012-06-22 14:06:09 -0400
commit2fa8bdb7509e81789e76ca95e8b537272ce95ad5 (patch)
tree7bc84c9cc2438a2a464a37905c7fec68615bdc04 /libmaple/include/libmaple/i2c.h
parent3029415c3ecf62a2c9f7270d0ddc83247d831168 (diff)
downloadlibrambutan-2fa8bdb7509e81789e76ca95e8b537272ce95ad5.tar.gz
librambutan-2fa8bdb7509e81789e76ca95e8b537272ce95ad5.zip
Move i2c_dev and i2c_state into new i2c_common.h.
This is necessary to add series-specific infrastructure to clean up some F1-isms in <libmaple/i2c.h>'s inline functions. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
Diffstat (limited to 'libmaple/include/libmaple/i2c.h')
-rw-r--r--libmaple/include/libmaple/i2c.h29
1 files changed, 2 insertions, 27 deletions
diff --git a/libmaple/include/libmaple/i2c.h b/libmaple/include/libmaple/i2c.h
index db5e6c8..d327c72 100644
--- a/libmaple/include/libmaple/i2c.h
+++ b/libmaple/include/libmaple/i2c.h
@@ -38,6 +38,8 @@ extern "C" {
#endif
#include <series/i2c.h>
+#include <libmaple/i2c_common.h>
+
#include <libmaple/libmaple_types.h>
#include <libmaple/rcc.h>
#include <libmaple/nvic.h>
@@ -56,15 +58,6 @@ typedef struct i2c_reg_map {
__io uint32 TRISE; /**< TRISE (rise time) register */
} i2c_reg_map;
-/** I2C device states */
-typedef enum i2c_state {
- I2C_STATE_DISABLED = 0, /**< Disabled */
- I2C_STATE_IDLE = 1, /**< Idle */
- I2C_STATE_XFER_DONE = 2, /**< Done with transfer */
- I2C_STATE_BUSY = 3, /**< Busy */
- I2C_STATE_ERROR = -1 /**< Error occurred */
-} i2c_state;
-
/**
* @brief I2C message type
*/
@@ -79,24 +72,6 @@ typedef struct i2c_msg {
uint8 *data; /**< Data */
} i2c_msg;
-/**
- * @brief I2C device type.
- */
-typedef struct i2c_dev {
- i2c_reg_map *regs; /**< Register map */
- 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 */
- uint16 msgs_left; /**< Messages left */
- uint8 sda_pin; /**< SDA bit on gpio_port */
- uint8 scl_pin; /**< SCL bit on gpio_port */
- rcc_clk_id clk_id; /**< RCC clock information */
- nvic_irq_num ev_nvic_line; /**< Event IRQ number */
- nvic_irq_num er_nvic_line; /**< Error IRQ number */
- volatile i2c_state state; /**< Device state */
-} i2c_dev;
-
/*
* Register bit definitions
*/