File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -340,6 +340,8 @@ void i2c_ev_irq_handler(mp_uint_t i2c_id) {
340340 return ;
341341 }
342342
343+ #if defined(MCU_SERIES_F4 )
344+
343345 if (hi2c -> Instance -> SR1 & I2C_FLAG_BTF && hi2c -> State == HAL_I2C_STATE_BUSY_TX ) {
344346 if (hi2c -> XferCount != 0U ) {
345347 hi2c -> Instance -> DR = * hi2c -> pBuffPtr ++ ;
@@ -353,6 +355,13 @@ void i2c_ev_irq_handler(mp_uint_t i2c_id) {
353355 hi2c -> State = HAL_I2C_STATE_READY ;
354356 }
355357 }
358+
359+ #else
360+
361+ // if not an F4 MCU, use the HAL's IRQ handler
362+ HAL_I2C_EV_IRQHandler (hi2c );
363+
364+ #endif
356365}
357366
358367void i2c_er_irq_handler (mp_uint_t i2c_id ) {
@@ -378,6 +387,8 @@ void i2c_er_irq_handler(mp_uint_t i2c_id) {
378387 return ;
379388 }
380389
390+ #if defined(MCU_SERIES_F4 )
391+
381392 uint32_t sr1 = hi2c -> Instance -> SR1 ;
382393
383394 // I2C Bus error
@@ -404,6 +415,13 @@ void i2c_er_irq_handler(mp_uint_t i2c_id) {
404415 hi2c -> ErrorCode |= HAL_I2C_ERROR_OVR ;
405416 __HAL_I2C_CLEAR_FLAG (hi2c , I2C_FLAG_OVR );
406417 }
418+
419+ #else
420+
421+ // if not an F4 MCU, use the HAL's IRQ handler
422+ HAL_I2C_ER_IRQHandler (hi2c );
423+
424+ #endif
407425}
408426
409427STATIC HAL_StatusTypeDef i2c_wait_dma_finished (I2C_HandleTypeDef * i2c , uint32_t timeout ) {
You can’t perform that action at this time.
0 commit comments