From c18ec01fdcb7873993f44495de0a488b66570f43 Mon Sep 17 00:00:00 2001 From: Andrew Boie Date: Tue, 23 Aug 2016 13:25:53 -0700 Subject: [PATCH] Revert "sys_log: replace old debug macro on ADC driver sample." This reverts commit eeb2b733e40891234f30199ad05ac591562fbee9. Change-Id: I4174d3c91b78856266fc457f8107c0043bba0416 Signed-off-by: Andrew Boie --- samples/drivers/adc/src/adc.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/samples/drivers/adc/src/adc.c b/samples/drivers/adc/src/adc.c index 9d9b1ea3968..3f2fcdb7816 100644 --- a/samples/drivers/adc/src/adc.c +++ b/samples/drivers/adc/src/adc.c @@ -20,10 +20,16 @@ #include #include -#define SYS_LOG_NO_NEWLINE -#include #include +#if defined(CONFIG_STDOUT_CONSOLE) +#include +#define DBG printf +#else +#include +#define DBG printk +#endif + #define SLEEPTIME 2 #define SLEEPTICKS (SLEEPTIME * sys_clock_ticks_per_sec) @@ -57,11 +63,11 @@ static struct adc_seq_table table = { static void _print_sample_in_hex(uint8_t *buf, uint32_t length) { - SYS_LOG_DBG("Buffer content:\n"); + DBG("Buffer content:\n"); for (; length > 0; length -= 4, buf += 4) { - SYS_LOG_DBG("0x%x ", *((uint32_t *)buf)); + DBG("0x%x ", *((uint32_t *)buf)); } - SYS_LOG_DBG("\n"); + DBG("\n"); } void main(void) @@ -70,11 +76,11 @@ void main(void) struct nano_timer timer; uint32_t data[2] = {0, 0}; - SYS_LOG_DBG("ADC sample started on %s\n", ADC_DEVICE_NAME); + DBG("ADC sample started on %s\n", ADC_DEVICE_NAME); adc = device_get_binding(ADC_DEVICE_NAME); if (!adc) { - SYS_LOG_DBG("Cannot get adc controller\n"); + DBG("Cannot get adc controller\n"); return; } @@ -82,9 +88,9 @@ void main(void) adc_enable(adc); while (1) { if (adc_read(adc, &table) != 0) { - SYS_LOG_DBG("Sampling could not proceed, an error occurred\n"); + DBG("Sampling could not proceed, an error occurred\n"); } else { - SYS_LOG_DBG("Sampling is done\n"); + DBG("Sampling is done\n"); _print_sample_in_hex(seq_buffer, BUFFER_SIZE); } nano_timer_start(&timer, SLEEPTICKS);