mirror of https://github.com/rusefi/rusefi.git
DAC with Lua #5601
This commit is contained in:
parent
c872239f51
commit
9a6406bd81
|
@ -40,15 +40,20 @@ static Dac dacs[] {
|
|||
};
|
||||
|
||||
void initDac() {
|
||||
dacs[0].Start(dacConfig);
|
||||
dacs[1].Start(dacConfig);
|
||||
bool dacIsUsed = false;
|
||||
for (size_t i = 0;i<DAC_OUTPUT_COUNT;i++) {
|
||||
Gpio pin = engineConfiguration->dacOutputPins[i];
|
||||
if (isBrainPinValid(pin)) {
|
||||
// setting up the output pin as analog as suggested by the Reference Manual.
|
||||
efiSetPadMode("dac", pin, PAL_MODE_INPUT_ANALOG);
|
||||
dacIsUsed = true;
|
||||
}
|
||||
}
|
||||
if (dacIsUsed) {
|
||||
// DAC peripheral changes associated pin behaviour regardless of actual pin mode
|
||||
dacs[0].Start(dacConfig);
|
||||
dacs[1].Start(dacConfig);
|
||||
}
|
||||
}
|
||||
|
||||
void setDacVoltage(int channel, float voltage) {
|
||||
|
|
Loading…
Reference in New Issue