blob: 562b352a9ebea3172270d0214bab3a028eba2101 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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();
|