13 #include "xc16_pral.h" 14 #include "dev_boost_typedef.h" 15 #include "dev_boost_special_functions.h" 22 struct CS_CALIBRATION_s
26 volatile uint16_t counter;
27 volatile uint32_t buffer;
29 typedef struct CS_CALIBRATION_s CS_CALIBRATION_t;
45 volatile struct CS_CALIBRATION_s calib_cs[BOOST_MPHASE_COUNT];
53 #define CS_CALIB_STEPS 8 58 volatile uint16_t CurrentSenseOffsetCalibration(
volatile struct BOOST_CONVERTER_s *boostInstance);
88 volatile uint16_t (*BoostConverterSpecialFunctions[])
91 CurrentSenseOffsetCalibration
133 volatile uint16_t drv_BoostConverter_SpecialFunctionExecute(
135 volatile enum BOOST_SPECIAL_FUNCTIONS_e specialFunction
138 volatile uint16_t retval=0;
144 if(boostInstance == NULL)
150 retval = BoostConverterSpecialFunctions[specialFunction](boostInstance);
178 volatile uint16_t CurrentSenseOffsetCalibration(
volatile struct BOOST_CONVERTER_s *boostInstance)
180 volatile uint16_t _i=0;
181 volatile bool _complete=
true;
182 volatile enum BOOST_OPSTATE_RETURNS_e retval = BOOST_OPSRET_ERROR;
187 return((uint16_t)BOOST_OPSRET_COMPLETE);
194 {
return((uint16_t)BOOST_OPSRET_REPEAT); }
203 if ((calib_cs[_i].start && calib_cs[_i].stop))
206 calib_cs[_i].buffer = 0;
207 calib_cs[_i].counter = 0;
208 calib_cs[_i].start =
false;
209 calib_cs[_i].stop =
false;
213 if (calib_cs[_i].counter++ < CS_CALIB_STEPS)
215 calib_cs[_i].start =
true;
216 calib_cs[_i].stop =
false;
217 calib_cs[_i].buffer += boostInstance->
data.
i_sns[_i];
222 calib_cs[_i].buffer >>= 3;
223 calib_cs[_i].stop =
true;
230 _complete &= calib_cs[_i].stop;
235 retval = (uint16_t)BOOST_OPSRET_COMPLETE;
237 retval = (uint16_t)BOOST_OPSRET_REPEAT;
volatile bool adc_active
Bit #1: indicating that ADC has been started and samples are taken.
volatile uint16_t no_of_phases
number of converter phases
volatile uint16_t feedback_offset
Feedback offset value for calibration or bi-direction feedback signals.
volatile bool pwm_active
Bit #2: indicating that PWM has been started and ADC triggers are generated.
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 uint16_t i_sns[BOOST_MPHASE_COUNT]
BOOST output current.
volatile struct BOOST_CONVERTER_STATUS_s status
BOOST operation status bits.
volatile bool cs_calib_enable
Bit #8: Flag bit indicating that current sensors need to calibrated.
BOOST control & monitoring data structure.
volatile struct BOOST_CONVERTER_SETTINGS_s set_values
Control field for global access to references.