-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
samples: sensor: bme680: Extend upstream sample
Add sample that reuses source code from "original" sample that existing in the upstream Zephyr. Extend sample with configurations that rely on internal shields pca63565 and pca63566. Remove Twister alt-config for upstream sample. Signed-off-by: Sebastian Głąb <[email protected]>
- Loading branch information
1 parent
7e02f62
commit 3dadda7
Showing
7 changed files
with
76 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# | ||
# Copyright (c) 2018 Bosch Sensortec GmbH | ||
# | ||
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause | ||
# | ||
|
||
cmake_minimum_required(VERSION 3.20.0) | ||
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) | ||
project(bme680) | ||
|
||
FILE(GLOB app_sources src/*.c) | ||
target_sources(app PRIVATE ${app_sources}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
This sample extends the same-named Zephyr sample to verify it with Nordic development kits. | ||
|
||
Source code and basic configuration files can be found in the corresponding folder structure in zephyr/samples/sensor/bme680. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
CONFIG_STDOUT_CONSOLE=y | ||
CONFIG_I2C=y | ||
CONFIG_SENSOR=y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Copyright (c) 2018 Bosch Sensortec GmbH | ||
* | ||
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause | ||
*/ | ||
|
||
#include <zephyr/kernel.h> | ||
#include <zephyr/device.h> | ||
#include <zephyr/drivers/sensor.h> | ||
#include <stdio.h> | ||
|
||
int main(void) | ||
{ | ||
const struct device *const dev = DEVICE_DT_GET_ONE(bosch_bme680); | ||
struct sensor_value temp, press, humidity, gas_res; | ||
|
||
if (!device_is_ready(dev)) { | ||
printk("sensor: device not ready.\n"); | ||
return 0; | ||
} | ||
|
||
printf("Device %p name is %s\n", dev, dev->name); | ||
|
||
#ifndef CONFIG_COVERAGE | ||
while (1) { | ||
#else | ||
for (int i = 0; i < 5; i++) { | ||
#endif | ||
k_sleep(K_MSEC(3000)); | ||
|
||
sensor_sample_fetch(dev); | ||
sensor_channel_get(dev, SENSOR_CHAN_AMBIENT_TEMP, &temp); | ||
sensor_channel_get(dev, SENSOR_CHAN_PRESS, &press); | ||
sensor_channel_get(dev, SENSOR_CHAN_HUMIDITY, &humidity); | ||
sensor_channel_get(dev, SENSOR_CHAN_GAS_RES, &gas_res); | ||
|
||
printf("T: %d.%06d; P: %d.%06d; H: %d.%06d; G: %d.%06d\n", | ||
temp.val1, temp.val2, press.val1, press.val2, | ||
humidity.val1, humidity.val2, gas_res.val1, | ||
gas_res.val2); | ||
} | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters