rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
Functions | Variables
dc_motors.cpp File Reference

Detailed Description

Date
March 3, 2020
Author
Matthew Kennedy (c) 2020

Definition in file dc_motors.cpp.

Functions

DcHardwaregetPrimaryDCHardwareForLogging ()
 
DcMotorinitDcMotor (const char *disPinMsg, const dc_io &io, size_t index, bool useTwoWires)
 
DcMotorinitDcMotor (brain_pin_e coil_p, brain_pin_e coil_m, size_t index)
 
void setDcMotorFrequency (size_t index, int hz)
 
void setDcMotorDuty (size_t index, float duty)
 
void showDcMotorInfo (int i)
 

Variables

static DcHardware dcHardware [ETB_COUNT+DC_PER_STEPPER]
 

Function Documentation

◆ getPrimaryDCHardwareForLogging()

DcHardware * getPrimaryDCHardwareForLogging ( )

Definition at line 86 of file dc_motors.cpp.

86 {
87 return &dcHardware[0];
88}
static DcHardware dcHardware[ETB_COUNT+DC_PER_STEPPER]
Definition dc_motors.cpp:84

Referenced by updateTunerStudioState().

Here is the caller graph for this function:

◆ initDcMotor() [1/2]

DcMotor * initDcMotor ( brain_pin_e  coil_p,
brain_pin_e  coil_m,
size_t  index 
)

Definition at line 109 of file dc_motors.cpp.

109 {
110 auto& hw = dcHardware[index];
111
112 hw.start(
113 true, /* useTwoWires */
114 Gpio::Unassigned, /* pinEnable */
115 coil_p,
116 coil_m,
117 nullptr,
118 Gpio::Unassigned, /* pinDisable */
121 engineConfiguration->etbFreq /* same in case of stepper? */
122 );
123
124 return &hw.dcMotor;
125}
void start(bool useTwoWires, brain_pin_e pinEnable, brain_pin_e pinDir1, brain_pin_e pinDir2, const char *disPinMsg, brain_pin_e pinDisable, bool isInverted, Scheduler *executor, int frequency)
Definition dc_motors.cpp:12
SingleTimerExecutor scheduler
Definition engine.h:271
@ Unassigned
static EngineAccessor engine
Definition engine.h:413
static constexpr engine_configuration_s * engineConfiguration
Here is the call graph for this function:

◆ initDcMotor() [2/2]

DcMotor * initDcMotor ( const char disPinMsg,
const dc_io io,
size_t  index,
bool  useTwoWires 
)

Definition at line 90 of file dc_motors.cpp.

90 {
91 auto& hw = dcHardware[index];
92
93 hw.start(
94 useTwoWires,
95 io.controlPin,
98 disPinMsg,
99 io.disablePin,
100 // todo You would not believe how you invert TLE9201 #4579
104 );
105
106 return &hw.dcMotor;
107}

Referenced by applyIACposition(), and doInitElectronicThrottle().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setDcMotorDuty()

void setDcMotorDuty ( size_t  index,
float  duty 
)

Definition at line 131 of file dc_motors.cpp.

131 {
132 dcHardware[index].dcMotor.set(duty);
133}
TwoPinDcMotor dcMotor
Definition dc_motors.h:63
virtual bool set(float duty) override
Definition dc_motor.cpp:55
static float duty
Here is the call graph for this function:

◆ setDcMotorFrequency()

void setDcMotorFrequency ( size_t  index,
int  hz 
)

Definition at line 127 of file dc_motors.cpp.

127 {
128 dcHardware[index].setFrequency(hz);
129}
void setFrequency(int frequency)
Definition dc_motors.h:65
Here is the call graph for this function:

◆ showDcMotorInfo()

void showDcMotorInfo ( int  i)

Definition at line 135 of file dc_motors.cpp.

135 {
136 DcHardware *dc = &dcHardware[i];
137
138 efiPrintf(" motor: dir=%d DC=%f", dc->dcMotor.isOpenDirection(), dc->dcMotor.get());
139 const char *disableMsg = dc->msg();
140 if (disableMsg != nullptr) {
141 efiPrintf("disabled [%s]", disableMsg);
142 }
143}
const char * msg()
Definition dc_motors.h:70
float get() const override
Get the current motor duty cycle.
Definition dc_motor.cpp:48
bool isOpenDirection() const override
Definition dc_motor.cpp:44

Referenced by initElectronicThrottle().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ dcHardware

DcHardware dcHardware[ETB_COUNT+DC_PER_STEPPER]
static

Go to the source code of this file.