aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbarthess <barthess@35acf78f-673a-0410-8e92-d51de3d6d3f4>2012-01-05 19:19:13 +0000
committerbarthess <barthess@35acf78f-673a-0410-8e92-d51de3d6d3f4>2012-01-05 19:19:13 +0000
commitc048ac69ff536f95a814b8b121842e120b36988b (patch)
tree74906d1b0d65700366da4f288517705fa7cb051f
parentb109cacb8af5ec7f4ca9bb96b190b96ed21f1c97 (diff)
downloadChibiOS-c048ac69ff536f95a814b8b121842e120b36988b.tar.gz
ChibiOS-c048ac69ff536f95a814b8b121842e120b36988b.tar.bz2
ChibiOS-c048ac69ff536f95a814b8b121842e120b36988b.zip
I2C. Initialization of RC2 register now doing only once in start() function.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3744 35acf78f-673a-0410-8e92-d51de3d6d3f4
-rw-r--r--os/hal/platforms/STM32/i2c_lld.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/os/hal/platforms/STM32/i2c_lld.c b/os/hal/platforms/STM32/i2c_lld.c
index 8865be470..eade3bb8a 100644
--- a/os/hal/platforms/STM32/i2c_lld.c
+++ b/os/hal/platforms/STM32/i2c_lld.c
@@ -147,6 +147,7 @@ static void i2c_lld_abort_operation(I2CDriver *i2cp) {
/* Stops the I2C peripheral.*/
i2cp->i2c->CR1 = I2C_CR1_SWRST;
i2cp->i2c->CR1 = 0;
+ i2cp->i2c->CR2 = 0;
i2cp->i2c->SR1 = 0;
/* Stops the associated DMA streams.*/
@@ -311,11 +312,9 @@ static void i2c_lld_serve_event_interrupt(I2CDriver *i2cp) {
break;
case I2C_EV6_MASTER_REC_MODE_SELECTED:
dmaStreamEnable(i2cp->dmarx);
- i2cp->i2c->CR2 |= I2C_CR2_DMAEN | I2C_CR2_LAST;
break;
case I2C_EV6_MASTER_TRA_MODE_SELECTED:
dmaStreamEnable(i2cp->dmatx);
- i2cp->i2c->CR2 |= I2C_CR2_DMAEN | I2C_CR2_LAST;
break;
case I2C_EV8_2_MASTER_BYTE_TRANSMITTED:
/* Catches BTF event after the end of transmission.*/
@@ -669,7 +668,8 @@ void i2c_lld_start(I2CDriver *i2cp) {
/* Reset i2c peripheral.*/
i2cp->i2c->CR1 = I2C_CR1_SWRST;
i2cp->i2c->CR1 = 0;
- i2cp->i2c->CR2 = I2C_CR2_ITERREN | I2C_CR2_ITEVTEN;
+ i2cp->i2c->CR2 = I2C_CR2_ITERREN | I2C_CR2_ITEVTEN |
+ I2C_CR2_DMAEN | I2C_CR2_LAST;
/* Setup I2C parameters.*/
i2c_lld_set_clock(i2cp);