13 #include "dev_boost_typedef.h" 14 #include "dev_boost_opstates.h" 15 #include "dev_boost_pconfig.h" 30 volatile uint16_t drv_BoostConverter_Initialize(
volatile struct BOOST_CONVERTER_s *boostInstance)
32 volatile uint16_t retval = 1;
33 volatile uint16_t _i=0;
35 retval &= boostPWM_ModuleInitialize(boostInstance);
36 retval &= boostPWM_ChannelInitialize(boostInstance);
38 retval &= boostADC_ModuleInitialize();
41 retval &= boostADC_ChannelInitialize(&boostInstance->
feedback.
ad_vin);
45 retval &= boostADC_ChannelInitialize(&boostInstance->
feedback.
ad_isns[_i]);
47 retval &= boostGPIO_Initialize(boostInstance);
60 boostInstance->
state_id.
value = (uint32_t)BOOST_OPSTATE_INITIALIZE;
82 volatile uint16_t drv_BoostConverter_Execute(
volatile struct BOOST_CONVERTER_s *boostInstance)
84 volatile uint16_t retval=1;
90 if(boostInstance == NULL)
99 uint16_t pin_state = boostGPIO_GetPinState(&boostInstance->
gpio.
EnableInput);
118 boostInstance->
state_id.
value = (uint32_t)BOOST_OPSTATE_INITIALIZE;
120 boostInstance->
state_id.
value = (uint32_t)BOOST_OPSTATE_RESET;
123 retval = BoostConverterStateMachine[boostInstance->
state_id.
bits.opstate_id](boostInstance);
125 return((
bool)(retval>0));
134 if(boostInstance->
state_id.
bits.opstate_id >= BoostStateList_size)
135 boostInstance->
state_id.
value = (uint32_t)BOOST_OPSTATE_INITIALIZE;
137 if (BoostConverterStateMachine[boostInstance->
state_id.
bits.opstate_id] == NULL)
142 retval = BoostConverterStateMachine[boostInstance->
state_id.
bits.opstate_id](boostInstance);
147 case BOOST_OPSRET_ERROR:
149 boostInstance->
state_id.
value = (uint32_t)BOOST_OPSTATE_INITIALIZE;
154 case BOOST_OPSRET_COMPLETE:
160 if (boostInstance->
state_id.
bits.opstate_id >= BoostStateList_size)
161 boostInstance->
state_id.
value = (uint32_t)BOOST_OPSTATE_RESET;
167 case BOOST_OPSRET_REPEAT:
177 boostInstance->
state_id.
value = (uint32_t)BOOST_OPSTATE_INITIALIZE;
197 volatile uint16_t drv_BoostConverter_Start(
volatile struct BOOST_CONVERTER_s * boostInstance) {
199 volatile uint16_t retval=1;
200 volatile uint16_t _i=0;
216 retval &= boostPWM_Start(boostInstance);
218 retval &= boostADC_Start();
222 boostInstance->
state_id.
value = (uint32_t)BOOST_OPSTATE_INITIALIZE;
240 volatile uint16_t drv_BoostConverter_Stop(
volatile struct BOOST_CONVERTER_s *boostInstance) {
242 volatile uint16_t retval=1;
243 volatile uint16_t _i=0;
246 retval &= boostPWM_Stop(boostInstance);
256 boostInstance->
state_id.
value = (uint32_t)BOOST_OPSTATE_INITIALIZE;
273 volatile uint16_t drv_BoostConverter_Suspend(
volatile struct BOOST_CONVERTER_s *boostInstance) {
275 volatile uint16_t retval=1;
278 retval &= drv_BoostConverter_Execute(boostInstance);
294 volatile uint16_t drv_BoostConverter_Resume(
volatile struct BOOST_CONVERTER_s *boostInstance) {
296 volatile uint16_t retval=1;
299 retval &= drv_BoostConverter_Execute(boostInstance);
enum BOOST_CONTROL_MODE_e control_mode
Fundamental control mode.
volatile struct NPNZ16b_s * controller
pointer to control loop object data structure
volatile bool fault_active
Bit #5: Flag bit indicating system is in enforced shut down mode (usually due to a fault condition)
volatile struct BOOST_ADC_INPUT_SETTINGS_s ad_vout
ADC input sampling output voltage.
volatile struct BOOST_LOOP_SETTINGS_s v_loop
BOOST voltage control loop object.
volatile uint16_t no_of_phases
number of converter phases
volatile struct BOOST_ADC_INPUT_SETTINGS_s ad_temp
ADC input sampling temperature.
volatile bool suspend
Bit #6: Control bit to put the converter in suspend mode (turned off while ENABLE bit is still on)
volatile bool enabled
Bit #15: Control bit enabling/disabling the charger port.
void(* ctrl_Reset)(volatile struct NPNZ16b_s *)
Function pointer to RESET routine.
volatile bool enabled
Specifies, if this IO is used or not.
volatile bool ready
Bit #0: status bit, indicating boost converter is initialized and ready to run.
volatile struct BOOST_ADC_INPUT_SETTINGS_s ad_vin
ADC input sampling input voltage.
volatile bool pwm_active
Bit #2: indicating that PWM has been started and ADC triggers are generated.
struct BOOST_STATE_ID_s::@372::@373 bits
volatile struct BOOST_LOOP_SETTINGS_s i_loop[BOOST_MPHASE_COUNT]
BOOST Current control loop objects.
volatile struct NPNZ_STATUS_s status
Control Loop Status and Control flags.
volatile uint16_t polarity
Output polarity, where 0=ACTIVE HIGH, 1=ACTIVE_LOW.
volatile struct BOOST_FEEDBACK_SETTINGS_s feedback
BOOST converter feedback settings.
volatile struct BOOST_CONVERTER_STATUS_s status
BOOST operation status bits.
volatile struct BOOST_GPIO_SETTINGS_s gpio
BOOST converter additional GPIO specification.
volatile struct BOOST_STATE_ID_s state_id
BOOST state machine operating state ID.
volatile struct BOOST_GPIO_INSTANCE_s EnableInput
External ENABLE input.
BOOST control & monitoring data structure.
volatile struct BOOST_ADC_INPUT_SETTINGS_s ad_isns[BOOST_MPHASE_COUNT]
ADC input sampling phase current.
volatile struct BOOST_CONVERTER_SETTINGS_s set_values
Control field for global access to references.
volatile bool enabled
Bit 15: enables/disables control loop execution.