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

Functions

void initDac ()
 
void setDacVoltage (int channel, float voltage)
 

Variables

static DACConfig dacConfig
 
static Dac dacs []
 

Function Documentation

◆ initDac()

void initDac ( )

Definition at line 42 of file dac.cpp.

42 {
43 bool dacIsUsed = false;
44 for (size_t i = 0;i<DAC_OUTPUT_COUNT;i++) {
46 if (isBrainPinValid(pin)) {
47 // setting up the output pin as analog as suggested by the Reference Manual.
48 efiSetPadMode("dac", pin, PAL_MODE_INPUT_ANALOG);
49 dacIsUsed = true;
50 }
51 }
52 if (dacIsUsed) {
53 // DAC peripheral changes associated pin behaviour regardless of actual pin mode
56 }
57}
void efiSetPadMode(const char *msg, brain_pin_e brainPin, iomode_t mode)
void Start(DACConfig &config)
Definition dac.cpp:18
static DACConfig dacConfig
Definition dac.cpp:7
static Dac dacs[]
Definition dac.cpp:35
static constexpr engine_configuration_s * engineConfiguration
bool isBrainPinValid(brain_pin_e brainPin)
brain_pin_e pin
Definition stm32_adc.cpp:15

Referenced by initHardware().

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

◆ setDacVoltage()

void setDacVoltage ( int  channel,
float  voltage 
)

Definition at line 59 of file dac.cpp.

59 {
60 dacs[channel].SetVoltage(0, voltage);
61}
uint16_t channel
Definition adc_inputs.h:104
void SetVoltage(int channel, float volage)
Definition dac.cpp:23

Referenced by configureRusefiLuaHooks().

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

Variable Documentation

◆ dacConfig

DACConfig dacConfig
static
Initial value:
= {
.init = 4095U,
.datamode = DAC_DHRM_12BIT_RIGHT,
.cr = 0
}

Definition at line 7 of file dac.cpp.

7 {
8 .init = 4095U, /* full VCC */
9 .datamode = DAC_DHRM_12BIT_RIGHT,
10 .cr = 0
11};

Referenced by initDac().

◆ dacs

Dac dacs[]
static
Initial value:
{
Dac(DACD1),
Dac(DACD2)
}
Definition dac.h:12

Definition at line 35 of file dac.cpp.

35 {
36 /** ChibiOS magic: if not dual mode DAC1 CH1 driver identifier.*/
37 Dac(DACD1),
38 /** ChibiOS magic: if not dual mode DAC1 CH2 driver identifier.*/
39 Dac(DACD2)
40};

Referenced by initDac(), and setDacVoltage().

Go to the source code of this file.