sam3 port: add serial module.
[bertos.git] / bertos / cpu / cortex-m3 / drv / i2c_stm32.c
index 24c3e185a437067d27db742ce5938cd1b329ae3e..9fd53f0128e1ea249ad28101842a9ff4517267aa 100644 (file)
@@ -237,7 +237,7 @@ static void i2c_stm32_start(struct I2c *i2c, uint16_t slave_addr)
                start_r(i2c, slave_addr);
 }
 
-static void i2c_stm32_put(I2c *i2c, const uint8_t data)
+static void i2c_stm32_putc(I2c *i2c, const uint8_t data)
 {
        i2c->hw->base->DR = data;
 
@@ -251,7 +251,7 @@ static void i2c_stm32_put(I2c *i2c, const uint8_t data)
        }
 }
 
-static uint8_t i2c_stm32_get(I2c *i2c)
+static uint8_t i2c_stm32_getc(I2c *i2c)
 {
        if (i2c->hw->cached)
        {
@@ -297,13 +297,13 @@ static uint8_t i2c_stm32_get(I2c *i2c)
 static const I2cVT i2c_stm32_vt =
 {
        .start = i2c_stm32_start,
-       .get = i2c_stm32_get,
-       .put = i2c_stm32_put,
-       .send = i2c_swSend,
-       .recv = i2c_swRecv,
+       .getc = i2c_stm32_getc,
+       .putc = i2c_stm32_putc,
+       .write = i2c_genericWrite,
+       .read = i2c_genericRead,
 };
 
-struct I2cHardware i2c_stm32_hw[] =
+static struct I2cHardware i2c_stm32_hw[] =
 {
        { /* I2C1 */
                .base = (struct stm32_i2c *)I2C1_BASE,
@@ -317,8 +317,6 @@ struct I2cHardware i2c_stm32_hw[] =
        },
 };
 
-MOD_DEFINE(i2c);
-
 /**
  * Initialize I2C module.
  */
@@ -352,6 +350,4 @@ void i2c_hw_init(I2c *i2c, int dev, uint32_t clock)
        i2c->hw->base->TRISE |= (CR2_FREQ_36MHZ + 1);
 
        i2c->hw->base->CR1 |= CR1_PE_SET;
-
-       MOD_INIT(i2c);
 }