Skip to content
This repository was archived by the owner on Jan 28, 2021. It is now read-only.
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
changed prints
  • Loading branch information
vid553 committed Nov 2, 2020
commit 9ccdb9f7492ab65d1d36d4ef06a60d479cc6e634
13 changes: 5 additions & 8 deletions examples/Example_Zephyr/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#include <device.h>
#include <drivers/i2c.h>
#include <errno.h>
#include <logging/log.h>
#include <zephyr.h>
#include <zephyr/types.h>

Expand All @@ -26,8 +25,6 @@

#define I2C_DEV "I2C_0"

LOG_MODULE_REGISTER(zephyr_main); // init logging

struct device *gpio_dev;
struct device *i2c_dev;
/* I2C pins used are defaults for I2C_0 on nrf52840
Expand All @@ -39,7 +36,7 @@ uint8_t init_gpio(void) {
const char* gpioName = "GPIO_0";
gpio_dev = device_get_binding(gpioName);
if (gpio_dev == NULL) {
LOG_ERR("Could not get %s device", gpioName);
printk("Error: Could not get %s device\n", gpioName);
return -EIO;
}
int err = set_gpio_dev(gpio_dev);
Expand All @@ -53,28 +50,28 @@ uint8_t init_i2c(void) {
i2c_dev = device_get_binding(I2C_DEV);
if (!i2c_dev)
{
LOG_ERR("I2C_0 error");
printk("I2C_0 error\n");
return -1;
}
else
{
LOG_INF("I2C_0 Init OK");
printk("I2C_0 Init OK\n");
return 0;
}
}

uint8_t init_gps(void) {
if (gps_begin(i2c_dev) != 0)
{
LOG_ERR("Ublox GPS init error!");
printk("Ublox GPS init error!\n");
return -1;
}
return 0;
}


void main(void) {
LOG_INF("Ublox Zephyr example");
printk("Ublox Zephyr example\n");

int err;
err = init_gpio();
Expand Down