def xfer(tx_data, readbytes=0, speed=nil, delay=nil, bpw=nil)
      SPI::xfer(@spi, tx_data, readbytes, speed, delay, bpw)
    end
def xfer(tx_data, readbytes=0, speed=nil, delay=nil, bpw=nil)
      SPI::xfer(@spi, tx_data, readbytes, speed, delay, bpw)
    end
Initialize an SPI device.  Returns an SPIDevice object

 @param spi should be a symbol representing the SPI device
 @param mode optional, default 0, specifies the SPI mode :SPI_MODE_0 through 3
 @param speed optional, specifies the SPI communication speed
 @param bpw optional, specifies the bits per word

 @example
   spi = SPIDevice.new(:SPI0, SPI_MODE_0)
 Transfer data to and from the SPI device

 @return String data read from SPI device

 @param tx_data data to transmit
 @param readbytes bytes to read, otherwise it sizeof tx_data is used
 @param speed optional, speed to xfer at
 @param delay optional delay
 @param bpw optional bits per word

 @example
   # communicate with MCP3008
   # byte 1: start bit
   # byte 2: single(1)/diff(0),3 bites for channel, null pad
   # byte 3: don't care
   spi = SPIDevice.new(:SPI0)
   raw = spi.xfer([ 0b00000001, 0b10000000, 0].pack("C*"))
   data = raw.unpack("C*")
   val = ((data[1] & 0b00000011) << 8 ) | data[2]