diff options
author | barthess <barthess@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2011-06-23 18:29:22 +0000 |
---|---|---|
committer | barthess <barthess@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2011-06-23 18:29:22 +0000 |
commit | 10153a4f3062c85b4595558df5df41f8962c6aae (patch) | |
tree | 2dc7aeac150c9942dae63a7350c1ff4060669d3a /os/hal/platforms/STM32 | |
parent | fbeff97d9230af12326c94e3875adf9438f16ed4 (diff) | |
download | ChibiOS-10153a4f3062c85b4595558df5df41f8962c6aae.tar.gz ChibiOS-10153a4f3062c85b4595558df5df41f8962c6aae.tar.bz2 ChibiOS-10153a4f3062c85b4595558df5df41f8962c6aae.zip |
I2C. Fixed indent style. All tabs changed to 2 spaces.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/i2c_dev@3071 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/platforms/STM32')
-rw-r--r-- | os/hal/platforms/STM32/i2c_lld.c | 62 | ||||
-rw-r--r-- | os/hal/platforms/STM32/i2c_lld.h | 18 |
2 files changed, 40 insertions, 40 deletions
diff --git a/os/hal/platforms/STM32/i2c_lld.c b/os/hal/platforms/STM32/i2c_lld.c index e59ef8d45..ba6225ba9 100644 --- a/os/hal/platforms/STM32/i2c_lld.c +++ b/os/hal/platforms/STM32/i2c_lld.c @@ -514,35 +514,35 @@ void i2c_lld_stop(I2CDriver *i2cp) { /** * @brief Transmits data ever the I2C bus as master. * - * @param[in] i2cp pointer to the @p I2CDriver object - * @param[in] slave_addr Slave device address. Bits 0-9 contain slave - * device address. Bit 15 must be set to 1 if 10-bit - * addressing modes used. Otherwise keep it cleared. - * Bits 10-14 unused. - * @param[in] txbytes number of bytes to be transmited - * @param[in] rxbytes number of bytes to be received + * @param[in] i2cp pointer to the @p I2CDriver object + * @param[in] slave_addr Slave device address. Bits 0-9 contain slave + * device address. Bit 15 must be set to 1 if 10-bit + * addressing modes used. Otherwise keep it cleared. + * Bits 10-14 unused. + * @param[in] txbytes number of bytes to be transmited + * @param[in] rxbytes number of bytes to be received * */ void i2c_lld_master_transmit(I2CDriver *i2cp, uint16_t slave_addr, size_t txbytes, size_t rxbytes) { - i2cp->slave_addr = slave_addr; - i2cp->txbytes = txbytes; - i2cp->rxbytes = rxbytes; + i2cp->slave_addr = slave_addr; + i2cp->txbytes = txbytes; + i2cp->rxbytes = rxbytes; // enable ERR, EVT & BUF ITs i2cp->id_i2c->CR2 |= (I2C_CR2_ITERREN|I2C_CR2_ITEVTEN|I2C_CR2_ITBUFEN); i2cp->id_i2c->CR1 &= ~I2C_CR1_POS; if(slave_addr & 0x8000){// 10-bit mode used - // add the two msb of 10-bit address to the header - i2cp->slave_addr1 = ((slave_addr >>7) & 0x0006); - // add the header bits with LSB = 0 -> write - i2cp->slave_addr1 |= 0xF0; - // the remaining 8 bit of 10-bit address - i2cp->slave_addr2 = slave_addr & 0x00FF; + // add the two msb of 10-bit address to the header + i2cp->slave_addr1 = ((slave_addr >>7) & 0x0006); + // add the header bits with LSB = 0 -> write + i2cp->slave_addr1 |= 0xF0; + // the remaining 8 bit of 10-bit address + i2cp->slave_addr2 = slave_addr & 0x00FF; } else{ - // LSB = 0 -> write - i2cp->slave_addr1 = ((slave_addr <<1) & 0x00FE); + // LSB = 0 -> write + i2cp->slave_addr1 = ((slave_addr <<1) & 0x00FE); } i2cp->flags = 0; @@ -563,13 +563,13 @@ void i2c_lld_master_transmit(I2CDriver *i2cp, uint16_t slave_addr, size_t txbyte /** * @brief Receives data from the I2C bus. * - * @param[in] i2cp pointer to the @p I2CDriver object - * @param[in] slave_addr Slave device address. Bits 0-9 contain slave - * device address. Bit 15 must be set to 1 if 10-bit - * addressing modes used. Otherwise keep it cleared. - * Bits 10-14 unused. - * @param[in] txbytes number of bytes to be transmited - * @param[in] rxbytes number of bytes to be received + * @param[in] i2cp pointer to the @p I2CDriver object + * @param[in] slave_addr Slave device address. Bits 0-9 contain slave + * device address. Bit 15 must be set to 1 if 10-bit + * addressing modes used. Otherwise keep it cleared. + * Bits 10-14 unused. + * @param[in] txbytes number of bytes to be transmited + * @param[in] rxbytes number of bytes to be received * */ void i2c_lld_master_receive(I2CDriver *i2cp, uint16_t slave_addr, size_t rxbytes){ @@ -582,12 +582,12 @@ void i2c_lld_master_receive(I2CDriver *i2cp, uint16_t slave_addr, size_t rxbytes i2cp->id_i2c->CR1 &= ~I2C_CR1_POS; if(slave_addr & 0x8000){// 10-bit mode used - // add the two msb of 10-bit address to the header - i2cp->slave_addr1 = ((slave_addr >>7) & 0x0006); - // add the header bits (the LSB -> 1 will be add to second - i2cp->slave_addr1 |= 0xF0; - // the remaining 8 bit of 10-bit address - i2cp->slave_addr2 = slave_addr & 0x00FF; + // add the two msb of 10-bit address to the header + i2cp->slave_addr1 = ((slave_addr >>7) & 0x0006); + // add the header bits (the LSB -> 1 will be add to second + i2cp->slave_addr1 |= 0xF0; + // the remaining 8 bit of 10-bit address + i2cp->slave_addr2 = slave_addr & 0x00FF; } else{ // LSB = 1 -> receive diff --git a/os/hal/platforms/STM32/i2c_lld.h b/os/hal/platforms/STM32/i2c_lld.h index 66ee95dd9..0ad317876 100644 --- a/os/hal/platforms/STM32/i2c_lld.h +++ b/os/hal/platforms/STM32/i2c_lld.h @@ -163,17 +163,17 @@ struct I2CDriver{ */ const I2CSlaveConfig *id_slave_config; - size_t txbytes; /*!< Number of bytes to be transmitted. */ - size_t rxbytes; /*!< Number of bytes to be received. */ - uint8_t *rxBuffp; /*!< Pointer to the current byte in slave rx buffer. */ - uint8_t *txBuffp; /*!< Pointer to the current byte in slave tx buffer. */ + size_t txbytes; /*!< Number of bytes to be transmitted. */ + size_t rxbytes; /*!< Number of bytes to be received. */ + uint8_t *rxBuffp; /*!< Pointer to the current byte in slave rx buffer. */ + uint8_t *txBuffp; /*!< Pointer to the current byte in slave tx buffer. */ - i2cflags_t errors; /*!< Error flags.*/ - i2cflags_t flags; /*!< State flags.*/ + i2cflags_t errors; /*!< Error flags.*/ + i2cflags_t flags; /*!< State flags.*/ - uint16_t slave_addr; /*!< Current slave address. */ - uint8_t slave_addr1; /*!< 7-bit address of the slave with r\w bit.*/ - uint8_t slave_addr2; /*!< Used in 10-bit address mode. */ + uint16_t slave_addr; /*!< Current slave address. */ + uint8_t slave_addr1;/*!< 7-bit address of the slave with r\w bit.*/ + uint8_t slave_addr2;/*!< Used in 10-bit address mode. */ /*********** End of the mandatory fields. **********************************/ |