mirror of https://github.com/ARMmbed/mbed-os.git
commit
ce5e32074e
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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];
|
||||
|
|
Loading…
Reference in New Issue