diff options
author | Josh Rahm <joshuarahm@gmail.com> | 2025-09-30 13:06:16 -0600 |
---|---|---|
committer | Josh Rahm <joshuarahm@gmail.com> | 2025-09-30 13:06:16 -0600 |
commit | 290d784950b6248782b049cd9831bd6e034fd538 (patch) | |
tree | c231c02e92ed83a02b234a85b3c07bcc5e44b168 /include/voltdisc.h | |
parent | f89f75b5616de99865448f41b068a2783cd3648e (diff) | |
download | ch573-main.tar.gz ch573-main.tar.bz2 ch573-main.zip |
Add many different patterns, and organize it.
Add a voltage discovery subsystem to allow the ch573 to detect if it's
on 12v or 5v lights.
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(); |