adl_atSendResponse = printf?????

Hello there,

I´m developing a program in the M2M Studio and I have a question:
How can I make the instruction “adl_atSendResponse” to work like a “printf” in C???

The point is, that I’m interested in making like a “printf(”\nContador=%d", counter)" but with the “adl_atSendResponse” in order to see the number of the incremental counter in the Shell window.

Any ideas???

I know there is this instruction: “adl_atSendStdResponseExt” but i don´t know exactly, how it works.

Here´s my code:

u32 counter;
int counter1;
void MyGpioEventHandler ( s32 GpioHandle, adl_ioEvent_e Event, u32 Size, void * Param )
   TRACE (( 1, "EVENT" ));

// Check event
switch ( Event ){

	   if (counter1 % 2 == 0)
	   counter ++;
	   adl_atSendStdResponseExt(ADL_AT_RSP, "\r\nContador", counter);
	   counter1 ++;



The easiest way to do this is to build your output string using wm_sprintf(), then send the string to the console.

Something like this:

void myFunction(u8 counter)
    ascii *myMsg;

    myMsg = adl_memGet(sizeof(ascii)*128);    // allocate memory for string
    myMsg[0] = 0x00;                                      // ensure string starts with 'NUL'

    wm_sprintf(myMsg, "Value of Counter is %d", counter);

    adl_atSendStdResponse(ADL_AT_RSP, myMsg);

    adl_memRelease(myMsg);                          // free memory

You could actually wrap the whole process using a function with varargs that would let you emulate the printf() function.

Remember that you can’t use %f in your sprintf string in OpenAT - it will cause an instant ARM exception and reset your module.

ciao, Dave