*
* \brief Driver for the AT91 ARM TWI (implementation)
*
- * \version $Id$
*
* \author Francesco Sacchi <batt@develer.com>
*/
#include "twi_at91.h"
-#include "cfg/cfg_twi.h"
+#include "cfg/cfg_i2c.h"
#include <cfg/compiler.h>
#include <cfg/debug.h>
#include <cfg/macros.h>
/*
* Start reception.
* Kludge: if we want to receive only 1 byte, the stop but *must* be set here
- * (thanks to crappy twi implementation again).
+ * (thanks to crappy twi implementation again).
*/
if (size == 1)
{
/*
* Compute twi clock.
* CLDIV = ((Tlow * 2^CKDIV) -3) * Tmck
- * CHDIV = ((THigh * 2^CKDIV) -3) * Tmck
- * Only CLDIV is computed since CLDIV = CHDIV (50% duty cycle)
+ * CHDIV = ((THigh * 2^CKDIV) -3) * Tmck
+ * Only CLDIV is computed since CLDIV = CHDIV (50% duty cycle)
*/
- uint16_t cldiv, ckdiv = 0;
- while ((cldiv = ((CLOCK_FREQ / (2 * CONFIG_TWI_FREQ)) - 3) / (1 << ckdiv)) > 255)
+ uint16_t cldiv, ckdiv = 0;
+ while ((cldiv = ((CPU_FREQ / (2 * CONFIG_I2C_FREQ)) - 3) / (1 << ckdiv)) > 255)
ckdiv++;
/* Atmel errata states that ckdiv *must* be less than 5 for unknown reason */
MOD_INIT(twi);
}
+