diff options
author | inmarket <andrewh@inmarket.com.au> | 2015-10-06 12:10:11 +1000 |
---|---|---|
committer | inmarket <andrewh@inmarket.com.au> | 2015-10-06 12:10:11 +1000 |
commit | 80299276b7134693a6f02fb8fa791d0a15ed1eab (patch) | |
tree | e1824bd6b9aa27a71372f67c6a0f96b9f625abd7 /boards/base/STM32F746-Discovery/stm32f7_i2c.c | |
parent | 754d2e072b51bc43c72a37d46e22337d594f18dc (diff) | |
parent | a35ee53d0a28cb0b6b61944a1ed698a0cef85839 (diff) | |
download | uGFX-80299276b7134693a6f02fb8fa791d0a15ed1eab.tar.gz uGFX-80299276b7134693a6f02fb8fa791d0a15ed1eab.tar.bz2 uGFX-80299276b7134693a6f02fb8fa791d0a15ed1eab.zip |
Merge branch 'master' into TextEdit
Diffstat (limited to 'boards/base/STM32F746-Discovery/stm32f7_i2c.c')
-rw-r--r-- | boards/base/STM32F746-Discovery/stm32f7_i2c.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/boards/base/STM32F746-Discovery/stm32f7_i2c.c b/boards/base/STM32F746-Discovery/stm32f7_i2c.c index b0fa8163..d1e2ed28 100644 --- a/boards/base/STM32F746-Discovery/stm32f7_i2c.c +++ b/boards/base/STM32F746-Discovery/stm32f7_i2c.c @@ -1,3 +1,4 @@ +#include "gfx.h" #include "stm32f7_i2c.h" /* @@ -119,6 +120,8 @@ void i2cWriteReg(I2C_TypeDef* i2c, uint8_t slaveAddr, uint8_t regAddr, uint8_t v void i2cRead(I2C_TypeDef* i2c, uint8_t slaveAddr, uint8_t* data, uint16_t length) { + int i; + // We are currently not able to read more than 255 bytes at once if (length > 255) { return; @@ -128,7 +131,7 @@ void i2cRead(I2C_TypeDef* i2c, uint8_t slaveAddr, uint8_t* data, uint16_t length _i2cConfigTransfer(i2c, slaveAddr, length, I2C_CR2_RD_WRN | I2C_CR2_AUTOEND, I2C_CR2_START); // Transmit the whole buffer - for (int i = 0; i < length; i++) { + for (i = 0; i < length; i++) { while (!(i2c->ISR & I2C_ISR_RXNE)); data[i] = i2c->RXDR; } |