Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disabling DAC when reading from ADC is a problem sometimes #703

Open
tedtoal opened this issue Jul 22, 2023 · 0 comments
Open

Disabling DAC when reading from ADC is a problem sometimes #703

tedtoal opened this issue Jul 22, 2023 · 0 comments

Comments

@tedtoal
Copy link

tedtoal commented Jul 22, 2023

In wiring_analog.c, analogRead() disables the DAC if analogWrite() was previously used to enabled the DAC on the same pin.

In my situation, I am writing a value out the DAC and reading back in on the same pin using the ADC, as part of ADC calibration. Therefore, I don't want the DAC disabled.

A suggested fix is to add another function that is a copy of analogRead() with a new name (e.g. analogReadOptionalDisable()) with an additional argument 'bool disableDAC'. Use the argument to decide whether to disable the DAC or not. Change analogRead() to call this function with the argument 'true'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant