static void i2c_probe_slaves(I2C_ID_T i2c) { int i; uint8_t ch[2]; DEBUGOUT("Probing available I2C devices...\r\n"); DEBUGOUT("\r\n 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F"); DEBUGOUT("\r\n===================================================="); for (i = 0; i <= 0x7F; i++) { if (!(i & 0x0F)) DEBUGOUT("\r\n%02X ", i >> 4); if (i <= 7 || i > 0x78) { DEBUGOUT(" "); continue; } /* Address 0x48 points to LM75AIM device which needs 2 bytes be read */ if(Chip_I2C_MasterRead(i2c, i, ch, 1 + (i == 0x48)) > 0) DEBUGOUT(" %02X", i); else DEBUGOUT(" --"); } DEBUGOUT("\r\n"); } |
void Chip_I2C_EventHandler(I2C_ID_T id, I2C_EVENT_T event) { struct i2c_interface *iic = &i2c[id]; volatile I2C_STATUS_T *stat; /* Only WAIT event needs to be handled */ if (event != I2C_EVENT_WAIT) { return; } stat = &iic->mXfer->status; /* Wait for the status to change */ while (*stat == I2C_STATUS_BUSY) {} } |
Chip_IOCON_PinMux(LPC_IOCON, 0, 19, IOCON_MODE_INACT, IOCON_FUNC3); Chip_IOCON_PinMux(LPC_IOCON, 0, 20, IOCON_MODE_INACT, IOCON_FUNC3); |
Chip_IOCON_PinMux(LPC_IOCON, 0, 19, IOCON_MODE_INACT, IOCON_FUNC2); Chip_IOCON_PinMux(LPC_IOCON, 0, 20, IOCON_MODE_INACT, IOCON_FUNC2); |