diff --git a/drivers/at/at.c b/drivers/at/at.c index 06df0261c90b49262422d63ef00087ce05ccb1bb..ff0e9e2583ea24032243ad28258660c9e53c8395 100644 --- a/drivers/at/at.c +++ b/drivers/at/at.c @@ -59,13 +59,13 @@ int at_send_cmd(at_dev_t *dev, const char *command, uint32_t timeout) unsigned cmdlen = strlen(command); uart_write(dev->uart, (const uint8_t *)command, cmdlen); - uart_write(dev->uart, (const uint8_t *)"\n", 1); + uart_write(dev->uart, (const uint8_t *)AT_END_OF_LINE, sizeof(AT_END_OF_LINE) - 1); if (at_expect_bytes(dev, command, cmdlen, timeout)) { return -1; } - if (at_expect_bytes(dev, "\r\n", 2, timeout)) { + if (at_expect_bytes(dev, AT_END_OF_LINE "\r\n", sizeof(AT_END_OF_LINE) + 1, timeout)) { return -2; } diff --git a/drivers/include/at.h b/drivers/include/at.h index 1637893ca372a295985acb88430664f85eaea315..a073ef3dc6b744280d623d6bdd41bf39470a7145 100644 --- a/drivers/include/at.h +++ b/drivers/include/at.h @@ -42,6 +42,11 @@ extern "C" { #endif +#ifndef AT_END_OF_LINE +/** End of line character to send after the AT command */ +#define AT_END_OF_LINE "\r" +#endif + /** * @brief AT device structure */