Permalink
Browse files

usb_reset API.

  • Loading branch information...
1 parent 4097023 commit 7cfb1173c3f3952ee438fdb18f7ef07595a54db1 @akzhan akzhan committed Apr 11, 2012
Showing with 8 additions and 0 deletions.
  1. +8 −0 lib/ftdi.rb
View
@@ -192,6 +192,13 @@ def usb_open_desc_index(vendor, product, description, serial, index)
check_result(Ftdi.ftdi_usb_open_desc_index(ctx, vendor, product, description, serial, index))
end
+ # Resets the ftdi device.
+ # @raise [StatusCodeError] libftdi reports error.
+ # @return [NilClass] nil
+ def usb_reset
+ check_result(Ftdi.ftdi_usb_reset(ctx))
+ end
+
# Closes the ftdi device.
# @return [NilClass] nil
def usb_close
@@ -289,6 +296,7 @@ def check_result(status_code)
attach_function :ftdi_usb_open, [ :pointer, :int, :int ], :int
attach_function :ftdi_usb_open_desc, [ :pointer, :int, :int, :string, :string ], :int
attach_function :ftdi_usb_open_desc_index, [ :pointer, :int, :int, :string, :string, :uint ], :int
+ attach_function :ftdi_usb_reset, [ :pointer ], :int
attach_function :ftdi_usb_close, [ :pointer ], :void
attach_function :ftdi_set_baudrate, [ :pointer, :int ], :int
attach_function :ftdi_set_line_property, [ :pointer, BitsType, StopbitsType, ParityType ], :int

0 comments on commit 7cfb117

Please sign in to comment.