Skip to content

Commit c18ec01

Browse files
author
Andrew Boie
committed
Revert "sys_log: replace old debug macro on ADC driver sample."
This reverts commit eeb2b73. Change-Id: I4174d3c91b78856266fc457f8107c0043bba0416 Signed-off-by: Andrew Boie <[email protected]>
1 parent a713d4b commit c18ec01

File tree

1 file changed

+15
-9
lines changed
  • samples/drivers/adc/src

1 file changed

+15
-9
lines changed

samples/drivers/adc/src/adc.c

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,16 @@
2020

2121
#include <device.h>
2222
#include <misc/byteorder.h>
23-
#define SYS_LOG_NO_NEWLINE
24-
#include <misc/sys_log.h>
2523
#include <adc.h>
2624

25+
#if defined(CONFIG_STDOUT_CONSOLE)
26+
#include <stdio.h>
27+
#define DBG printf
28+
#else
29+
#include <misc/printk.h>
30+
#define DBG printk
31+
#endif
32+
2733
#define SLEEPTIME 2
2834
#define SLEEPTICKS (SLEEPTIME * sys_clock_ticks_per_sec)
2935

@@ -57,11 +63,11 @@ static struct adc_seq_table table = {
5763

5864
static void _print_sample_in_hex(uint8_t *buf, uint32_t length)
5965
{
60-
SYS_LOG_DBG("Buffer content:\n");
66+
DBG("Buffer content:\n");
6167
for (; length > 0; length -= 4, buf += 4) {
62-
SYS_LOG_DBG("0x%x ", *((uint32_t *)buf));
68+
DBG("0x%x ", *((uint32_t *)buf));
6369
}
64-
SYS_LOG_DBG("\n");
70+
DBG("\n");
6571
}
6672

6773
void main(void)
@@ -70,21 +76,21 @@ void main(void)
7076
struct nano_timer timer;
7177
uint32_t data[2] = {0, 0};
7278

73-
SYS_LOG_DBG("ADC sample started on %s\n", ADC_DEVICE_NAME);
79+
DBG("ADC sample started on %s\n", ADC_DEVICE_NAME);
7480

7581
adc = device_get_binding(ADC_DEVICE_NAME);
7682
if (!adc) {
77-
SYS_LOG_DBG("Cannot get adc controller\n");
83+
DBG("Cannot get adc controller\n");
7884
return;
7985
}
8086

8187
nano_timer_init(&timer, data);
8288
adc_enable(adc);
8389
while (1) {
8490
if (adc_read(adc, &table) != 0) {
85-
SYS_LOG_DBG("Sampling could not proceed, an error occurred\n");
91+
DBG("Sampling could not proceed, an error occurred\n");
8692
} else {
87-
SYS_LOG_DBG("Sampling is done\n");
93+
DBG("Sampling is done\n");
8894
_print_sample_in_hex(seq_buffer, BUFFER_SIZE);
8995
}
9096
nano_timer_start(&timer, SLEEPTICKS);

0 commit comments

Comments
 (0)