diff options
Diffstat (limited to 'include/voltdisc.h')
-rw-r--r-- | include/voltdisc.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/include/voltdisc.h b/include/voltdisc.h new file mode 100644 index 0000000..562b352 --- /dev/null +++ b/include/voltdisc.h @@ -0,0 +1,19 @@ +#pragma once + +// Volatge discovery. Determines what the voltage of the christmas lights is. +// +// This is done by using channel 0 of the ADC (which is on pin PA4). There is a +// voltage divider from the main power source to pin PA4 which uses a 4.7MOhm +// resistor and a 470KOhm resistor to divide the voltage by 10, which may then +// be turned into a reading on the ADC. +// +// This helps to determine if the lights being driven are WS2812b's or WS2811 as +// the latter are run on 12v and use RGB instead of GRB byte order. + + +#include <stdint.h> + +typedef uint32_t millivolts_t; + +// Returns the estimated input voltage in millivolts. +millivolts_t get_input_voltage(); |