arduino / arduino/ArduinoCore-samd
Disabling DAC when reading from ADC is a problem sometimes
- Dominant language
- C
- Stars
- 502
- Forks
- 740
- PR merge metrics
- No merged PRs in 30d
Description
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'.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in wiring_analog.c at analogRead() and trace where it disables the DAC after analogWrite() has enabled it on the same pin. Compare the existing behavior with the requested optional path, and consider the change complete when normal analogRead() behavior remains unchanged while ADC calibration can read without disabling the DAC.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- arduino, c
- Domain
- embedded-iot
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100