sam3 i2c: fix slave address setting.
authoraleph <aleph@38d2e660-2303-0410-9eaa-f027e97ec537>
Thu, 9 Jun 2011 15:51:48 +0000 (15:51 +0000)
committeraleph <aleph@38d2e660-2303-0410-9eaa-f027e97ec537>
Thu, 9 Jun 2011 15:51:48 +0000 (15:51 +0000)
git-svn-id: https://src.develer.com/svnoss/bertos/trunk@4943 38d2e660-2303-0410-9eaa-f027e97ec537

bertos/cpu/cortex-m3/drv/i2c_sam3.c

index 9e9ba6f42df3e5a96e61194bb21f93a145895d3b..23ebb3d2d7201133bf764c544392b5351c1f271a 100644 (file)
@@ -121,9 +121,9 @@ static void i2c_sam3_start(struct I2c *i2c, uint16_t slave_addr)
        i2c->hw->first_xtranf = true;
 
        if (I2C_TEST_START(i2c->flags) == I2C_START_R)
-               HWREG(i2c->hw->base + TWI_MMR_OFF) = TWI_MMR_DADR(slave_addr) | TWI_MMR_MREAD;
+               HWREG(i2c->hw->base + TWI_MMR_OFF) = TWI_MMR_DADR(slave_addr >> 1) | TWI_MMR_MREAD;
        else
-               HWREG(i2c->hw->base + TWI_MMR_OFF) = TWI_MMR_DADR(slave_addr);
+               HWREG(i2c->hw->base + TWI_MMR_OFF) = TWI_MMR_DADR(slave_addr >> 1);
 }
 
 static void i2c_sam3_putc(I2c *i2c, const uint8_t data)