1# Copyright (c) 2021 Leonard Pollak
2# SPDX-License-Identifier: Apache-2.0
3
4description: Texas Instruments Bidirectional Current/Power Sensor
5
6compatible: "ti,ina219"
7
8include: [sensor-device.yaml, i2c-device.yaml]
9
10properties:
11  lsb-microamp:
12    type: int
13    required: true
14    description: |
15      Current LSB in microAmpere
16      Current LSB = max expected current [A] / 2^15
17      example: 100 -> ~3A
18  shunt-milliohm:
19    type: int
20    required: true
21    description: |
22      Value of the shunt resistor in milliOhm
23  brng:
24    type: int
25    default: 1
26    description: |
27      Bus Voltage Range
28      0 = 16 V FSR
29      1 = 32 V FSR
30
31      The default of 32V is the power-on reset value of the device.
32
33      Should the expected bus voltage be below 16V set this to 0.
34    enum:
35      - 0
36      - 1
37  pg:
38    type: int
39    default: 3
40    description: |
41      Programmable Gain
42      0 = 1  -> ±40 mV
43      1 = /2 -> ±80 mV
44      2 = /4 -> ±160 mV
45      3 = /8 -> ±320 mV
46
47      The default of ±320 mV is the power-on reset value of the device.
48
49      In case the expected voltage drop across the shunt resistor is lower
50      one can adjust this to get more accurate readings.
51    enum:
52      - 0
53      - 1
54      - 2
55      - 3
56  badc:
57    type: int
58    default: 3
59    description: |
60      Bus ADC configuration
61      0  = 9 bit -> 84 µs
62      1  = 10 bit -> 148 µs
63      2  = 11 bit -> 276 µs
64      3  = 12 bit -> 532 µs
65      9  = 12 bit - 2 sample averaging -> 1.06 ms
66      10 = 12 bit - 4 sample averaging -> 2.13 ms
67      11 = 12 bit - 8 sample averaging -> 4.26 ms
68      12 = 12 bit - 16 sample averaging -> 8.51 ms
69      13 = 12 bit - 32 sample averaging -> 17.02 ms
70      14 = 12 bit - 64 sample averaging -> 34.05 ms
71      15 = 12 bit - 128 sample averaging -> 68.10 ms
72
73      The default of 12 bit is the power-on reset value of the device.
74
75      Lowering the resolution of the ADC gives less accurate readings but
76      cuts down on conversion times.
77
78      Averaging over multiple samples gives more stable readings but adds
79      to overall conversion time.
80    enum:
81      - 0
82      - 1
83      - 2
84      - 3
85      - 9
86      - 10
87      - 11
88      - 12
89      - 13
90      - 14
91      - 15
92  sadc:
93    type: int
94    default: 3
95    description: |
96      Shunt ADC configuration
97      0  = 9 bit -> 84 µs
98      1  = 10 bit -> 148 µs
99      2  = 11 bit -> 276 µs
100      3  = 12 bit -> 532 µs
101      9  = 12 bit - 2 sample averaging -> 1.06 ms
102      10 = 12 bit - 4 sample averaging -> 2.13 ms
103      11 = 12 bit - 8 sample averaging -> 4.26 ms
104      12 = 12 bit - 16 sample averaging -> 8.51 ms
105      13 = 12 bit - 32 sample averaging -> 17.02 ms
106      14 = 12 bit - 64 sample averaging -> 34.05 ms
107      15 = 12 bit - 128 sample averaging -> 68.10 ms
108
109      The default of 12 bit is the power-on reset value of the device.
110
111      Lowering the resolution of the ADC gives less accurate readings but
112      cuts down on conversion times.
113
114      Averaging over multiple samples gives more stable readings but adds
115      to overall conversion time.
116    enum:
117      - 0
118      - 1
119      - 2
120      - 3
121      - 9
122      - 10
123      - 11
124      - 12
125      - 13
126      - 14
127      - 15
128