diff --git a/samples/drivers/adc/src/adc.c b/samples/drivers/adc/src/adc.c index 3f2fcdb7816..9d9b1ea3968 100644 --- a/samples/drivers/adc/src/adc.c +++ b/samples/drivers/adc/src/adc.c @@ -20,16 +20,10 @@ #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) @@ -63,11 +57,11 @@ static struct adc_seq_table table = { static void _print_sample_in_hex(uint8_t *buf, uint32_t length) { - DBG("Buffer content:\n"); + SYS_LOG_DBG("Buffer content:\n"); for (; length > 0; length -= 4, buf += 4) { - DBG("0x%x ", *((uint32_t *)buf)); + SYS_LOG_DBG("0x%x ", *((uint32_t *)buf)); } - DBG("\n"); + SYS_LOG_DBG("\n"); } void main(void) @@ -76,11 +70,11 @@ void main(void) struct nano_timer timer; uint32_t data[2] = {0, 0}; - DBG("ADC sample started on %s\n", ADC_DEVICE_NAME); + SYS_LOG_DBG("ADC sample started on %s\n", ADC_DEVICE_NAME); adc = device_get_binding(ADC_DEVICE_NAME); if (!adc) { - DBG("Cannot get adc controller\n"); + SYS_LOG_DBG("Cannot get adc controller\n"); return; } @@ -88,9 +82,9 @@ void main(void) adc_enable(adc); while (1) { if (adc_read(adc, &table) != 0) { - DBG("Sampling could not proceed, an error occurred\n"); + SYS_LOG_DBG("Sampling could not proceed, an error occurred\n"); } else { - DBG("Sampling is done\n"); + SYS_LOG_DBG("Sampling is done\n"); _print_sample_in_hex(seq_buffer, BUFFER_SIZE); } nano_timer_start(&timer, SLEEPTICKS);