Skip to content
This repository was archived by the owner on Jun 5, 2019. It is now read-only.

Commit 513f5ae

Browse files
authored
Merge pull request #469 from techcap/support_I2C2
support I2C2
2 parents 9c5dd1c + 3f8b128 commit 513f5ae

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

DeviceCode/Targets/Native/STM32F4/DeviceCode/STM32F4_I2C/STM32F4_i2c_functions.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,10 @@ BOOL I2C_Internal_Initialize()
165165
currentI2CUnit = NULL;
166166

167167
// set pins to AF4 and open drain
168-
CPU_GPIO_DisablePin( STM32F4_I2C_SDA_PIN, RESISTOR_PULLUP, 0, (GPIO_ALT_MODE)0x43 );
169-
CPU_GPIO_DisablePin( STM32F4_I2C_SCL_PIN, RESISTOR_PULLUP, 0, (GPIO_ALT_MODE)0x43 );
168+
if (STM32F4_I2C_PORT == 2 && STM32F4_I2C_SDA_PIN == 25)//PB9
169+
CPU_GPIO_DisablePin(STM32F4_I2C_SDA_PIN, RESISTOR_PULLUP, 0, (GPIO_ALT_MODE)0x93); //AF9
170+
else
171+
CPU_GPIO_DisablePin(STM32F4_I2C_SDA_PIN, RESISTOR_PULLUP, 0, (GPIO_ALT_MODE)0x43); //AF4
170172

171173
RCC->APB1ENR |= RCC_APB1ENR_I2CxEN; // enable I2C clock
172174
RCC->APB1RSTR = RCC_APB1RSTR_I2CxRST; // reset I2C peripheral

0 commit comments

Comments
 (0)