DAC with Lua #5601

This commit is contained in:
rusefi 2023-10-12 09:41:31 -04:00
parent 16ec3c6454
commit 6a7700ccfb
1 changed files with 9 additions and 3 deletions

View File

@ -32,10 +32,16 @@ float Dac::GetLastVoltage(int channel)
return m_voltageFloat[channel];
}
static Dac dac(DACD1);
static Dac dacs[] {
/** ChibiOS magic: if not dual mode DAC1 CH1 driver identifier.*/
Dac(DACD1),
/** ChibiOS magic: if not dual mode DAC1 CH2 driver identifier.*/
Dac(DACD2)
};
void initDac() {
dac.Start(dacConfig);
dacs[0].Start(dacConfig);
dacs[1].Start(dacConfig);
for (size_t i = 0;i<DAC_OUTPUT_COUNT;i++) {
Gpio pin = engineConfiguration->dacOutputPins[i];
if (isBrainPinValid(pin)) {
@ -46,7 +52,7 @@ void initDac() {
}
void setDacVoltage(int channel, float voltage) {
dac.SetVoltage(channel, voltage);
dacs[channel].SetVoltage(0, voltage);
}
#endif // EFI_DAC