Closed
Description
This code is found in uint32_t analogRead(uint32_t pin)
:
uint32_t analogRead(uint32_t pin)
{
(...)
if (pin < A0) {
pin += A0;
}
(...)
The pin passed as an argument is deliberately changed if it doesn't fulfill a certain requirement.
This seems inappropriate:
- This forces a particular (and arbitrary) order in the pin map (and the user doesn't know it),
- Variables called
pin
always refer to an index ing_APinDescription
and never something else, - It's present in
analogRead
but not in inanalogWrite
- This induces issues, one example :
- I change PA10 to analog on my mkrzero board by changing
PIO_DIGITAL
toPIO_ANALOG
ing_APinDescription[2]
- when I call
analogRead(2)
it doesanalogRead(17)
- I change PA10 to analog on my mkrzero board by changing
Imo it's really worth removing these 3 lines.
Metadata
Metadata
Assignees
Labels
No labels