/** * @brief This function handles I2C1 error interrupt. */ void I2C1_ER_IRQHandler(void) { /* USER CODE BEGIN I2C1_ER_IRQn 0 */ Write7SegIT(66); /* USER CODE END I2C1_ER_IRQn 0 */ HAL_I2C_ER_IRQHandler(&hi2c1); /* USER CODE BEGIN I2C1_ER_IRQn 1 */ /* USER CODE END I2C1_ER_IRQn 1 */ }
/** * @brief This function handles I2C3 error interrupt. */ void I2C3_ER_IRQHandler(void) { /* USER CODE BEGIN I2C3_ER_IRQn 0 */ /* USER CODE END I2C3_ER_IRQn 0 */ HAL_I2C_ER_IRQHandler(&hi2c3); /* USER CODE BEGIN I2C3_ER_IRQn 1 */ /* USER CODE END I2C3_ER_IRQn 1 */ }
/** * @brief This function handles I2C3 error interrupt. */ void I2C3_ER_IRQHandler(void) { /* USER CODE BEGIN I2C3_ER_IRQn 0 */ /* USER CODE END I2C3_ER_IRQn 0 */ HAL_NVIC_ClearPendingIRQ(I2C3_ER_IRQn); HAL_I2C_ER_IRQHandler(&hi2c3); /* USER CODE BEGIN I2C3_ER_IRQn 1 */ /* USER CODE END I2C3_ER_IRQn 1 */ }
/** * @brief This function handles I2C2 global interrupt. */ void I2C2_IRQHandler(void) { /* USER CODE BEGIN I2C2_IRQn 0 */ /* USER CODE END I2C2_IRQn 0 */ if (hi2c2.Instance->ISR & (I2C_FLAG_BERR | I2C_FLAG_ARLO | I2C_FLAG_OVR)) { HAL_I2C_ER_IRQHandler(&hi2c2); } else { HAL_I2C_EV_IRQHandler(&hi2c2); } /* USER CODE BEGIN I2C2_IRQn 1 */ /* USER CODE END I2C2_IRQn 1 */ }
/** * @brief This function handles I2C error interrupt request. * @param None * @retval None * @Note This function is redefined in "main.h" and related to I2C error */ void I2Cx_ER_IRQHandler(void) { HAL_I2C_ER_IRQHandler(& I2cHandle); }
void i2c_er_irq_handler(mp_uint_t i2c_id) { I2C_HandleTypeDef *hi2c; switch (i2c_id) { #if defined(MICROPY_HW_I2C1_SCL) case 1: hi2c = &I2CHandle1; break; #endif #if defined(MICROPY_HW_I2C2_SCL) case 2: hi2c = &I2CHandle2; break; #endif #if defined(MICROPY_HW_I2C3_SCL) case 3: hi2c = &I2CHandle3; break; #endif #if defined(MICROPY_HW_I2C4_SCL) case 4: hi2c = &I2CHandle4; break; #endif default: return; } #if defined(MCU_SERIES_F4) uint32_t sr1 = hi2c->Instance->SR1; // I2C Bus error if (sr1 & I2C_FLAG_BERR) { hi2c->ErrorCode |= HAL_I2C_ERROR_BERR; __HAL_I2C_CLEAR_FLAG(hi2c, I2C_FLAG_BERR); } // I2C Arbitration Loss error if (sr1 & I2C_FLAG_ARLO) { hi2c->ErrorCode |= HAL_I2C_ERROR_ARLO; __HAL_I2C_CLEAR_FLAG(hi2c, I2C_FLAG_ARLO); } // I2C Acknowledge failure if (sr1 & I2C_FLAG_AF) { hi2c->ErrorCode |= HAL_I2C_ERROR_AF; SET_BIT(hi2c->Instance->CR1,I2C_CR1_STOP); __HAL_I2C_CLEAR_FLAG(hi2c, I2C_FLAG_AF); } // I2C Over-Run/Under-Run if (sr1 & I2C_FLAG_OVR) { hi2c->ErrorCode |= HAL_I2C_ERROR_OVR; __HAL_I2C_CLEAR_FLAG(hi2c, I2C_FLAG_OVR); } #else // if not an F4 MCU, use the HAL's IRQ handler HAL_I2C_ER_IRQHandler(hi2c); #endif }
void I2C2_ER_IRQHandler(void) { HAL_I2C_ER_IRQHandler(&i2cHandle[I2CDEV_2].Handle); }
/** * @brief This function handles I2C1 error interrupt. */ void I2C1_ER_IRQHandler(void) { HAL_NVIC_ClearPendingIRQ(I2C1_ER_IRQn); HAL_I2C_ER_IRQHandler(&hi2c1); }
void I2C1_Handler(void) { //Call Hal_I2C_EventHandler HAL_I2C_EV_IRQHandler(&hnd); //Eventhandler - Dieser kümmert sich automatisch um das erzeugen von Startconditions, ACKs, NACKs, Stopbits und Stopcondition HAL_I2C_ER_IRQHandler(&hnd); //Errorhandler }
void I2C4_ER_IRQHandler(void) { HAL_I2C_ER_IRQHandler(&i2cDevice[I2CDEV_4].handle); }
/** * @brief This function handles I2C1 error interrupt. */ void I2C1_ER_IRQHandler(void) { HAL_I2C_ER_IRQHandler(&hi2c1_at24c16); }
/** * @brief This function handles I2C error interrupt request. * @param None * @retval None * @Note This function is redefined in "main.h" and related to I2C error */ void I2Cx_ER_IRQHandler(void) { HAL_I2C_ER_IRQHandler(&handleIIC); }
static irq_return_t i2c_er_irq_handler(unsigned int irq_nr, void *data) { I2C_HandleTypeDef *I2cHandle = (I2C_HandleTypeDef *) data; HAL_I2C_ER_IRQHandler(I2cHandle); return IRQ_HANDLED; }