Commit 011d79a
committed
drivers: adc: enhance millivolt conversion with 64-bit support
This commit updates the adc_raw_to_millivolts function to use 64-bit
arithmetic. It is necessary when the intermediate result is higher
than the maximum value of uint32_t. It also adds a range check to
ensure the conversion result does not exceed the limits of int32_t,
providing an assertion message for out-of-range values.
Signed-off-by: Martin Hoff <[email protected]>1 parent bc2c089 commit 011d79a
1 file changed
+8
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1155 | 1155 | | |
1156 | 1156 | | |
1157 | 1157 | | |
1158 | | - | |
1159 | | - | |
| 1158 | + | |
| 1159 | + | |
1160 | 1160 | | |
1161 | 1161 | | |
1162 | | - | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
| 1165 | + | |
| 1166 | + | |
| 1167 | + | |
1163 | 1168 | | |
1164 | 1169 | | |
1165 | 1170 | | |
| |||
0 commit comments