10 #include "drivers/v_loop.h" 11 #include "devices/dev_boost_typedef.h" 12 #include "devices/dev_boost_converter.h" 13 #include "config/hal.h" 15 #include "fault_handler/app_fault_monitor.h" 31 extern volatile uint16_t appPowerSupply_ConverterObjectInitialize(
void);
32 extern volatile uint16_t appPowerSupply_ControllerInitialize(
void);
33 extern volatile uint16_t appPowerSupply_PeripheralsInitialize(
void);
38 #define ISNS_AVG_BITMASK (uint16_t)0x0007 39 volatile uint16_t _isns_sample_count = 0;
40 volatile uint16_t isns_samples;
63 volatile uint16_t appPowerSupply_Execute(
void)
65 volatile uint16_t retval=1;
75 if(!(++_isns_sample_count & ISNS_AVG_BITMASK))
77 isns_samples = (isns_samples >> 3);
79 if((int16_t)isns_samples < 0) isns_samples = 0;
82 isns_samples = (uint16_t)( (
float)boost.
data.
v_in * (float)isns_samples / (
float)boost.
data.
v_out );
89 retval &= drv_BoostConverter_Execute(&boost);
93 if(((boost.
state_id.
bits.opstate_id >= BOOST_OPSTATE_RAMPUP) &&
94 (boost.
state_id.
bits.substate_id >= BOOST_OPSTATE_V_RAMP_UP)) ||
95 ((boost.
state_id.
bits.opstate_id == BOOST_OPSTATE_ONLINE)))
98 #if (PLANT_MEASUREMENT == false) 136 volatile uint16_t appPowerSupply_Initialize(
void)
138 volatile uint16_t retval=1;
141 retval &= appPowerSupply_ConverterObjectInitialize();
142 retval &= appPowerSupply_ControllerInitialize();
143 retval &= appPowerSupply_PeripheralsInitialize();
146 _BOOST_VLOOP_ISR_IP = BOOST_VOUT_ISR_PRIORITY;
147 _BOOST_VLOOP_ISR_IF = 0;
148 _BOOST_VLOOP_ISR_IE =
true;
151 retval &= drv_BoostConverter_Start(&boost);
167 volatile uint16_t appPowerSupply_Start(
void)
169 volatile uint16_t retval=1;
171 retval &= drv_BoostConverter_Start(&boost);
195 volatile uint16_t appPowerSupply_Stop(
void)
197 volatile uint16_t retval=1;
199 retval &= drv_BoostConverter_Stop(&boost);
215 volatile uint16_t appPowerSupply_Suspend(
void)
217 volatile uint16_t retval=1;
219 retval &= drv_BoostConverter_Suspend(&boost);
236 volatile uint16_t appPowerSupply_Resume(
void)
238 volatile uint16_t retval=0;
240 retval &= drv_BoostConverter_Resume(&boost);
volatile struct NPNZ_PORTS_s Ports
Controller input and output ports.
volatile struct NPNZ16b_s * controller
pointer to control loop object data structure
volatile bool Enabled
Bit 15: Control bit enabling/disabling monitoring of the fault object.
volatile struct BOOST_LOOP_SETTINGS_s v_loop
BOOST voltage control loop object.
#define BOOST_VIN_OFFSET
Input voltage feedback offset.
volatile struct FLT_COMPARE_OBJECT_s ReferenceObject
Reference object the source should be compared with.
volatile struct FLT_OBJECT_STATUS_s Status
Status word of this fault object.
volatile uint16_t * ptrObject
Pointer to register or variable which should be monitored.
volatile uint16_t feedback_offset
Feedback offset value for calibration or bi-direction feedback signals.
volatile uint16_t temp
BOOST board temperature.
volatile uint16_t v_in
BOOST input voltage.
volatile uint16_t i_out
BOOST common output current.
#define TEMP_ADCBUF
GPIO analog function mode enable bit.
struct BOOST_STATE_ID_s::@372::@373 bits
volatile struct BOOST_CONVERTER_DATA_s data
BOOST runtime data.
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.
#define BOOST_VIN_ADCBUF
ADC input buffer of this ADC channel.
volatile uint16_t i_sns[BOOST_MPHASE_COUNT]
BOOST output current.
volatile uint16_t v_out
BOOST output voltage.
volatile uint16_t * ptrControlReference
Pointer to global variable of input register holding the controller reference value (e....
#define BOOST_ISNS_ADCBUF
ADC input buffer of this ADC channel.
volatile struct BOOST_STATE_ID_s state_id
BOOST state machine operating state ID.
BOOST control & monitoring data structure.
volatile bool enabled
Bit 15: enables/disables control loop execution.