AnsweredAssumed Answered

A question regarding logic in flash_FLFT.c

Question asked by Anton Fosselius on Jan 16, 2015
Latest reply on Jan 17, 2015 by Paul Stofferegen

some code from the file:

 

    /* checking access error */

    if (FTFL_FSTAT & FTFL_FSTAT_ACCERR_MASK)

    {

        /* clear error flag */

        FTFL_FSTAT |= FTFL_FSTAT_ACCERR_MASK;

    }

    /* checking protection error */

    else if (FTFL_FSTAT & FTFL_FSTAT_FPVIOL_MASK)

    {

        /* clear error flag */

        FTFL_FSTAT |= FTFL_FSTAT_FPVIOL_MASK;

    }

    else if (FTFL_FSTAT & FTFL_FSTAT_RDCOLERR_MASK)

    {

        /* clear error flag */

        FTFL_FSTAT |= FTFL_FSTAT_RDCOLERR_MASK;

    } /* EndIf */

 

As i understands it it checks if flag is set and then set it again?

Why not clear with FTFL_FSTAT &= ~FTFL_FSTAT_ACCERR_MASK??

Outcomes