hc
2023-10-25 6c2073b7aa40e29d0eca7d571dd7bc590c7ecaa7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
Voltage divider
===============
 
When an io-channel measures the midpoint of a voltage divider, the
interesting voltage is often the voltage over the full resistance
of the divider. This binding describes the voltage divider in such
a curcuit.
 
    Vin ----.
            |
         .-----.
         |  R  |
         '-----'
            |
            +---- Vout
            |
         .-----.
         | Rout|
         '-----'
            |
           GND
 
Required properties:
- compatible : "voltage-divider"
- io-channels : Channel node of a voltage io-channel measuring Vout.
- output-ohms : Resistance Rout over which the output voltage is measured.
           See full-ohms.
- full-ohms : Resistance R + Rout for the full divider. The io-channel
         is scaled by the Rout / (R + Rout) quotient.
 
Example:
The system voltage is circa 12V, but divided down with a 22/222
voltage divider (R = 200 Ohms, Rout = 22 Ohms) and fed to an ADC.
 
sysv {
   compatible = "voltage-divider";
   io-channels = <&maxadc 1>;
 
   /* Scale the system voltage by 22/222 to fit the ADC range. */
   output-ohms = <22>;
   full-ohms = <222>; /* 200 + 22 */
};
 
&spi {
   maxadc: adc@0 {
       compatible = "maxim,max1027";
       reg = <0>;
       #io-channel-cells = <1>;
       interrupt-parent = <&gpio5>;
       interrupts = <15 IRQ_TYPE_EDGE_RISING>;
       spi-max-frequency = <1000000>;
   };
};