fix mode (using fast mode instead of standard)
This commit is contained in:
parent
bfa791f6f2
commit
6fa9c0096e
|
@ -66,7 +66,7 @@ void led_tm1637_setup(void)
|
|||
i2c_reset(I2C(LED_TM1637_I2C)); // reset configuration
|
||||
i2c_peripheral_disable(I2C(LED_TM1637_I2C)); // I2C needs to be disable to be configured
|
||||
i2c_set_clock_frequency(I2C(LED_TM1637_I2C), rcc_apb1_frequency/1000000); // configure the peripheral clock to the APB1 freq (where it is connected to)
|
||||
i2c_set_standard_mode(I2C(LED_TM1637_I2C));
|
||||
i2c_set_fast_mode(I2C(LED_TM1637_I2C));
|
||||
i2c_set_ccr(I2C(LED_TM1637_I2C), rcc_apb1_frequency/(400000*2)); // set Thigh/Tlow to generate frequency of 400 kHz
|
||||
i2c_set_trise(I2C(LED_TM1637_I2C), (300/(1000/(rcc_apb1_frequency/1000000)))+1); // max rise time for 300 kHz is 300 ns
|
||||
i2c_peripheral_enable(I2C(LED_TM1637_I2C)); // enable I2C after configuration completed
|
||||
|
|
Loading…
Reference in New Issue