*
* \brief Driver for the LM3S I2C (implementation)
*
+ * \author Daniele Basile <asterix@develer.com>
+ *
*/
#include "cfg/cfg_i2c.h"
#include <cfg/debug.h>
#include <cfg/macros.h> // BV()
-#include <cfg/module.h>
#include <cpu/detect.h>
#include <cpu/irq.h>
return true;
}
-static void i2c_lm3s_put(I2c *i2c, const uint8_t data)
+static void i2c_lm3s_putc(I2c *i2c, const uint8_t data)
{
HWREG(i2c->hw->base + I2C_O_MDR) = data;
}
}
-static uint8_t i2c_lm3s_get(I2c *i2c)
+static uint8_t i2c_lm3s_getc(I2c *i2c)
{
uint8_t data;
if (i2c->hw->first_xtranf)
return data;
}
-MOD_DEFINE(i2c);
-
static const I2cVT i2c_lm3s_vt =
{
.start = i2c_lm3s_start,
- .get = i2c_lm3s_get,
- .put = i2c_lm3s_put,
- .send = i2c_swSend,
- .recv = i2c_swRecv,
+ .getc = i2c_lm3s_getc,
+ .putc = i2c_lm3s_putc,
+ .write = i2c_genericWrite,
+ .read = i2c_genericRead,
};
-struct I2cHardware i2c_lm3s_hw[] =
+static struct I2cHardware i2c_lm3s_hw[] =
{
{ /* I2C0 */
.base = I2C0_MASTER_BASE,
* to the desired clock, never greater.
*/
HWREG(i2c->hw->base + I2C_O_MTPR) = ((CPU_FREQ + (2 * 10 * clock) - 1) / (2 * 10 * clock)) - 1;
-
- MOD_INIT(i2c);
}