Fix I2C0 pin init

pull/488/head
jesusalvarez 2014-09-03 11:12:50 -04:00
parent 4e3b149f79
commit 49e01fb232
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];