diff options
author | barthess <barthess@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2011-02-09 15:00:08 +0000 |
---|---|---|
committer | barthess <barthess@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2011-02-09 15:00:08 +0000 |
commit | eddd171ec8a54080dbd354f9e90baf60a3436266 (patch) | |
tree | 43ec4c1297e3fe1c03413099f7f05cd66326bcdb /os/hal/platforms/STM32/i2c_lld.c | |
parent | 918ff6d6b67e49410f01d5e3578b29d135d72de0 (diff) | |
download | ChibiOS-eddd171ec8a54080dbd354f9e90baf60a3436266.tar.gz ChibiOS-eddd171ec8a54080dbd354f9e90baf60a3436266.tar.bz2 ChibiOS-eddd171ec8a54080dbd354f9e90baf60a3436266.zip |
I2C. Alberto's clock setting code tested. Minor changes.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/i2c_dev@2721 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 | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/os/hal/platforms/STM32/i2c_lld.c b/os/hal/platforms/STM32/i2c_lld.c index 34b8d377e..df2685387 100644 --- a/os/hal/platforms/STM32/i2c_lld.c +++ b/os/hal/platforms/STM32/i2c_lld.c @@ -225,14 +225,11 @@ void i2c_lld_start(I2CDriver *i2cp) { i2cp->id_i2c->CR1 = 0; i2c_lld_set_clock(i2cp); - + i2cp->id_i2c->CR2 |= I2C_CR2_ITERREN | I2C_CR2_ITEVTEN | I2C_CR2_ITBUFEN; i2cp->id_i2c->CR1 |= 1; // enable interface } - - -// int32_t clock_speed, I2C_DutyCycle_t duty - +//TODO: dox here void i2c_lld_set_clock(I2CDriver *i2cp) { volatile uint16_t regCCR, regCR2, freq, clock_div; volatile uint16_t pe_bit_saved; @@ -403,8 +400,7 @@ void i2c_lld_master_start(I2CDriver *i2cp){ while (i2cp->id_i2c->CR1 & I2C_CR1_START); // enable interrupts - i2cp->id_i2c->CR2 |= I2C_CR2_ITEVTEN; - i2cp->id_i2c->CR2 |= I2C_CR2_ITBUFEN; + i2cp->id_i2c->CR2 |= I2C_CR2_ITEVTEN | I2C_CR2_ITBUFEN; } void i2c_lld_master_stop(I2CDriver *i2cp){ |