File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
targets/TARGET_STM/TARGET_STM32L4 Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change 3131#define MBED_I2C_DEVICE_H
3232
3333#include "cmsis.h"
34+ #include "mbed_error.h"
3435
3536#ifdef __cplusplus
3637extern "C" {
@@ -82,6 +83,23 @@ static inline uint32_t get_i2c_timing(int hz)
8283 default :
8384 break ;
8485 }
86+ } else if (SystemCoreClock == 120000000 ) {
87+ // Common settings: I2C clock = 120 MHz, Analog filter = ON, Digital filter coefficient = 0
88+ switch (hz ) {
89+ case 100000 :
90+ tim = 0x107075B0 ; // Standard mode with Rise Time = 400ns and Fall Time = 100ns
91+ break ;
92+ case 400000 :
93+ tim = 0x00501E6C ; // Fast mode with Rise Time = 250ns and Fall Time = 100ns
94+ break ;
95+ case 1000000 :
96+ tim = 0x00200A26 ; // Fast mode Plus with Rise Time = 60ns and Fall Time = 100ns
97+ break ;
98+ default :
99+ break ;
100+ }
101+ } else {
102+ error ("get_i2c_timing error\n" );
85103 }
86104 return tim ;
87105}
You can’t perform that action at this time.
0 commit comments