cancel
Showing results for 
Search instead for 
Did you mean: 

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

sve
Associate
Posted on November 21, 2008 at 07:22

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

1 REPLY 1
sve
Associate
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;

}