Override macro variables

Hello people,

I am currently working with the at library. Since my ble module uses \r\n instead of \r I want to override the EOL.

So I tried:

#include "periph/uart.h" #include "xtimer.h" #include "at.h"

#undef AT_SEND_EOL #define AT_SEND_EOL "\r\n"

#undef AT_SEND_EOL_LEN #define AT_SEND_EOL_LEN (sizeof(AT_SEND_EOL) - 1)

and:

#define AT_SEND_EOL "\r\n"

#include "periph/uart.h" #include "xtimer.h" #include "at.h"

But both are not working. So, I am now a bit confused. So, what's the proper way to override the macro varible then?

Hi,

You can use the CFLAGS variable to define it globally. See this PR [1] that also relies on the at module and which also requires to override some at defines. The trick is done in the Makefile.include of the driver module [2].

While writing this mail I realize that this won't work if there are multiple at based drivers using different EOL characters in an application. Maybe this macro should be moved to an attribute of the at driver device descriptor (at the expense of more RAM usage).

Alex

[1] https://github.com/RIOT-OS/RIOT/pull/9289 [2] https://github.com/RIOT-OS/RIOT/pull/9289/files#diff-6ed91e8d52a2320175e61bd5797e7e58R163