mirror of https://github.com/ARMmbed/mbed-os.git
Bugfixes for I2C and port impl
parent
4e23b72a78
commit
a574fd73b3
|
@ -122,6 +122,15 @@ void i2c_init(i2c_t *obj, PinName sda, PinName scl) {
|
||||||
|
|
||||||
pinmap_pinout(sda, PinMap_I2C_SDA);
|
pinmap_pinout(sda, PinMap_I2C_SDA);
|
||||||
pinmap_pinout(scl, PinMap_I2C_SCL);
|
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) {
|
inline int i2c_start(i2c_t *obj) {
|
||||||
|
|
|
@ -17,8 +17,9 @@
|
||||||
#include "pinmap.h"
|
#include "pinmap.h"
|
||||||
#include "gpio_api.h"
|
#include "gpio_api.h"
|
||||||
|
|
||||||
|
|
||||||
PinName port_pin(PortName port, int pin_n) {
|
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) {
|
void port_init(port_t *obj, PortName port, int mask, PinDirection dir) {
|
||||||
|
|
Loading…
Reference in New Issue