SimpleFOClibrary 2.4.0
Loading...
Searching...
No Matches
LowsideCurrentSense Class Reference

#include <LowsideCurrentSense.h>

Inheritance diagram for LowsideCurrentSense:
[legend]
Collaboration diagram for LowsideCurrentSense:
[legend]

Public Member Functions

 LowsideCurrentSense (float shunt_resistor, float gain, int pinA, int pinB, int pinC=_NC)
 
 LowsideCurrentSense (float mVpA, int pinA, int pinB, int pinC=_NC)
 
int init () override
 
PhaseCurrent_s getPhaseCurrents () override
 
- Public Member Functions inherited from CurrentSense
void linkDriver (FOCDriver *driver)
 
virtual int driverAlign (float align_voltage, bool modulation_centered=false)
 
virtual float getDCCurrent (float angle_el=0)
 
DQCurrent_s getFOCCurrents (float angle_el)
 
ABCurrent_s getABCurrents (PhaseCurrent_s current)
 
DQCurrent_s getDQCurrents (ABCurrent_s current, float angle_el)
 
virtual void enable ()
 
virtual void disable ()
 
int alignBLDCDriver (float align_voltage, BLDCDriver *driver, bool modulation_centered)
 
int alignStepperDriver (float align_voltage, StepperDriver *driver, bool modulation_centered)
 
int alignHybridDriver (float align_voltage, BLDCDriver *driver, bool modulation_centered)
 
PhaseCurrent_s readAverageCurrents (int N=100)
 

Additional Inherited Members

- Public Attributes inherited from CurrentSense
bool skip_align = false
 variable signaling that the phase current direction should be verified during initFOC()
 
FOCDriverdriver = nullptr
 driver link
 
bool initialized = false
 
void * params = 0
 pointer to hardware specific parameters of current sensing
 
DriverType driver_type = DriverType::UnknownDriver
 driver type (BLDC or Stepper)
 
float gain_a
 phase A gain
 
float gain_b
 phase B gain
 
float gain_c
 phase C gain
 
float offset_ia
 zero current A voltage value (center of the adc reading)
 
float offset_ib
 zero current B voltage value (center of the adc reading)
 
float offset_ic
 zero current C voltage value (center of the adc reading)
 
int pinA
 pin A analog pin for current measurement
 
int pinB
 pin B analog pin for current measurement
 
int pinC
 pin C analog pin for current measurement
 

Detailed Description

Definition at line 16 of file LowsideCurrentSense.h.

Constructor & Destructor Documentation

◆ LowsideCurrentSense() [1/2]

LowsideCurrentSense::LowsideCurrentSense ( float  shunt_resistor,
float  gain,
int  pinA,
int  pinB,
int  pinC = _NC 
)

LowsideCurrentSense class constructor

Parameters
shunt_resistorshunt resistor value
gaincurrent-sense op-amp gain
phAA phase adc pin
phBB phase adc pin
phCC phase adc pin (optional)

Definition at line 9 of file LowsideCurrentSense.cpp.

◆ LowsideCurrentSense() [2/2]

LowsideCurrentSense::LowsideCurrentSense ( float  mVpA,
int  pinA,
int  pinB,
int  pinC = _NC 
)

LowsideCurrentSense class constructor

Parameters
mVpAmV per Amp ratio
phAA phase adc pin
phBB phase adc pin
phCC phase adc pin (optional)

Definition at line 24 of file LowsideCurrentSense.cpp.

Member Function Documentation

◆ getPhaseCurrents()

PhaseCurrent_s LowsideCurrentSense::getPhaseCurrents ( )
overridevirtual

Function rading the phase currents a, b and c This function will be used with the foc control throught the function CurrentSense::getFOCCurrents(electrical_angle)

  • it returns current c equal to 0 if only two phase measurements available
Returns
PhaseCurrent_s current values

Implements CurrentSense.

Definition at line 88 of file LowsideCurrentSense.cpp.

Here is the call graph for this function:

◆ init()

int LowsideCurrentSense::init ( )
overridevirtual

Function intialising the CurrentSense class

  • All the necessary intialisations of adc and sync should be implemented here
Returns
- 0 - for failure & 1 - for success

Implements CurrentSense.

Definition at line 38 of file LowsideCurrentSense.cpp.

Here is the call graph for this function:

The documentation for this class was generated from the following files: