library available on ST website. In general, I2C peripheral in STM32F is tricky and not really successful: well minded double buffering of data register brings in fact a lot of problems, the cases for one or two bytes transmissions should be handled in a special way while the interrupts should be completely disabled, etc. I spent a week to get familiar with STM32F I2C. Be ready!