Add DC/DC HV side output enable switch
This commit is contained in:
@@ -38,6 +38,7 @@
|
||||
|
||||
leds {
|
||||
compatible = "gpio-leds";
|
||||
|
||||
pwr {
|
||||
gpios = <&gpioc 15 GPIO_ACTIVE_HIGH>;
|
||||
label = "Power LED";
|
||||
@@ -46,21 +47,29 @@
|
||||
|
||||
outputs {
|
||||
compatible = "outputs";
|
||||
|
||||
pwm_switch {
|
||||
label = "PWM power switch (solar panel)";
|
||||
pwms = <&pwm3 2 (20*1000*1000)>; /* 20 ms period = 50 Hz */
|
||||
current-max = <20>;
|
||||
kconfig-flag; /* make node visible in Kconfig */
|
||||
};
|
||||
|
||||
load {
|
||||
label = "Load output";
|
||||
gpios = <&gpiob 15 GPIO_ACTIVE_LOW>;
|
||||
current-max = <20>;
|
||||
};
|
||||
|
||||
charge_pump {
|
||||
label = "Charge pump for HS MOSFET drivers";
|
||||
pwms = <&pwm8 1 200000>; /* 200 us period = 5 kHz */
|
||||
};
|
||||
|
||||
hv-ext-sense {
|
||||
label = "HV external sense and switch";
|
||||
gpios = <&gpiob 12 GPIO_ACTIVE_LOW>;
|
||||
};
|
||||
};
|
||||
|
||||
adc-inputs {
|
||||
|
||||
@@ -51,6 +51,11 @@
|
||||
label = "CAN disable / standby";
|
||||
gpios = <&gpiob 14 GPIO_ACTIVE_LOW>;
|
||||
};
|
||||
|
||||
hv-ext-sense {
|
||||
label = "HV external sense and switch";
|
||||
gpios = <&gpiob 12 GPIO_ACTIVE_LOW>;
|
||||
};
|
||||
};
|
||||
|
||||
adc-inputs {
|
||||
|
||||
@@ -8,6 +8,10 @@
|
||||
|
||||
#include <zephyr.h>
|
||||
|
||||
#ifndef UNIT_TEST
|
||||
#include <drivers/gpio.h>
|
||||
#endif
|
||||
|
||||
#include <math.h> // for fabs function
|
||||
#include <stdlib.h> // for min/max function
|
||||
#include <stdio.h>
|
||||
@@ -290,4 +294,22 @@ void Dcdc::fuse_destruction()
|
||||
counter++;
|
||||
}
|
||||
|
||||
void Dcdc::output_hvs_enable()
|
||||
{
|
||||
#ifdef DT_OUTPUTS_HV_EXT_SENSE_GPIOS_CONTROLLER
|
||||
struct device *dev_hv_ext = device_get_binding(DT_OUTPUTS_HV_EXT_SENSE_GPIOS_CONTROLLER);
|
||||
gpio_pin_configure(dev_hv_ext, DT_OUTPUTS_HV_EXT_SENSE_GPIOS_PIN,
|
||||
DT_OUTPUTS_HV_EXT_SENSE_GPIOS_FLAGS | GPIO_OUTPUT_ACTIVE);
|
||||
#endif
|
||||
}
|
||||
|
||||
void Dcdc::output_hvs_disable()
|
||||
{
|
||||
#ifdef DT_OUTPUTS_HV_EXT_SENSE_GPIOS_CONTROLLER
|
||||
struct device *dev_hv_ext = device_get_binding(DT_OUTPUTS_HV_EXT_SENSE_GPIOS_CONTROLLER);
|
||||
gpio_pin_configure(dev_hv_ext, DT_OUTPUTS_HV_EXT_SENSE_GPIOS_PIN,
|
||||
DT_OUTPUTS_HV_EXT_SENSE_GPIOS_FLAGS | GPIO_OUTPUT_INACTIVE);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* DT_COMPAT_DCDC */
|
||||
|
||||
+11
@@ -130,6 +130,17 @@ private:
|
||||
* @returns 0 if everything is fine, error number otherwise
|
||||
*/
|
||||
int perturb_observe_controller();
|
||||
|
||||
/**
|
||||
* If manual control of the reverse polarity MOSFET on the high-side is available, this
|
||||
* function enables it to use the high voltage side as output.
|
||||
*/
|
||||
void output_hvs_enable();
|
||||
|
||||
/**
|
||||
* Disable the reverse polarity MOSFET on the high-sied (if option available)
|
||||
*/
|
||||
void output_hvs_disable();
|
||||
};
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
Reference in New Issue
Block a user