Skip to content

Commit 0384992

Browse files
gmarullcarlescufi
authored andcommitted
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 <[email protected]>
1 parent 8a124d1 commit 0384992

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

app/src/main.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#include <zephyr/logging/log.h>
1212
LOG_MODULE_REGISTER(main, CONFIG_APP_LOG_LEVEL);
1313

14-
void main(void)
14+
int main(void)
1515
{
1616
int ret;
1717
const struct device *sensor;
@@ -21,7 +21,7 @@ void main(void)
2121
sensor = DEVICE_DT_GET(DT_NODELABEL(examplesensor0));
2222
if (!device_is_ready(sensor)) {
2323
LOG_ERR("Sensor not ready");
24-
return;
24+
return 0;
2525
}
2626

2727
while (1) {
@@ -30,18 +30,20 @@ void main(void)
3030
ret = sensor_sample_fetch(sensor);
3131
if (ret < 0) {
3232
LOG_ERR("Could not fetch sample (%d)", ret);
33-
return;
33+
return 0;
3434
}
3535

3636
ret = sensor_channel_get(sensor, SENSOR_CHAN_PROX, &val);
3737
if (ret < 0) {
3838
LOG_ERR("Could not get sample (%d)", ret);
39-
return;
39+
return 0;
4040
}
4141

4242
printk("Sensor value: %d\n", val.val1);
4343

4444
k_sleep(K_MSEC(1000));
4545
}
46+
47+
return 0;
4648
}
4749

0 commit comments

Comments
 (0)