drivers: sensor: sensirion: shtcx: remove chip property
Removes the dts "chip" property, the compatible should be used instead. Any existing dts should be converted from something like: test_i2c_shtc3: shtc3@70 { compatible = "sensirion,shtcx"; reg = <0x70>; chip = "shtc3"; measure-mode = "normal"; clock-stretching; }; to something like: test_i2c_shtc3: shtc3@70 { compatible = "sensirion,shtc3", "sensirion,shtcx"; reg = <0x70>; measure-mode = "normal"; clock-stretching; }; Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
This commit is contained in:
parent
49d09ecb28
commit
34cac05775
3 changed files with 31 additions and 16 deletions
|
@ -237,10 +237,13 @@ static int shtcx_init(const struct device *dev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#define SHTCX_CHIP(inst) \
|
||||
(DT_INST_NODE_HAS_COMPAT(inst, sensirion_shtc1) ? CHIP_SHTC1 : CHIP_SHTC3)
|
||||
|
||||
#define SHTCX_CONFIG(inst) \
|
||||
{ \
|
||||
.i2c = I2C_DT_SPEC_INST_GET(inst), \
|
||||
.chip = DT_INST_ENUM_IDX(inst, chip), \
|
||||
.chip = SHTCX_CHIP(inst), \
|
||||
.measure_mode = DT_INST_ENUM_IDX(inst, measure_mode), \
|
||||
.clock_stretching = DT_INST_PROP(inst, clock_stretching) \
|
||||
}
|
||||
|
|
|
@ -1,24 +1,30 @@
|
|||
# Copyright (c) 2021, Thomas Stranger
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
description: Sensirion SHTCx humidity and temperature sensor
|
||||
description: |
|
||||
Sensirion SHTCx humidity and temperature sensor
|
||||
|
||||
Additionally use "sensirion,shtc1" or "sensirion,shtc3" compatibles
|
||||
such that a generic driver can consider chip specific behaviour.
|
||||
|
||||
Example device tree node describing a Sensirion SHTC3 Sensor on the i2c0 bus:
|
||||
|
||||
&i2c0 {
|
||||
status = "okay";
|
||||
clock-frequency = <I2C_BITRATE_FAST>;
|
||||
shtc3@70 {
|
||||
compatible = "sensirion,shtc3", "sensirion,shtcx";
|
||||
reg = <0x70>;
|
||||
measure-mode = "normal";
|
||||
clock-stretching;
|
||||
};
|
||||
};
|
||||
|
||||
compatible: "sensirion,shtcx"
|
||||
|
||||
include: [sensor-device.yaml, i2c-device.yaml]
|
||||
|
||||
properties:
|
||||
chip:
|
||||
type: string
|
||||
required: true
|
||||
description: |
|
||||
Specifies which chip exactly is used. This is necessary to get exact
|
||||
timing information and supported command set.
|
||||
SHTC3 has an additional sleep mode that is entered between measurements.
|
||||
enum:
|
||||
- "shtc1"
|
||||
- "shtc3"
|
||||
|
||||
measure-mode:
|
||||
type: string
|
||||
required: true
|
||||
|
|
|
@ -231,10 +231,9 @@ test_i2c_sht4xd: sht4x@20 {
|
|||
repeatability = <2>;
|
||||
};
|
||||
|
||||
test_i2c_shtc3: SHTC3@21 {
|
||||
compatible = "sensirion,shtcx";
|
||||
test_i2c_shtc3: shtc3@21 {
|
||||
compatible = "sensirion,shtc3", "sensirion,shtcx";
|
||||
reg = <0x21>;
|
||||
chip = "shtc3";
|
||||
measure-mode = "normal";
|
||||
clock-stretching;
|
||||
};
|
||||
|
@ -1049,3 +1048,10 @@ test_i2c_ina226: ina226@8d {
|
|||
current-lsb-microamps = <5000>;
|
||||
rshunt-micro-ohms = <500>;
|
||||
};
|
||||
|
||||
test_i2c_shtc1: shtc1@8e {
|
||||
compatible = "sensirion,shtc1", "sensirion,shtcx";
|
||||
reg = <0x8e>;
|
||||
measure-mode = "low-power";
|
||||
clock-stretching;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue