@@ -57,9 +57,13 @@ extern "C" {
57
57
#if !defined (STM32F1xx ) && !defined (STM32F2xx ) && !defined (STM32F4xx ) && \
58
58
!defined (STM32L1xx )
59
59
#define I2C_TIMING
60
+ #if !defined(I2C_TIMING_SM ) || !defined(I2C_TIMING_FM ) || !defined(I2C_TIMING_FMP )
61
+ #define I2C_TIMING_COMPUTE
62
+ #endif /* !(I2C_TIMING_SM) || !(I2C_TIMING_FM) || !(I2C_TIMING_FMP)*/
63
+
60
64
#endif
61
65
62
- #ifdef I2C_TIMING
66
+ #ifdef I2C_TIMING_COMPUTE
63
67
#ifndef I2C_VALID_TIMING_NBR
64
68
#define I2C_VALID_TIMING_NBR 8U
65
69
#endif
@@ -152,7 +156,7 @@ static const I2C_Charac_t I2C_Charac[] = {
152
156
.dnf = I2C_DIGITAL_FILTER_COEF ,
153
157
}
154
158
};
155
- #endif /* I2C_TIMING */
159
+ #endif /* I2C_TIMING_COMPUTE */
156
160
157
161
/* Family specific description for I2C */
158
162
typedef enum {
@@ -180,7 +184,7 @@ typedef enum {
180
184
/* Private Variables */
181
185
static I2C_HandleTypeDef * i2c_handles [I2C_NUM ];
182
186
183
- #ifdef I2C_TIMING
187
+ #ifdef I2C_TIMING_COMPUTE
184
188
/**
185
189
* @brief This function return the I2C clock source frequency.
186
190
* @param i2c: I2C instance
@@ -565,7 +569,7 @@ static uint32_t i2c_computeTiming(uint32_t clkSrcFreq, uint32_t i2c_speed)
565
569
}
566
570
return ret ;
567
571
}
568
- #endif /* I2C_TIMING */
572
+ #endif /* I2C_TIMING_COMPUTE */
569
573
570
574
/**
571
575
* @brief Compute I2C timing according current I2C clock source and
@@ -587,6 +591,9 @@ static uint32_t i2c_getTiming(i2c_t *obj, uint32_t frequency)
587
591
i2c_speed = 1000000 ;
588
592
}
589
593
#ifdef I2C_TIMING
594
+ #ifndef I2C_TIMING_COMPUTE
595
+ UNUSED (obj );
596
+ #endif
590
597
if (i2c_speed != 0U ) {
591
598
switch (i2c_speed ) {
592
599
default :
0 commit comments