Skip to main content
Visitor II
November 21, 2008
Question

STR710. I2C. Library version 3.1. Question about I2C_FlagStatus()

  • November 21, 2008
  • 1 reply
  • 618 views
Posted on November 21, 2008 at 07:22

STR710. I2C. Library version 3.1. Question about I2C_FlagStatus()

    This topic has been closed for replies.

    1 reply

    sveAuthor
    Visitor II
    November 21, 2008
    Posted on November 21, 2008 at 07:22

    Hi all,

    I have a one question about the INDIRECT access in this function. As you can find for example in:

    http://www.cplusplus.com/reference/clibrary/cstdarg/va_start.html

    ''A function that executes va_start, shall also execute va_end before it returns.''

    But in the library function from ST there are no such calling. Is it a problem? Can it cause memory leaks or somethimg bad else? Please do not propose to use the new library since the project my almost finished... :)

    I list the part code from library:

    FlagStatus I2C_FlagStatus (I2C_TypeDef *I2Cx, RegisterAccess Access, I2C_Flags Flag, ...)

    {

    u32 Tmp=0;

    if (Access == DIRECT)

    /* Store in Tmp variable the register where is located the flag */

    Tmp = I2C_GetStatus(I2Cx)&Flag;

    else

    {

    va_list list;

    /* Get the fourth register */

    va_start(list,Flag);

    Tmp = va_arg(list,u32);

    Tmp&=Flag;

    }

    /* Return the Flag NewState */

    return Tmp != 0 ? SET : RESET;

    }