Skip to content
Permalink
Browse files

samples: sensor: bme280: Convert code to use printk

There isn't any specific need to use printf here, convert to use printk
instead.

Fixes #14997

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
  • Loading branch information...
galak committed Mar 28, 2019
1 parent c0a1f46 commit 6b4007e5ed8b77f155870b6c24e88529106bb342
Showing with 3 additions and 4 deletions.
  1. +3 −4 samples/sensor/bme280/src/main.c
@@ -7,18 +7,17 @@
#include <zephyr.h>
#include <device.h>
#include <sensor.h>
#include <stdio.h>

void main(void)
{
struct device *dev = device_get_binding("BME280");

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

printf("dev %p name %s\n", dev, dev->config->name);
printk("dev %p name %s\n", dev, dev->config->name);

while (1) {
struct sensor_value temp, press, humidity;
@@ -28,7 +27,7 @@ void main(void)
sensor_channel_get(dev, SENSOR_CHAN_PRESS, &press);
sensor_channel_get(dev, SENSOR_CHAN_HUMIDITY, &humidity);

printf("temp: %d.%06d; press: %d.%06d; humidity: %d.%06d\n",
printk("temp: %d.%06d; press: %d.%06d; humidity: %d.%06d\n",
temp.val1, temp.val2, press.val1, press.val2,
humidity.val1, humidity.val2);

0 comments on commit 6b4007e

Please sign in to comment.
You can’t perform that action at this time.