new_contents: from IO import *
  
  CS = D10
  MOSI = D11
  MISO = D12
  SCK = D13
  
  c_spi_write = '\xf9\x01\x32\x97\x11\x81\x00\x81\xf8\x01\x51\x91\x8f\x01\x55\x23\xb1\xf0\x45\x2f\xf8\x01\x35\x2f\x61\x91\x28\xe0\x76\x98\x00\xc0\x67\xfb\x16\xf4\xa5\x9a\x01\xc0\xa5\x98\x00\xc0\x76\x9a\x00\xc0\x66\x0f\x2a\x95\x99\xf7\x3a\x95\x79\xf7\x4a\x95\x59\xf7\x08\x95'
  c_spi_read = '\xf9\x01\x40\xe0\x35\x97\x11\x80\x00\x24\x00\x81\x00\x0e\x14\x81\x00\xe0\x23\x81\x02\x2b\x0e\xc0\x76\x98\x00\xc0\x66\x0f\x1c\x99\x61\x60\x76\x9a\x3a\x95\x33\x23\xb9\xf7\xf8\x01\xe4\x0f\xf5\x1f\x61\x83\x43\x95\x50\xe0\x40\x15\x51\x05\x18\xf4\x60\xe0\x38\xe0\xf2\xcf\xf8\x01\x00\x82\x08\x95'
  
  
  def spi_init():
      # Initialize IO
      setPinDir(CS, True)
      writePin(CS, True)
      setPinDir(MOSI, True)
      writePin(MOSI, True)
      setPinDir(MISO, False)
      setPinDir(SCK, True)
      writePin(SCK, False)
      
  def spi_write(data):
      call(c_spi_write, data)
      
  def spi_read(num_bytes):
      myStr = '0'*20[:]   # Allocate SPI buffer
      call(c_spi_read, num_bytes, myStr)
      return myStr
  
subject: Add Eric's bit-banged SPI methods.