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 <gerard.marull@nordicsemi.no>
This commit is contained in:
parent
8a124d1ce9
commit
03849926ae
|
@ -11,7 +11,7 @@
|
||||||
#include <zephyr/logging/log.h>
|
#include <zephyr/logging/log.h>
|
||||||
LOG_MODULE_REGISTER(main, CONFIG_APP_LOG_LEVEL);
|
LOG_MODULE_REGISTER(main, CONFIG_APP_LOG_LEVEL);
|
||||||
|
|
||||||
void main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
const struct device *sensor;
|
const struct device *sensor;
|
||||||
|
@ -21,7 +21,7 @@ void main(void)
|
||||||
sensor = DEVICE_DT_GET(DT_NODELABEL(examplesensor0));
|
sensor = DEVICE_DT_GET(DT_NODELABEL(examplesensor0));
|
||||||
if (!device_is_ready(sensor)) {
|
if (!device_is_ready(sensor)) {
|
||||||
LOG_ERR("Sensor not ready");
|
LOG_ERR("Sensor not ready");
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
|
@ -30,18 +30,20 @@ void main(void)
|
||||||
ret = sensor_sample_fetch(sensor);
|
ret = sensor_sample_fetch(sensor);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
LOG_ERR("Could not fetch sample (%d)", ret);
|
LOG_ERR("Could not fetch sample (%d)", ret);
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = sensor_channel_get(sensor, SENSOR_CHAN_PROX, &val);
|
ret = sensor_channel_get(sensor, SENSOR_CHAN_PROX, &val);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
LOG_ERR("Could not get sample (%d)", ret);
|
LOG_ERR("Could not get sample (%d)", ret);
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
printk("Sensor value: %d\n", val.val1);
|
printk("Sensor value: %d\n", val.val1);
|
||||||
|
|
||||||
k_sleep(K_MSEC(1000));
|
k_sleep(K_MSEC(1000));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue