diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2013-11-04 15:15:16 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2013-11-04 15:15:16 +0000 |
commit | 279205bd7f03df3d8e863780af1f39fc22a7b364 (patch) | |
tree | 8818c6411cca25fc8ce23ef0cddd8b5455dfafe7 /os/hal | |
parent | 202661e81e18dad821a1855caf39add96440f6cf (diff) | |
download | ChibiOS-279205bd7f03df3d8e863780af1f39fc22a7b364.tar.gz ChibiOS-279205bd7f03df3d8e863780af1f39fc22a7b364.tar.bz2 ChibiOS-279205bd7f03df3d8e863780af1f39fc22a7b364.zip |
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@6417 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal')
-rw-r--r-- | os/hal/ports/STM32/I2Cv1/i2c_lld.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/os/hal/ports/STM32/I2Cv1/i2c_lld.c b/os/hal/ports/STM32/I2Cv1/i2c_lld.c index 81a0f3d34..cc4b183d1 100644 --- a/os/hal/ports/STM32/I2Cv1/i2c_lld.c +++ b/os/hal/ports/STM32/I2Cv1/i2c_lld.c @@ -76,6 +76,9 @@ ((uint32_t)(((I2C_SR2_MSL | I2C_SR2_BUSY | I2C_SR2_TRA) << 16) | \
I2C_SR1_BTF | I2C_SR1_TXE))
+#define I2C_EV9_MASTER_ADD10 \
+ ((uint32_t)(((I2C_SR2_MSL | I2C_SR2_BUSY) << 16) | I2C_SR1_ADD10))
+
#define I2C_EV_MASK 0x00FFFFFF
#define I2C_ERROR_MASK \
@@ -249,7 +252,16 @@ static void i2c_lld_serve_event_interrupt(I2CDriver *i2cp) { done by the DMA.*/
switch (I2C_EV_MASK & (event | (regSR2 << 16))) {
case I2C_EV5_MASTER_MODE_SELECT:
- dp->DR = i2cp->addr;
+ if ((i2cp->addr >> 8) > 0) {
+ /* 10-bit address: 1 1 1 1 0 X X R/W */
+ dp->DR = 0xF0 | (0x1 & i2cp->addr) | (0x3 & (i2cp->addr >> 9));
+ } else {
+ dp->DR = i2cp->addr;
+ }
+ break;
+ case I2C_EV9_MASTER_ADD10:
+ /* Set second addr byte (10-bit addressing)*/
+ dp->DR = (0xFF & (i2cp->addr >> 1));
break;
case I2C_EV6_MASTER_REC_MODE_SELECTED:
dp->CR2 &= ~I2C_CR2_ITEVTEN;
|