diff --git a/softi2c_master.c b/softi2c_master.c index 04b9d11..7725148 100644 --- a/softi2c_master.c +++ b/softi2c_master.c @@ -83,11 +83,11 @@ bool softi2c_master_setup(uint16_t freq_khz) // switch pins to open drain SCL_PORT->ODR.reg |= SCL_PIN; // ensure clock is high - SCL_PORT->DDR.reg |= SCL_PIN; // switch pin to output SCL_PORT->CR1.reg &= ~SCL_PIN; // use in open-drain mode + SCL_PORT->DDR.reg |= SCL_PIN; // switch pin to output SDA_PORT->ODR.reg |= SDA_PIN; // ensure data is high - SDA_PORT->DDR.reg |= SDA_PIN; // switch pin to output SDA_PORT->CR1.reg &= ~SDA_PIN; // use in open-drain mode + SDA_PORT->DDR.reg |= SDA_PIN; // switch pin to output I2C_delay(); // give time to get high return (read_SCL() && read_SDA()); // line is ready when the two lines are high