alericardi / arduino

Automatically exported from code.google.com/p/arduino
0 stars 0 forks source link

Simplify analog input pins-to-channels (and make more portable) #727

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
The conversion from pins to channels currently has 3 #if/else clauses.  It can 
be made much simpler.  Also this would help support 1284P, and will be 
forward-compatible with other variants which come up in the future.

P/S Is the developer's list closed?  I tried to subscribe, but received no 
response.

Original issue reported on code.google.com by maniac...@ymail.com on 23 Nov 2011 at 5:35

Attachments:

GoogleCodeExporter commented 9 years ago
The problem is that not every variant necessarily supplies a value for A0.  So 
this should work for those that don't... but since A0 is given as a const int, 
not a #define, I couldn't use an #ifdef to test for it.  Alternative ideas 
welcome, or maybe you should just submit another issue w/ a patch just for the 
ATmega1284P.

Original comment by dmel...@gmail.com on 2 Dec 2011 at 10:29

GoogleCodeExporter commented 9 years ago
Ok, this can be closed.  See Issue 736 for a replacement.

Original comment by maniac...@ymail.com on 3 Dec 2011 at 5:27

GoogleCodeExporter commented 9 years ago
I'd still like to do something like this, because you're right that the current 
code isn't very portable.  Maybe we can add a digitalPinToAnalogInput() macro, 
which would be the opposite of the current analogInputToDigitalPin().  Since 
it's a macro, we can wrap it in an #ifdef that would keep it from breaking for 
variants which don't define it.

Original comment by dmel...@gmail.com on 4 Mar 2012 at 6:19

GoogleCodeExporter commented 9 years ago
Yup.  I'll submit something for you to take a look at.  I had to solve this for 
the mighty-1284p platform because everyone seems to want to do something 
different with the pin assignments.

Original comment by maniac...@ymail.com on 4 Mar 2012 at 11:03