rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes
Dac Class Reference

#include <dac.h>

Collaboration diagram for Dac:
Collaboration graph
[legend]

Public Member Functions

 Dac (DACDriver &driver)
 
void Start (DACConfig &config)
 
void SetVoltage (int channel, float volage)
 
float GetLastVoltage (int channel)
 

Private Attributes

DACDriver *const m_driver
 
float m_voltageFloat [2]
 

Detailed Description

Definition at line 11 of file dac.h.

Constructor & Destructor Documentation

◆ Dac()

Dac::Dac ( DACDriver &  driver)

Definition at line 13 of file dac.cpp.

14 : m_driver(&driver)
15{
16}
DACDriver *const m_driver
Definition dac.h:21

Member Function Documentation

◆ GetLastVoltage()

float Dac::GetLastVoltage ( int  channel)

Definition at line 30 of file dac.cpp.

31{
32 return m_voltageFloat[channel];
33}
uint16_t channel
Definition adc_inputs.h:104
float m_voltageFloat[2]
Definition dac.h:22

◆ SetVoltage()

void Dac::SetVoltage ( int  channel,
float  volage 
)

Definition at line 23 of file dac.cpp.

23 {
24 voltage = clampF(0, voltage, engineConfiguration->adcVcc);
25 m_voltageFloat[channel] = voltage;
26
27 dacPutChannelX(m_driver, channel, voltage / engineConfiguration->adcVcc * ((1 << 12) - 1));
28}
static constexpr engine_configuration_s * engineConfiguration

Referenced by setDacVoltage().

Here is the caller graph for this function:

◆ Start()

void Dac::Start ( DACConfig &  config)

Definition at line 18 of file dac.cpp.

19{
20 dacStart(m_driver, &p_config);
21}

Referenced by initDac().

Here is the caller graph for this function:

Field Documentation

◆ m_driver

DACDriver* const Dac::m_driver
private

Definition at line 21 of file dac.h.

Referenced by SetVoltage(), and Start().

◆ m_voltageFloat

float Dac::m_voltageFloat[2]
private

Definition at line 22 of file dac.h.

Referenced by GetLastVoltage(), and SetVoltage().


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