MCU/lib/i2c.c
void DMA1_Channel7_IRQ(void) { 
        /* Check for transfer error */
        if (DMA1->ISR & DMA_ISR_TEIF7) {
            /* Clear the interrupt flag */
            DMA1->IFCR |= DMA_IFCR_CTEIF7; 
            return;
        } else if (DMA1->ISR & DMA_ISR_TCIF7) { 
            /* Check if the transfer is completed */ 
            /* Stop the transfer */
            I2C_Stop();
            /* Set the state variable that the transfer is complete */
            I2C_status = I2C_DEFAULT;
            /* Clear the interrupt flag */
            DMA1->IFCR |= DMA_IFCR_CTCIF7;
            /* Disable I2C DMA requests */
            I2C1->CR2 &= ~I2C_CR2_DMAEN;
            /* Disable the DMA channel */
            DMA1_Channel7->CCR &= ~DMA_CCR7_EN; 
            return; 
        } else if (DMA1->ISR & DMA_ISR_TCIF6) {
            /* Check for any other interrupt */
            /* Clear the interrupt flag */
            DMA1->IFCR |= DMA_IFCR_CGIF7; 
        }
    }
/* DMA interrupt service routine used for DMA reception */
DMA interrupt service routine used for DMA reception
DMA interrupt service routine used for DMA reception
void DMA1_Channel7_IRQ(void) { 
        if (DMA1->ISR & DMA_ISR_TEIF7) {
            DMA1->IFCR |= DMA_IFCR_CTEIF7; 
            return;
        } else if (DMA1->ISR & DMA_ISR_TCIF7) { 
            I2C_Stop();
            I2C_status = I2C_DEFAULT;
            DMA1->IFCR |= DMA_IFCR_CTCIF7;
            I2C1->CR2 &= ~I2C_CR2_DMAEN;
            DMA1_Channel7->CCR &= ~DMA_CCR7_EN; 
            return; 
        } else if (DMA1->ISR & DMA_ISR_TCIF6) {
            DMA1->IFCR |= DMA_IFCR_CGIF7; 
        }
    }
void DMA1_Channel7_IRQ ( void ) { if ( DMA1 -> ISR & DMA_ISR_TEIF7 ) { DMA1 -> IFCR |= DMA_IFCR_CTEIF7 ; return ; } else if ( DMA1 -> ISR & DMA_ISR_TCIF7 ) { I2C_Stop ( ) ; I2C_status = I2C_DEFAULT ; DMA1 -> IFCR |= DMA_IFCR_CTCIF7 ; I2C1 -> CR2 &= ~ I2C_CR2_DMAEN ; DMA1_Channel7 -> CCR &= ~ DMA_CCR7_EN ; return ; } else if ( DMA1 -> ISR & DMA_ISR_TCIF6 ) { DMA1 -> IFCR |= DMA_IFCR_CGIF7 ; } }
DMA interrupt service routine used for DMA reception
DMA interrupt service routine used for DMA reception
/* Check for transfer error */ /* Clear the interrupt flag */ /* Check if the transfer is completed */ /* Stop the transfer */ /* Set the state variable that the transfer is complete */ /* Clear the interrupt flag */ /* Disable I2C DMA requests */ /* Disable the DMA channel */ /* Check for any other interrupt */ /* Clear the interrupt flag */