diff --git a/samples/drivers/aio_comparator/prj.conf b/samples/drivers/aio_comparator/prj.conf index 75e3351507a..e265c2305db 100644 --- a/samples/drivers/aio_comparator/prj.conf +++ b/samples/drivers/aio_comparator/prj.conf @@ -1,3 +1,4 @@ CONFIG_STDOUT_CONSOLE=y CONFIG_PRINTK=y CONFIG_AIO_COMPARATOR=y +CONFIG_SYS_LOG=y diff --git a/samples/drivers/aio_comparator/src/main.c b/samples/drivers/aio_comparator/src/main.c index b35787c34a5..4f30a7714a1 100644 --- a/samples/drivers/aio_comparator/src/main.c +++ b/samples/drivers/aio_comparator/src/main.c @@ -34,13 +34,8 @@ * The line "*** A0, AIN[10] triggered falling." should appear. */ -#if defined(CONFIG_STDOUT_CONSOLE) -#include -#define PRINT printf -#else -#include -#define PRINT printk -#endif +#define SYS_LOG_LEVEL SYS_LOG_LEVEL_INFO +#include #include #include @@ -71,9 +66,8 @@ void cb(void *param) aio_cmp_dev = device_get_binding("AIO_CMP_0"); - PRINT("*** %s triggered %s.\n", &p->name, - (p->pol == AIO_CMP_POL_RISE) ? "rising" : "falling" - ); + SYS_LOG_INF("*** %s triggered %s.", &p->name, + (p->pol == AIO_CMP_POL_RISE) ? "rising" : "falling"); if (p->pol == AIO_CMP_POL_RISE) p->pol = AIO_CMP_POL_FALL; @@ -95,7 +89,7 @@ void main(void) aio_cmp_dev = device_get_binding("AIO_CMP_0"); - PRINT("===== app started ========\n"); + SYS_LOG_INF("===== app started ========"); for (i = 0; i < 4; i++) { /* REF_A is to use AREF for reference */ @@ -103,12 +97,12 @@ void main(void) cb_data.pol, cb_data.ref, cb, &cb_data); if (ret) - PRINT("ERROR registering callback for %s (%d)\n", + SYS_LOG_ERR("ERROR registering callback for %s (%d)", &cb_data.name, ret); } while (1) { - PRINT("... waiting for event! (%d)\n", ++cnt); + SYS_LOG_INF("... waiting for event! (%d)", ++cnt); /* wait a while */ nano_task_timer_start(&timer, SLEEPTIME);