2 years, 7 months ago.

Internal DAC analogout high-z

I am using the internal DACs from the stm32l432kc to create a waveform with analogout. When I am not creating a waveform, I need the analog out pin to output high-z. How can I do this?

Thanks

1 Answer

2 years, 7 months ago.

If you configure the pin as a digital input with no pull ups/downs then it should be high-z

Generally the mbed libraries configure the pin when you create the object and do nothing when you destroy it so you should be able to do something like this: (this is completely untested but I think is should work)

AnalogOut AOut(pin);

void disableAOut() {
  DigitalIn tmp(pin);
}

void enableAOut() {
  AnalogOut tmp(pin);
}

main () {
  Aout = 0.5;
  wait(5);
  disableAOut();
  wait(5);
  enableAOut();
  Aout = 0.7;
}