lib/ftdi.rb
def write_data(bytes)
      bytes = bytes.pack('c*')  if bytes.respond_to?(:pack)
      size = bytes.respond_to?(:bytesize) ? bytes.bytesize : bytes.size
      mem_buf = FFI::MemoryPointer.new(:char, size)
      mem_buf.put_bytes(0, bytes)
      bytes_written = Ftdi.ftdi_write_data(ctx, mem_buf, size)
      check_result(bytes_written)
      bytes_written
    end
def write_data(bytes)
      bytes = bytes.pack('c*')  if bytes.respond_to?(:pack)
      size = bytes.respond_to?(:bytesize) ? bytes.bytesize : bytes.size
      mem_buf = FFI::MemoryPointer.new(:char, size)
      mem_buf.put_bytes(0, bytes)
      bytes_written = Ftdi.ftdi_write_data(ctx, mem_buf, size)
      check_result(bytes_written)
      bytes_written
    end
def write_data ( bytes ) bytes = bytes . pack ( 'c*' ) if bytes . respond_to? ( :pack ) size = bytes . respond_to? ( :bytesize ) ? bytes . bytesize : bytes . size mem_buf = FFI :: MemoryPointer . new ( :char , size ) mem_buf . put_bytes ( 0 , bytes ) bytes_written = Ftdi . ftdi_write_data ( ctx , mem_buf , size ) check_result ( bytes_written ) bytes_written end
Writes data.
 @param [String, Array] bytes String or array of integers that will be interpreted as bytes using pack('c*').
 @return [Fixnum] Number of written bytes.
 @raise [StatusCodeError] libftdi reports error.
Writes data .