-
-
Notifications
You must be signed in to change notification settings - Fork 738
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
pinalways refer to an index ing_APinDescriptionand never something else, - It's present in
analogReadbut not in inanalogWrite - This induces issues, one example :
- I change PA10 to analog on my mkrzero board by changing
PIO_DIGITALtoPIO_ANALOGing_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