Allow custom DC/DC control functions

A Kconfig CUSTOM_DCDC_CONTROLLER is introduced to enable implementation of
more sophisticated control functions than the standard perturb and observe.

A function dcdc_low_level_controller() must be implemented and is called
from the DMA interrupt after each new current sensor reading.

The default Dcdc::control() function is defined __weak.
This commit is contained in:
Martin Jäger
2020-06-05 16:22:41 +02:00
parent 2875ea1519
commit fc0276e72c
7 changed files with 62 additions and 11 deletions
+7
View File
@@ -34,6 +34,7 @@
#include <stm32g4xx_ll_bus.h>
#endif
#include "dcdc.h" // for low-level control function called by DMA
#include "board.h"
#include "debug.h"
@@ -226,6 +227,12 @@ static void DMA2_Channel1_IRQHandler(void *args)
}
}
DMA2->IFCR |= 0x0FFFFFFF; // clear all interrupt registers
#ifdef CONFIG_CUSTOM_DCDC_CONTROLLER
// Implement this function e.g. for cycle-by-cylce current limitation.
// As it runs in an ISR with high frequency, it must be VERY fast!
dcdc_low_level_controller();
#endif
}
#endif // CONFIG_SOC_SERIES_STM32G4X