diff options
author | barthess <barthess@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2012-01-02 19:25:44 +0000 |
---|---|---|
committer | barthess <barthess@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2012-01-02 19:25:44 +0000 |
commit | e43bc0f96757b20d256d117e42289ffa92c2d296 (patch) | |
tree | 4292bed36e44c54a7e2ccdbb9181f6f86b0cc46b /os/hal/platforms/STM32/i2c_lld.c | |
parent | 68580cf650b16b3b62116d71d94b3a7bb84ceec7 (diff) | |
download | ChibiOS-e43bc0f96757b20d256d117e42289ffa92c2d296.tar.gz ChibiOS-e43bc0f96757b20d256d117e42289ffa92c2d296.tar.bz2 ChibiOS-e43bc0f96757b20d256d117e42289ffa92c2d296.zip |
I2C. Clock checks moved to header file.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3713 35acf78f-673a-0410-8e92-d51de3d6d3f4
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; |