0.01
No commit activity in last 3 years
No release in over 3 years
libftdi library bindings to talk to FTDI chips
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.17.2
~> 0.7.5

Runtime

~> 1.0
 Project Readme

Description

Ruby bindings for libftdi - an open source library to talk to FTDI chips.

Prerequisites

You must install libftdi version 0.20 in addition to this gem.

Synopsys

require 'rubygems'
require 'ftdi'

ctx = Ftdi::Context.new

begin
  ctx.usb_open(0x0403, 0x6001)
  begin
    ctx.baudrate = 250000
    ctx.set_line_property(:bits_8, :stop_bit_2, :none)
    ctx.flowctrl = Ftdi::SIO_DISABLE_FLOW_CTRL

    arr = Array.new(513) { |i| i.zero? ? 0 : 1 }
    ctx.set_line_property2(:bits_8, :stop_bit_2, :none, :break_on)
    sleep 0.001
    ctx.set_line_property2(:bits_8, :stop_bit_2, :none, :break_off)
    sleep 0.001
    ctx.write_data(arr)

    sleep 1

    arr = [ 0 ] * 513
    ctx.set_line_property2(:bits_8, :stop_bit_2, :none, :break_on)
    sleep 0.001
    ctx.set_line_property2(:bits_8, :stop_bit_2, :none, :break_off)
    sleep 0.001
    ctx.write_data(arr)

    puts "Context is:"
    ctx.members.each { |k| puts "#{k} = #{ctx[k]}" }

  ensure
    ctx.usb_close
  end
rescue Ftdi::Error => e
  $stderr.puts e.to_s
end