Skip to content

Remove the DAC requirement that A0 must be PA02 #353

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

Merged
merged 1 commit into from
Oct 23, 2018

Conversation

GabrielNotman
Copy link
Contributor

@GabrielNotman GabrielNotman commented Aug 31, 2018

Currently, in order to use the DAC output, each variant must define A0 so that it uses the physical pin PA02. This requirement creates some inflexibly when designing new boards.

This PR removes that requirement allowing for any pin (with PIN_ATTR_ANALOG) to be used for the DAC output, providing it is defined using the correct ADC channel AIN0. The pin must be described with ADC_Channel0, or optionally with DAC_Channel0.

Also the DAC_Channel0 definition does not actually seem to be used anywhere in the core except for the additional DAC entry in the pin description array (e.g. entry 43 for the zero or entry 47 for the mzero). Additionally, those pin entries currently cannot be used as the current analogWrite(pin, value) code will only configure the DAC output if the pin parameter is A0.

@GabrielNotman
Copy link
Contributor Author

An alternative would be to use the old comparison code but to test against DAC0 instead of A0. However, the standard variants mkrfox1200, mkrgsm1400, mkrwan1300, mkrwifi1010 & mkrzero do not define DAC0.

@GabrielNotman GabrielNotman changed the title Removes the DAC requirement that A0 must be PA02 Remove the DAC requirement that A0 must be PA02 Sep 4, 2018
@cmaglie cmaglie merged commit 253e40e into arduino:master Oct 23, 2018
@cmaglie cmaglie added this to the Release 1.6.20 milestone Oct 23, 2018
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

Successfully merging this pull request may close these issues.

2 participants