Faster load short circuit protection via LPTIM

The PWM charge controllers don't have a fuse and need a reliable load short
circuit protection implemented in the microcontroller. The comparator
monitoring the load current now triggers LPTIM connected to the load
disable pin. This allows to switch off the load with a defined time delay
and glitch filter.

During tests, switching off the load in an ISR triggered by COMP2 did
not lead to reliable delays (especially in case of wake-up from sleep),
hence this alternative solution using LPTIM was implemented.

The load switch functions were moved from hardware.cpp to load.cpp.
This commit is contained in:
Martin Jaeger
2019-06-12 09:45:19 +02:00
parent f0301625d7
commit 0e91c834ac
5 changed files with 194 additions and 115 deletions
+8
View File
@@ -63,6 +63,14 @@ typedef struct {
*/
void load_init(load_output_t *load);
/** Enable/disable load switch
*/
void load_switch_set(bool enabled);
/** Enable/disable USB output
*/
void load_usb_set(bool enabled);
/** State machine, called every second.
*/
void load_state_machine(load_output_t *load, bool source_enabled);