This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How can we connect the max30101 from the \ncs\zephyr\samples\sensor\max30101 .. i added the links to a blinky and it compiles successfully but can't seem to get the i2c working .. please help

Main in green

/*
* Copyright (c) 2016 Intel Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/

#include <zephyr.h>
#include <device.h>
#include <gpio.h>
#include <misc/printk.h>
#include <stdio.h>
#include <string.h>
#include <sensor.h>

#define LED_PORT LED0_GPIO_CONTROLLER
#define LED LED1_GPIO_PIN

/* 1000 msec = 1 sec */
#define SLEEP_TIME 1000

void main(void)
{


printk("UART loopback start!\n");

int cnt = 0;
//struct device *dev;

//dev = device_get_binding(LED_PORT);
/* Set LED pin as output */
//gpio_pin_configure(dev, LED, GPIO_DIR_OUT);


struct sensor_value green;
struct device *dev = device_get_binding("MAX30101");

if (dev == NULL) {
printk("Could not get max30101 device\n");
return;
}

while (1) {
/* Set pin to HIGH/LOW every 1 second */
sensor_sample_fetch(dev);
sensor_channel_get(dev, SENSOR_CHAN_GREEN, &green);
/* Print green LED data*/
printk("GREEN=%d\n", green.val1);
k_sleep(20);
//gpio_pin_write(dev, LED, cnt % 2);
printk("Hello World! %s\n", CONFIG_BOARD);
cnt++;
k_sleep(SLEEP_TIME);
}
}

CONF FILE in red

CONFIG_GPIO=y
CONFIG_SERIAL=y
CONFIG_I2C=y
CONFIG_I2C_NRFX=y
CONFIG_I2C_1=y
CONFIG_I2C_1_NRF_TWIM=y
CONFIG_SENSOR=y
CONFIG_LOG=y
CONFIG_TRUSTED_EXECUTION_NONSECURE=y
CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_AT_HOST_LIBRARY=y
CONFIG_MAIN_STACK_SIZE=4096
CONFIG_SENSOR_LOG_LEVEL_DBG=y
CONFIG_MAX30101=y

Parents Reply Children
No Data
Related