Skip to content

Commit

Permalink
devicetree: Add a first sensor to dts
Browse files Browse the repository at this point in the history
Each sensor would be expected to describe some common attributes in an
include file like this and be included in the board/soc dts where the
sensor is used.

In this way common sensor channels and descriptions would be available.

Signed-off-by: Tom Burdick <[email protected]>
  • Loading branch information
teburd committed Nov 27, 2023
1 parent f2c8fe4 commit 746ece6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@

&arduino_i2c {
bmi160_ti_bp_bassensorsmkii: bmi160@69 {
compatible = "bosch,bmi160";
reg = <0x69>;
int-gpios = <&arduino_header 8 GPIO_ACTIVE_HIGH>;
#include <sensor/bosch/bosch_bmi160.dtsi>
};

opt3001_ti_bp_bassensorsmkii: opt3001@44 {
Expand Down
18 changes: 18 additions & 0 deletions dts/sensor/bosch/bosch_bmi160.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* Copyright (c) 2023 Intel Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/

#include <zephyr/dt-bindings/sensor/channel.h>
#include <zephyr/dt-bindings/sensor/field.h>

compatible = "bosch,bmi160";

accel@0 {
compatible = "zephyr,sensor-channel";
channel-type = SENSOR_CHANNEL_ACCELERATION;
channel-index = 0;
channel-fields = <SENSOR_FIELD_X SENSOR_FIELD_Y SENSOR_FIELD_Z>;
}

0 comments on commit 746ece6

Please sign in to comment.