http://mbed.org/users/davervw/code/SWSPI/#6a500a08c7fd