From 03849926aea60d9564e89fa669fff486c6a93ee1 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Fri, 14 Apr 2023 10:15:25 +0200 Subject: [PATCH] app: adjust main definition Zephyr now requires `int main(void)`. Main must return 0, all other values are reserved. Signed-off-by: Gerard Marull-Paretas --- app/src/main.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/src/main.c b/app/src/main.c index 27ab1c9..bdd08fe 100644 --- a/app/src/main.c +++ b/app/src/main.c @@ -11,7 +11,7 @@ #include LOG_MODULE_REGISTER(main, CONFIG_APP_LOG_LEVEL); -void main(void) +int main(void) { int ret; const struct device *sensor; @@ -21,7 +21,7 @@ void main(void) sensor = DEVICE_DT_GET(DT_NODELABEL(examplesensor0)); if (!device_is_ready(sensor)) { LOG_ERR("Sensor not ready"); - return; + return 0; } while (1) { @@ -30,18 +30,20 @@ void main(void) ret = sensor_sample_fetch(sensor); if (ret < 0) { LOG_ERR("Could not fetch sample (%d)", ret); - return; + return 0; } ret = sensor_channel_get(sensor, SENSOR_CHAN_PROX, &val); if (ret < 0) { LOG_ERR("Could not get sample (%d)", ret); - return; + return 0; } printk("Sensor value: %d\n", val.val1); k_sleep(K_MSEC(1000)); } + + return 0; }