From: aleph Date: Thu, 9 Jun 2011 15:51:48 +0000 (+0000) Subject: sam3 i2c: fix slave address setting. X-Git-Tag: 2.7.0~23 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=e6aee3618f11f859e2f11814cee8f7a652897775;p=bertos.git sam3 i2c: fix slave address setting. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@4943 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/bertos/cpu/cortex-m3/drv/i2c_sam3.c b/bertos/cpu/cortex-m3/drv/i2c_sam3.c index 9e9ba6f4..23ebb3d2 100644 --- a/bertos/cpu/cortex-m3/drv/i2c_sam3.c +++ b/bertos/cpu/cortex-m3/drv/i2c_sam3.c @@ -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)