Update Sd2Card.h to use pins_arduino.h or variant.h definitions, depending on architecture, when Hardware SPI is in use.
The definitions for Software SPI pins (for ATmega1280 and ATmega2560 etc) remain unchanged as defined in Sd2PinMap.h.
According to #3786 removed the reference to Leonardo only in while(!Serial) of the examples.
Changed in in "wait for serial port to connect. Needed for native USB port only"
The two File classes have been enclosed into different namespaces.
To guarantee compatibility with old sketches that uses only one of the two
libraries an additional line:
using namespace xxxxx;
has been added so the users can still use "File" where there is no ambiguity.
BridgeLib::File and SDLib::File classes have been also aliased to BridgeFile
and SDFile respectively, users are encouraged to use that instead of File.
The SDClass class makes a reference to "SD.card" instead of just "card". SD is a global instance of SDClass.
This prevents any other instance of SDClass from functioning correctly.
The fix also allows SDClass to be used with an SD card which is removed and replaced, whereas previously, using the global instance SD did not allow this due to the limitation of begin() which cannot be called more than once.
correct SS pin setup is already handled by SPI subsystem.
this should prevent future issues like #2868
current implementation assures that:
* pin10 is OUTPUT HIGH if SPI.begin() is called and the pin was unconfigured
* pin10 state is not modified if pinMode(10, OUTPUT) is called before SPI.begin()
* pin10 is INPUT HI-Z if nor pinMode(10, OUTPUT) nor SPI.begin() are called
All the while() loops that check for the SPI transfer to be complete have the
semi-colon immediately after the closing parenthesis. This both causes a
compiler warning of "warning: suggest a space before ';' or explicit braces
around empty body in 'while' statement", and is considered a less-than-ideal
programming practice. This patch breaks the semi-colon on to the next line,
both eliminating the compiler error and making the code more readable.
In all probability the test should be moved into a macro or a inlineable
sub-routine.