mumblepins / arduino

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

SPI library examples whould use & explain pre-defined pin constants: MOSI, MISO, SCK, SS #750

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What change would like to see?

The SPI library examples should explain (and use) the pre-defined pin number 
constants MOSI, MISO, SCK, SS.  Well, at least SS should be used on 
DigitalPotControl, instead of hard-coding pin 10.

Why?

Documenting and encouraging use of these constants will promote a coding style 
that makes sketches and liraries compatible with boards other than Uno.

Many sketches exist which will not work on Mega, and probably will not work on 
Due, Leonardo and other future boards, as well as 3rd party boards with 
different pinouts.  Often authors will create their own #define statements for 
the SPI pins, because they are unaware that the core provides them 
automatically!

Would this cause any incompatibilities with previous versions?  If so, how
can these be mitigated?

No incompatibilities.  Long term, this change should greatly improve 
compatibility.

Original issue reported on code.google.com by paul.sto...@gmail.com on 14 Dec 2011 at 8:35

GoogleCodeExporter commented 9 years ago
Referring this one to Tom.

Original comment by dmel...@gmail.com on 14 Dec 2011 at 11:13