Class SpiDeviceImpl

    • Constructor Detail

      • SpiDeviceImpl

        public SpiDeviceImpl​(SpiChannel channel,
                             int speed,
                             SpiMode mode)
                      throws IOException
        Creates the SPI Device at the given spi and input channel
        Parameters:
        channel - spi channel to use
        speed - spi speed/rate (in Hertz) for channel to communicate at (range is 500kHz - 32MHz)
        mode - spi mode (see http://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus#Mode_numbers)
        Throws:
        IOException
      • SpiDeviceImpl

        public SpiDeviceImpl​(SpiChannel channel,
                             int speed)
                      throws IOException
        Creates the SPI Device at the given spi and input channel
        Parameters:
        channel - spi channel to use
        speed - spi speed/rate (in Hertz) for channel to communicate at (range is 500kHz - 32MHz)
        Throws:
        IOException
      • SpiDeviceImpl

        public SpiDeviceImpl​(SpiChannel channel,
                             SpiMode mode)
                      throws IOException
        Creates the SPI Device at the given SPI and input channel (A default speed of 1 MHz will be used)
        Parameters:
        channel - spi channel to use
        mode - spi mode (see http://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus#Mode_numbers)
        Throws:
        IOException
      • SpiDeviceImpl

        public SpiDeviceImpl​(SpiChannel channel)
                      throws IOException
        Creates the SPI Device at the given SPI and input channel (A default speed of 1 MHz will be used)
        Parameters:
        channel - spi channel to use
        Throws:
        IOException
    • Method Detail

      • write

        public String write​(String data,
                            String charset)
                     throws IOException
        Description copied from interface: SpiDevice
        Attempts to read/write data through this SPI device
        Specified by:
        write in interface SpiDevice
        Parameters:
        data - bytes (encoded in string) to write to the SPI device
        charset - character encoding for bytes in string
        Returns:
        resulting bytes read from the SPI device after the write operation
        Throws:
        IOException
      • write

        public String write​(String data,
                            Charset charset)
                     throws IOException
        Description copied from interface: SpiDevice
        Attempts to read/write data through this SPI device
        Specified by:
        write in interface SpiDevice
        Parameters:
        data - bytes (encoded in string) to write to the SPI device
        charset - character encoding for bytes in string
        Returns:
        resulting bytes read from the SPI device after the write operation
        Throws:
        IOException
      • write

        public ByteBuffer write​(ByteBuffer data)
                         throws IOException
        Description copied from interface: SpiDevice
        Attempts to read/write data through this SPI device
        Specified by:
        write in interface SpiDevice
        Parameters:
        data - bytes to write to the SPI device
        Returns:
        resulting bytes read from the SPI device after the write operation
        Throws:
        IOException
      • write

        public byte[] write​(InputStream input)
                     throws IOException
        Description copied from interface: SpiDevice
        Attempts to read/write data through this SPI device
        Specified by:
        write in interface SpiDevice
        Parameters:
        input - input stream to read from to get bytes to write to the SPI device
        Returns:
        resulting bytes read from the SPI device after the write operation
        Throws:
        IOException
      • write

        public int write​(InputStream input,
                         OutputStream output)
                  throws IOException
        Description copied from interface: SpiDevice
        Attempts to read/write data through this SPI device
        Specified by:
        write in interface SpiDevice
        Parameters:
        input - input stream to read from to get bytes to write to the SPI device
        output - output stream to write bytes read from the SPI device
        Returns:
        number of resulting bytes read from the SPI device and written to the output stream
        Throws:
        IOException
      • write

        public byte[] write​(byte... data)
                     throws IOException
        Description copied from interface: SpiDevice
        Attempts to read/write data through this SPI device
        Specified by:
        write in interface SpiDevice
        Parameters:
        data - bytes to write to the SPI device
        Returns:
        resulting bytes read from the SPI device after the write operation
        Throws:
        IOException
      • write

        public short[] write​(short... data)
                      throws IOException
        Description copied from interface: SpiDevice
        Attempts to read/write data through this SPI device
        Specified by:
        write in interface SpiDevice
        Parameters:
        data - bytes to write to the SPI device (Note: short value should not exceed 255.)
        Returns:
        resulting bytes read from the SPI device after the write operation
        Throws:
        IOException
      • write

        public byte[] write​(byte[] data,
                            int start,
                            int length)
                     throws IOException
        Description copied from interface: SpiDevice
        Attempts to read/write data through this SPI device
        Specified by:
        write in interface SpiDevice
        Parameters:
        data - bytes to write to the SPI device
        start - start index position in the data buffer to start writing from
        length - length of bytes to write from the data buffer
        Returns:
        resulting bytes read from the SPI device after the write operation
        Throws:
        IOException
      • write

        public short[] write​(short[] data,
                             int start,
                             int length)
                      throws IOException
        Description copied from interface: SpiDevice
        Attempts to read/write data through this SPI device
        Specified by:
        write in interface SpiDevice
        Parameters:
        data - bytes to write to the SPI device
        start - start index position in the data buffer to start writing from
        length - length of bytes to write from the data buffer
        Returns:
        resulting bytes read from the SPI device after the write operation
        Throws:
        IOException