samples: sensors: drop dps310 sample as a more generic one exists
This sample adds no value compared to e.g. sensor shell. Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
This commit is contained in:
parent
7147b344a6
commit
e59c38fb6f
6 changed files with 0 additions and 124 deletions
|
@ -1,8 +0,0 @@
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 3.20.0)
|
|
||||||
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
|
|
||||||
|
|
||||||
project(dps310)
|
|
||||||
FILE(GLOB app_sources src/*.c)
|
|
||||||
target_sources(app PRIVATE ${app_sources})
|
|
|
@ -1,45 +0,0 @@
|
||||||
.. _dps310:
|
|
||||||
|
|
||||||
DPS310 Temperature and Pressure Sensor
|
|
||||||
######################################
|
|
||||||
|
|
||||||
Overview
|
|
||||||
********
|
|
||||||
|
|
||||||
This sample application periodically reads temperature and pressure data from
|
|
||||||
the first available device that implements SENSOR_CHAN_AMBIENT_TEMP and
|
|
||||||
SENSOR_CHAN_PRESS. This sample checks the sensor in polling mode (without
|
|
||||||
interrupt trigger).
|
|
||||||
|
|
||||||
Building and Running
|
|
||||||
********************
|
|
||||||
|
|
||||||
This sample application uses an DPS310 sensor connected to a board via I2C.
|
|
||||||
Connect the sensor pins according to the connection diagram given in the
|
|
||||||
`dps310 datasheet`_ at page 18 figure 7.
|
|
||||||
|
|
||||||
Build and flash this sample (for example, for the nrf52840dk/nrf52840 board)
|
|
||||||
using these commands:
|
|
||||||
|
|
||||||
.. zephyr-app-commands::
|
|
||||||
:zephyr-app: samples/sensor/dps310
|
|
||||||
:board: nrf52840dk/nrf52840
|
|
||||||
:goals: flash
|
|
||||||
:compact:
|
|
||||||
|
|
||||||
Sample Output
|
|
||||||
=============
|
|
||||||
To check output of this sample, any serial console program can be used.
|
|
||||||
This example uses ``picocom`` on the serial port ``/dev/ttyUSB0``:
|
|
||||||
|
|
||||||
.. code-block:: console
|
|
||||||
|
|
||||||
$ sudo picocom -D /dev/ttyUSB0
|
|
||||||
|
|
||||||
.. code-block:: console
|
|
||||||
|
|
||||||
temp: 23.774363; press: 97.354728
|
|
||||||
temp: 23.777492; press: 97.353904
|
|
||||||
temp: 23.784646; press: 97.354064
|
|
||||||
|
|
||||||
.. _dps310 datasheet: https://www.infineon.com/dgdl/Infineon-DPS310-DataSheet-v01_01-EN.pdf?fileId=5546d462576f34750157750826c42242
|
|
|
@ -1,17 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2019 Infineon Technologies AG
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* A DPS310 attached to the Arduino I2C pins
|
|
||||||
*/
|
|
||||||
|
|
||||||
&arduino_i2c {
|
|
||||||
DPS310@77 {
|
|
||||||
status = "okay";
|
|
||||||
compatible = "infineon,dps310";
|
|
||||||
reg = <0x77>;
|
|
||||||
};
|
|
||||||
};
|
|
|
@ -1,3 +0,0 @@
|
||||||
CONFIG_STDOUT_CONSOLE=y
|
|
||||||
CONFIG_I2C=y
|
|
||||||
CONFIG_SENSOR=y
|
|
|
@ -1,14 +0,0 @@
|
||||||
sample:
|
|
||||||
name: DP310 Sensor sample
|
|
||||||
tests:
|
|
||||||
sample.sensor.dps310:
|
|
||||||
harness: console
|
|
||||||
tags: sensors
|
|
||||||
depends_on:
|
|
||||||
- i2c
|
|
||||||
- arduino_i2c
|
|
||||||
harness_config:
|
|
||||||
type: one_line
|
|
||||||
regex:
|
|
||||||
- "temp: (.*); press: (.*);"
|
|
||||||
fixture: fixture_i2c_dps310
|
|
|
@ -1,37 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2019 Infineon Technologies AG
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <zephyr/kernel.h>
|
|
||||||
#include <zephyr/device.h>
|
|
||||||
#include <zephyr/drivers/sensor.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
printk("Hello DPS310\n");
|
|
||||||
const struct device *const dev = DEVICE_DT_GET_ONE(infineon_dps310);
|
|
||||||
|
|
||||||
if (!device_is_ready(dev)) {
|
|
||||||
printk("Device %s is not ready\n", dev->name);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
printk("dev %p name %s\n", dev, dev->name);
|
|
||||||
|
|
||||||
while (1) {
|
|
||||||
struct sensor_value temp, press;
|
|
||||||
|
|
||||||
sensor_sample_fetch(dev);
|
|
||||||
sensor_channel_get(dev, SENSOR_CHAN_AMBIENT_TEMP, &temp);
|
|
||||||
sensor_channel_get(dev, SENSOR_CHAN_PRESS, &press);
|
|
||||||
|
|
||||||
printk("temp: %d.%06d; press: %d.%06d\n",
|
|
||||||
temp.val1, abs(temp.val2), press.val1, press.val2);
|
|
||||||
|
|
||||||
k_sleep(K_MSEC(1000));
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
Loading…
Add table
Add a link
Reference in a new issue