From 408361402385ea938575956e9368b5f373edc629 Mon Sep 17 00:00:00 2001 From: yiancar Date: Sat, 10 Nov 2018 12:26:39 -0800 Subject: I2C driver docs (#4298) * I2C driver docs - Added I2C driver docs. - Changed arm master i2c driver to have a weak i2c_init as it is impossible to account for all possible port configuration in the STM32 world. * Update docs/i2c_driver.md Co-Authored-By: yiancar * Update docs/i2c_driver.md Co-Authored-By: yiancar * Update docs/i2c_driver.md Co-Authored-By: yiancar * Update docs/i2c_driver.md Co-Authored-By: yiancar * GPIO release fix --- drivers/arm/i2c_master.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/arm/i2c_master.c b/drivers/arm/i2c_master.c index 2a7badd35..de5843839 100644 --- a/drivers/arm/i2c_master.c +++ b/drivers/arm/i2c_master.c @@ -26,6 +26,7 @@ */ #include "i2c_master.h" +#include "quantum.h" #include #include @@ -41,9 +42,11 @@ static const I2CConfig i2cconfig = { 0 }; +__attribute__ ((weak)) void i2c_init(void) { - palSetGroupMode(GPIOB, GPIOB_PIN6 | GPIOB_PIN7, 0, PAL_MODE_INPUT); // Try releasing special pins for a short time + setPinInput(B6); // Try releasing special pins for a short time + setPinInput(B7); chThdSleepMilliseconds(10); palSetPadMode(GPIOB, 6, PAL_MODE_ALTERNATE(4) | PAL_STM32_OTYPE_OPENDRAIN | PAL_STM32_PUPDR_PULLUP); -- cgit v1.2.3-24-g4f1b