I2C: ensure RCC_AFIO is on

This commit is contained in:
King Kévin 2018-03-15 18:53:54 +01:00
parent 5357985bad
commit 06664a3916
1 changed files with 1 additions and 0 deletions

View File

@ -50,6 +50,7 @@
void i2c_general_setup_master(bool fast)
{
// configure I2C peripheral
rcc_periph_clock_enable(RCC_AFIO); // enable clock for I2C alternate function
rcc_periph_clock_enable(RCC_I2C_SCL_PORT(I2C_GENERAL_I2C)); // enable clock for I2C I/O peripheral
gpio_set(I2C_SCL_PORT(I2C_GENERAL_I2C), I2C_SCL_PIN(I2C_GENERAL_I2C)); // already put signal high to avoid small pulse
gpio_set_mode(I2C_SCL_PORT(I2C_GENERAL_I2C), GPIO_MODE_OUTPUT_2_MHZ, GPIO_CNF_OUTPUT_ALTFN_OPENDRAIN, I2C_SCL_PIN(I2C_GENERAL_I2C)); // setup I2C I/O pins