MaJerle / stm32f429

Keil projects and libraries for STM32F4xx devices
https://stm32f4-discovery.net
2.13k stars 1.32k forks source link

Bug in TM_I2C_ReadMultiNoRegister #9

Open PoZitron opened 7 years ago

PoZitron commented 7 years ago

Hi. Seems you forgot to increment "data" variable in function TM_I2C_ReadMultiNoRegister. You have

    while (count--) {
        if (!count) {
            /* Last byte */
            *data = TM_I2C_ReadNack(I2Cx);
        } else {
            *data = TM_I2C_ReadAck(I2Cx);
        }
    }

but correct code is

    while (count--) {
        if (!count) {
            /* Last byte */
            *data++ = TM_I2C_ReadNack(I2Cx);
        } else {
            *data++ = TM_I2C_ReadAck(I2Cx);
        }
    }

Bug introduced in f5bac03c6023bf437a309daf449d6b956e93b6fb

Could you fix it in upstream?

MaJerle commented 7 years ago

Thanks for posting this. Will fix this.