Revert "sys_log: replace old debug macro on ADC driver sample."
This reverts commit eeb2b733e4
.
Change-Id: I4174d3c91b78856266fc457f8107c0043bba0416
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
parent
a713d4be6f
commit
c18ec01fdc
1 changed files with 15 additions and 9 deletions
|
@ -20,10 +20,16 @@
|
||||||
|
|
||||||
#include <device.h>
|
#include <device.h>
|
||||||
#include <misc/byteorder.h>
|
#include <misc/byteorder.h>
|
||||||
#define SYS_LOG_NO_NEWLINE
|
|
||||||
#include <misc/sys_log.h>
|
|
||||||
#include <adc.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 SLEEPTIME 2
|
||||||
#define SLEEPTICKS (SLEEPTIME * sys_clock_ticks_per_sec)
|
#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)
|
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) {
|
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)
|
void main(void)
|
||||||
|
@ -70,11 +76,11 @@ void main(void)
|
||||||
struct nano_timer timer;
|
struct nano_timer timer;
|
||||||
uint32_t data[2] = {0, 0};
|
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);
|
adc = device_get_binding(ADC_DEVICE_NAME);
|
||||||
if (!adc) {
|
if (!adc) {
|
||||||
SYS_LOG_DBG("Cannot get adc controller\n");
|
DBG("Cannot get adc controller\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,9 +88,9 @@ void main(void)
|
||||||
adc_enable(adc);
|
adc_enable(adc);
|
||||||
while (1) {
|
while (1) {
|
||||||
if (adc_read(adc, &table) != 0) {
|
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 {
|
} else {
|
||||||
SYS_LOG_DBG("Sampling is done\n");
|
DBG("Sampling is done\n");
|
||||||
_print_sample_in_hex(seq_buffer, BUFFER_SIZE);
|
_print_sample_in_hex(seq_buffer, BUFFER_SIZE);
|
||||||
}
|
}
|
||||||
nano_timer_start(&timer, SLEEPTICKS);
|
nano_timer_start(&timer, SLEEPTICKS);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue