From e7d3a86e45103b0f7875ff76ed04bc0212dd77cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?King=20K=C3=A9vin?= Date: Mon, 11 Jul 2022 18:47:36 +0200 Subject: [PATCH] softi2c_master: improve pin configuration --- softi2c_master.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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