|
|
@ -25,18 +25,13 @@ void init_i2c(void) |
|
|
|
{ |
|
|
|
{ |
|
|
|
IREG(I2CONSET) = 0x40; /* Enable I2C ready for Master Tx */ |
|
|
|
IREG(I2CONSET) = 0x40; /* Enable I2C ready for Master Tx */ |
|
|
|
/* Set up for just under 400kHz */ |
|
|
|
/* Set up for just under 400kHz */ |
|
|
|
#if 0 |
|
|
|
#ifdef I2C_FAST |
|
|
|
IWREG(I2SCLL) = (25 * 100); |
|
|
|
IWREG(I2SCLL) = (25 * 100); |
|
|
|
IWREG(I2SCLH) = (12 * 100); |
|
|
|
IWREG(I2SCLH) = (12 * 100); |
|
|
|
#else |
|
|
|
|
|
|
|
# if 0 |
|
|
|
|
|
|
|
IWREG(I2SCLL) = 1475; /* ~5kHz */ |
|
|
|
|
|
|
|
IWREG(I2SCLH) = 1475; |
|
|
|
|
|
|
|
#else |
|
|
|
#else |
|
|
|
IWREG(I2SCLL) = 73; /* ~100kHz */ |
|
|
|
IWREG(I2SCLL) = 73; /* ~100kHz */ |
|
|
|
IWREG(I2SCLH) = 73; |
|
|
|
IWREG(I2SCLH) = 73; |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int i2cstat; |
|
|
|
int i2cstat; |
|
|
|