summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--board/puff/board.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/board/puff/board.c b/board/puff/board.c
index 77d632b9a3..7e27178469 100644
--- a/board/puff/board.c
+++ b/board/puff/board.c
@@ -98,11 +98,17 @@ const struct i2c_port_t i2c_ports[] = {
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
const struct adc_t adc_channels[] = {
- [ADC_SNS_PP3300] = { /* 9/11 voltage divider */
+ [ADC_SNS_PP3300] = {
+ /*
+ * 4700/5631 voltage divider: can take the value out of range
+ * for 32-bit signed integers, so truncate to 470/563 yielding
+ * <0.1% error and a maximum intermediate value of 1623457792,
+ * which comfortably fits in int32.
+ */
.name = "SNS_PP3300",
.input_ch = NPCX_ADC_CH2,
- .factor_mul = ADC_MAX_VOLT * 11,
- .factor_div = (ADC_READ_MAX + 1) * 9,
+ .factor_mul = ADC_MAX_VOLT * 563,
+ .factor_div = (ADC_READ_MAX + 1) * 470,
},
[ADC_SNS_PP1050] = {
.name = "SNS_PP1050",