Bugfixes for I2C and port impl

pull/83/head
Andreas Rebert 2013-10-11 14:01:49 +02:00
parent 4e23b72a78
commit a574fd73b3
2 changed files with 11 additions and 1 deletions

View File

@ -122,6 +122,15 @@ void i2c_init(i2c_t *obj, PinName sda, PinName scl) {
pinmap_pinout(sda, PinMap_I2C_SDA);
pinmap_pinout(scl, PinMap_I2C_SCL);
// OpenDrain must explicitly be enabled for p0.0 and p0.1
if (sda == P0_0) {
pin_mode(sda, OpenDrain);
}
if (scl == P0_1) {
pin_mode(scl, OpenDrain);
}
}
inline int i2c_start(i2c_t *obj) {

View File

@ -17,8 +17,9 @@
#include "pinmap.h"
#include "gpio_api.h"
PinName port_pin(PortName port, int pin_n) {
return (PinName)(LPC_GPIO0_BASE + ((port << PORT_SHIFT) | pin_n));
return (PinName)(((port << PORT_SHIFT) | pin_n));
}
void port_init(port_t *obj, PortName port, int mask, PinDirection dir) {