arduino/Arduino — pull request #2376 by xxxajk (2014-10-18 21:24:48+00:00)
Title: Ide 1.5.x AVR and sam (ARM) SPI atomicity fixes

These are the fixes for interacting with SPI methods without accidentally stepping on them from some other place, such as a scheduler, or other non-pin interrupt source. It also prevents updates to the variables from being interrupted by a pin interrupt, which can corrupt the mask/stored mask. and other states.

AVR is 100% tested, and solid.
sam is untested because I lack the hardware to do so.