14 shunt_resistor = _shunt_resistor;
16 volts_to_amps_ratio = 1.0f /_shunt_resistor / _gain;
18 gain_a = volts_to_amps_ratio;
19 gain_b = volts_to_amps_ratio;
20 gain_c = volts_to_amps_ratio;
29 volts_to_amps_ratio = 1000.0f / _mVpA;
31 gain_a = volts_to_amps_ratio;
32 gain_b = volts_to_amps_ratio;
33 gain_c = volts_to_amps_ratio;
66void LowsideCurrentSense::calibrateOffsets(){
67 const int calibration_rounds = 2000;
74 for (
int i = 0; i < calibration_rounds; i++) {
#define SIMPLEFOC_DEBUG(msg,...)
float offset_ic
zero current C voltage value (center of the adc reading)
DriverType driver_type
driver type (BLDC or Stepper)
int pinC
pin C analog pin for current measurement
FOCDriver * driver
driver link
int pinB
pin B analog pin for current measurement
int pinA
pin A analog pin for current measurement
float offset_ib
zero current B voltage value (center of the adc reading)
void * params
pointer to hardware specific parameters of current sensing
float offset_ia
zero current A voltage value (center of the adc reading)
float voltage_limit
limiting voltage set to the motor
void * params
pointer to hardware specific parameters of driver
LowsideCurrentSense(float shunt_resistor, float gain, int pinA, int pinB, int pinC=_NC)
PhaseCurrent_s getPhaseCurrents() override
void * _driverSyncLowSide(void *driver_params, void *cs_params)
#define SIMPLEFOC_CURRENT_SENSE_INIT_FAILED
void * _configureADCLowSide(const void *driver_params, const int pinA, const int pinB, const int pinC=NOT_SET)
void _startADC3PinConversionLowSide()
float _readADCVoltageLowSide(const int pinA, const void *cs_params)
void _delay(unsigned long ms)