diff options
Diffstat (limited to 'os/hal/platforms/STM32/i2c_lld.c')
-rw-r--r-- | os/hal/platforms/STM32/i2c_lld.c | 35 |
1 files changed, 1 insertions, 34 deletions
diff --git a/os/hal/platforms/STM32/i2c_lld.c b/os/hal/platforms/STM32/i2c_lld.c index 51e41d4fe..2641e54b9 100644 --- a/os/hal/platforms/STM32/i2c_lld.c +++ b/os/hal/platforms/STM32/i2c_lld.c @@ -95,9 +95,6 @@ restrictions. /* Driver constants. */ /*===========================================================================*/ -/* Peripheral clock frequency */ -#define I2C_CLK_FREQ ((STM32_PCLK1) / 1000000) - /*===========================================================================*/ /* Driver exported variables. */ /*===========================================================================*/ @@ -144,40 +141,10 @@ static void i2c_lld_set_clock(I2CDriver *i2cp) { chDbgCheck((i2cp != NULL) && (clock_speed > 0) && (clock_speed <= 4000000), "i2c_lld_set_clock"); + /** * CR2 Configuration */ -#if defined(STM32F4XX) - #if (!(I2C_CLK_FREQ >= 2) && (I2C_CLK_FREQ <= 42)) - #error "Peripheral clock freq. out of range." - #endif - -#elif defined(STM32L1XX_MD) - #if (!(I2C_CLK_FREQ >= 2) && (I2C_CLK_FREQ <= 32)) - #error "Peripheral clock freq. out of range." - #endif - -#elif defined(STM32F2XX) - #if (!(I2C_CLK_FREQ >= 2) && (I2C_CLK_FREQ <= 30)) - #error "Peripheral clock freq. out of range." - #endif - -#elif defined(STM32F10X_LD_VL) || defined(STM32F10X_MD_VL) || \ - defined(STM32F10X_HD_VL) - #if (!(I2C_CLK_FREQ >= 2) && (I2C_CLK_FREQ <= 24)) - #error "Peripheral clock freq. out of range." - #endif - -#elif defined(STM32F10X_LD) || defined(STM32F10X_MD) || \ - defined(STM32F10X_HD) || defined(STM32F10X_XL) || \ - defined(STM32F10X_CL) - #if (!(I2C_CLK_FREQ >= 2) && (I2C_CLK_FREQ <= 36)) - #error "Peripheral clock freq. out of range." - #endif - -#else -#error "unspecified, unsupported or invalid STM32 platform" -#endif i2cp->i2c->CR2 &= (uint16_t)~I2C_CR2_FREQ; /* Clear frequency FREQ[5:0] bits */ i2cp->i2c->CR2 |= (uint16_t)I2C_CLK_FREQ; |