Merge pull request #488 from micromint/master

LPC4330_M4 Fix I2C0 Init
pull/472/merge
Bogdan Marinescu 2014-09-11 16:29:10 +01:00
commit ce5e32074e
2 changed files with 6 additions and 5 deletions

View File

@ -101,11 +101,12 @@ void i2c_init(i2c_t *obj, PinName sda, PinName scl) {
i2c_conclr(obj, 1, 1, 1, 1);
i2c_interface_enable(obj);
// If pins are not dedicated, set SCU functions
if (sda != P_DED) {
// Set SCU functions
if (scl == P_DED) {
// Enable dedicated I2C0 SDA and SCL pins (open drain)
LPC_SCU->SFSI2C0 = (1 << 11) | (1 << 3);
} else {
pinmap_pinout(sda, PinMap_I2C_SDA);
}
if (scl != P_DED) {
pinmap_pinout(scl, PinMap_I2C_SCL);
}
}

View File

@ -103,7 +103,7 @@ void port_init(port_t *obj, PortName port, int mask, PinDirection dir) {
LPC_GPIO_T *port_reg = (LPC_GPIO_T *)(LPC_GPIO_PORT_BASE);
// Do not use masking, because it prevents the use of the unmasked pins
// obj->MASK[port] = ~mask;
// port_reg->MASK[port] = ~mask;
obj->reg_out = &port_reg->PIN[port];
obj->reg_in = &port_reg->PIN[port];