summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/app/ws2812b_uart/main.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/app/ws2812b_uart/main.cc b/src/app/ws2812b_uart/main.cc
index b35800a..791e67a 100644
--- a/src/app/ws2812b_uart/main.cc
+++ b/src/app/ws2812b_uart/main.cc
@@ -226,6 +226,17 @@ int main(void)
target_mode = blinkencat.COLOR_RGB;
}
}
+ if (ADCSRA & _BV(ADIF)) {
+ uint8_t adcr_l = ADCL;
+ uint8_t adcr_h = ADCH;
+ uint16_t adcr = adcr_l + (adcr_h << 8);
+ uint16_t vcc = 1100L * 1023 / adcr;
+
+ TIFR1 |= _BV(TOV1);
+ ADCSRA |= _BV(ADIF);
+
+ kout << "VCC = " << vcc << endl;
+ }
}
return 0;