Class PowerAPI
Public Functions
Type | Name |
---|---|
void | connectCapacitor (leg_t leg) Connect the electrolytic capacitor. |
void | connectDriver (leg_t leg) Turns the driver of the leg ON. This enables control over the power switches. |
void | disconnectCapacitor (leg_t leg) Disconnect the electrolytic capacitor. |
void | disconnectDriver (leg_t leg) Turns the driver of the leg OFF. |
float32_t | getDutyCycleMax (leg_t leg) gets the Maximum Duty Cycle Limit as a float |
uint16_t | getDutyCycleMaxRaw (leg_t leg) gets the Maximum Duty Cycle Limit as an unsigned integer. |
float32_t | getDutyCycleMin (leg_t leg) gets the Minimum Duty Cycle Limit as a float |
uint16_t | getDutyCycleMinRaw (leg_t leg) gets the Minimum Duty Cycle Limit as an unsigned integer. |
uint16_t | getPeriod (leg_t leg) returns the value of the leg period as an unsigned integer |
void | initBoost (leg_t leg) Initialise all the legs for boost topology, current mode is not supported for boost. |
void | initBuck (leg_t leg, hrtim_pwm_mode_t leg_mode=VOLTAGE_MODE) Initialise a leg for buck topology. |
void | initMode (leg_t leg, hrtim_switch_convention_t leg_convention, hrtim_pwm_mode_t leg_mode) Initialize the power mode for a given leg. |
void | setAdcDecim (leg_t leg, uint16_t adc_decim) Sets ADC decimator for a leg. |
void | setDeadTime (leg_t leg, uint16_t ns_rising_dt, uint16_t ns_falling_dt) set the dead time value for a leg |
void | setDutyCycle (leg_t leg, float32_t duty_value) Set the duty cycle for a specific leg's power control. |
void | setDutyCycleMax (leg_t leg, float32_t duty_cycle) sets the Maximum Duty Cycle Limit |
void | setDutyCycleMaxRaw (leg_t leg, uint16_t duty_cycle) sets the Maximum Duty Cycle Limit as an unsigned int |
void | setDutyCycleMin (leg_t leg, float32_t duty_cycle) sets the Minimum Duty Cycle Limit |
void | setDutyCycleMinRaw (leg_t leg, uint16_t duty_cycle) sets the Minimum Duty Cycle Limit as an unsigned int |
void | setDutyCycleRaw (leg_t leg, uint16_t duty_value) Set the duty cycle for a specific leg's power control. |
void | setPhaseShift (leg_t leg, int16_t phase_shift) Set the phase shift value for a specific leg's power control. |
void | setSlopeCompensation (leg_t leg, float32_t set_voltage, float32_t reset_voltage) Set the slope compensation in current mode for a leg. |
void | setTriggerValue (leg_t leg, float32_t trigger_value) Set the trigger value for a specific leg's ADC trigger. |
void | start (leg_t leg) Start power output for a specific leg. |
void | stop (leg_t leg) Stop power output for a specific leg. |
Public Functions Documentation
function connectCapacitor
Connect the electrolytic capacitor.
Parameters:
leg
The selected leg for which the capacitor will be connected:LEG1
toALL
Warning:
This function can only be called AFTER initializing the LEG
.
function connectDriver
Turns the driver of the leg ON. This enables control over the power switches.
Parameters:
leg
The leg for which the driver will be turned on:LEG1
toALL
Warning:
This function can only be called AFTER initializing the LEG.
function disconnectCapacitor
Disconnect the electrolytic capacitor.
Parameters:
leg
The selected leg for which the capacitor will be disconnected:LEG1
toALL
Warning:
This function can only be called AFTER initializing the LEG
.
function disconnectDriver
Turns the driver of the leg OFF.
Parameters:
leg
The leg for which the driver will be turned off:LEG1
toALL
Warning:
This function can only be called AFTER initializing the LEG.
function getDutyCycleMax
gets the Maximum Duty Cycle Limit as a float
Parameters:
leg
the leg for which to set dead time value:LEG1
toLEG5
.
Warning:
ALL
is NOT supported !
function getDutyCycleMaxRaw
gets the Maximum Duty Cycle Limit as an unsigned integer.
Parameters:
leg
the leg for which to set dead time value:LEG1
toLEG5
.
Warning:
ALL
is NOT supported !
function getDutyCycleMin
gets the Minimum Duty Cycle Limit as a float
Parameters:
leg
the leg for which to set dead time value:LEG1
toLEG5
.
Warning:
ALL
is NOT supported !
function getDutyCycleMinRaw
gets the Minimum Duty Cycle Limit as an unsigned integer.
Parameters:
leg
the leg for which to set dead time value:LEG1
toLEG5
.
Warning:
ALL
is NOT supported !
function getPeriod
returns the value of the leg period as an unsigned integer
Parameters:
leg
the leg for which to set dead time value:LEG1
toLEG5
.
Warning:
ALL
is NOT supported !
function initBoost
Initialise all the legs for boost topology, current mode is not supported for boost.
Parameters:
leg
Leg to initialize:LEG1
toALL
function initBuck
Initialise a leg for buck topology.
Parameters:
leg
Leg to initialize:LEG1
toALL
leg_mode
PWM mode -VOLTAGE_MODE
orCURRENT_MODE
Note:
CURRENT_MODE
only available to LEG1
and LEG2
for the Twist board
function initMode
Initialize the power mode for a given leg.
void PowerAPI::initMode (
leg_t leg,
hrtim_switch_convention_t leg_convention,
hrtim_pwm_mode_t leg_mode
)
This function configures modulation, frequency, phase shift, dead time, and other parameters for power control of a specified leg.
Parameters:
leg
The leg to initialize:LEG1
toALL
leg_convention
PWM Switch to be driven by the duty cycle:PWMx1
,PWMx2
leg_mode
PWM mode:VOLTAGE_MODE
,CURRENT_MODE
function setAdcDecim
Sets ADC decimator for a leg.
This function sets the number of event which will be ignored between two events. ie. you divide the number of trigger in a fixed period.
For example if adc_decim = 1, nothing changes but with adc_decims = 2 you have twice less adc trigger.
Parameters:
leg
leg for which to set adc decimator value:LEG1
toALL
adc_decim
adc decimator, a number between 1 and 32
function setDeadTime
set the dead time value for a leg
Parameters:
leg
the leg for which to set dead time value:LEG1
toALL
ns_rising_dt
rising dead time value in nanosecondsns_falling_dt
falling dead time value in nanoseconds
function setDutyCycle
Set the duty cycle for a specific leg's power control.
This function sets the duty cycle for the power control of a specified leg.
The duty cycle determines the ON/OFF ratio of the power signal for the leg.
Parameters:
leg
The leg for which to set the duty cycle:LEG1
toALL
duty_value
The duty cycle value to set (a floating-point number between0.1
and0.9
).
function setDutyCycleMax
sets the Maximum Duty Cycle Limit
Parameters:
leg
the leg for which to set dead time value:LEG1
toALL
duty_cycle
- new maximum duty cycle value between 0.0 and 1.0
function setDutyCycleMaxRaw
sets the Maximum Duty Cycle Limit as an unsigned int
Parameters:
leg
the leg for which to set dead time value:LEG1
toALL
duty_cycle
- new minimum duty cycle value between0
andperiod
function setDutyCycleMin
sets the Minimum Duty Cycle Limit
Parameters:
leg
the leg for which to set dead time value:LEG1
toALL
duty_cycle
- new minimum duty cycle value between 0.0 and 1.0
function setDutyCycleMinRaw
sets the Minimum Duty Cycle Limit as an unsigned int
Parameters:
leg
the leg for which to set dead time value:LEG1
toALL
duty_cycle
- new minimum duty cycle value between0
andperiod
function setDutyCycleRaw
Set the duty cycle for a specific leg's power control.
This function sets the duty cycle for the power control of a specified leg.
The duty cycle determines the ON/OFF time ratio of the power signal for the leg.
Parameters:
leg
The leg for which to set the duty cycle:LEG1
toALL
duty_value
The duty cycle value to set an unsigned integer number betweenduty_cycle_min_raw
andduty_cycle_max_raw
.
function setPhaseShift
Set the phase shift value for a specific leg's power control.
Parameters:
leg
The leg for which to set the phase shift value:LEG1
toALL
phase_shift
phase shift value in degrees between-360
and360
function setSlopeCompensation
Set the slope compensation in current mode for a leg.
Parameters:
leg
The leg to initialize:LEG1
toALL
set_voltage
in volt, the DAC peak voltage for slope compensation (value between0
and2.048
)reset_voltage
in volt, the DAC lowest voltage for slope compensation (value between0
and2.048
)
Warning:
Be sure that set_voltage > reset_voltage
function setTriggerValue
Set the trigger value for a specific leg's ADC trigger.
This function sets the trigger value for the ADC trigger of a specified leg.
The trigger value determines the level at which the ADC trigger is activated.
Parameters:
leg
The leg for which to set the ADC trigger value:LEG1
toALL
trigger_value
The trigger value to set between 0.05 and 0.95.
function start
Start power output for a specific leg.
This function initiates the power output for a specified leg by starting the PWM subunits associated with the leg's output pins.
If the leg's output pins are not declared inactive in the device tree, the corresponding subunits are started. eg.
If output1 is declared inactive in the device tree, PWMA1 will not start.
Parameters:
leg
The leg for which to start the power output:LEG1
toALL
function stop
Stop power output for a specific leg.
Parameters:
leg
The leg for which to stop the power output:LEG1
toALL
The documentation for this class was generated from the following file docs/core/zephyr/modules/owntech_shield_api/zephyr/src/Power.h