I2C doesn't work for any board (except F0 probably): You cannot check #ifndef I2C1_EV_IRQn, because I2C1_EV_IRQn is enum not #define. The same for #ifndef I2C2_EV_IRQn.