sys_log: replace old debug macro on ADC driver sample.

ADC driver sample is now using system log.

Change-Id: I44f5189b3beb09a14d87842c5968127460eda710
Signed-off-by: Genaro Saucedo Tejada <genaro.saucedo.tejada@intel.com>
JIRA: ZEP-311
This commit is contained in:
Genaro Saucedo Tejada 2016-06-13 11:56:09 -05:00 committed by Inaky Perez-Gonzalez
parent 280eadffdd
commit eeb2b733e4

View file

@ -20,16 +20,10 @@
#include <device.h>
#include <misc/byteorder.h>
#define SYS_LOG_NO_NEWLINE
#include <misc/sys_log.h>
#include <adc.h>
#if defined(CONFIG_STDOUT_CONSOLE)
#include <stdio.h>
#define DBG printf
#else
#include <misc/printk.h>
#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);