blob: 39651230a7987c1d971c6d182b4af5ed1c379104 [file] [log] [blame]
/*
* Copyright (c) 2017, NXP
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/kernel.h>
#include <zephyr/drivers/sensor.h>
#include <stdio.h>
int main(void)
{
struct sensor_value green;
const struct device *const dev = DEVICE_DT_GET_ANY(maxim_max30101);
if (dev == NULL) {
printf("Could not get max30101 device\n");
return 0;
}
if (!device_is_ready(dev)) {
printf("max30101 device %s is not ready\n", dev->name);
return 0;
}
while (1) {
sensor_sample_fetch(dev);
sensor_channel_get(dev, SENSOR_CHAN_GREEN, &green);
/* Print green LED data*/
printf("GREEN=%d\n", green.val1);
k_sleep(K_MSEC(20));
}
return 0;
}