libftdi-ruby 0.0.4 → 0.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +1 -1
- data/lib/ftdi.rb +28 -5
- data/lib/ftdi/version.rb +1 -1
- metadata +2 -2
data/README.md
CHANGED
data/lib/ftdi.rb
CHANGED
@@ -6,7 +6,7 @@ require "ftdi/version"
|
|
6
6
|
module Ftdi
|
7
7
|
extend FFI::Library
|
8
8
|
|
9
|
-
ffi_lib "libftdi"
|
9
|
+
ffi_lib ["libftdi", "libftdi.so.1"]
|
10
10
|
|
11
11
|
# FTDI chip type.
|
12
12
|
ChipType = enum(:type_am, :type_bm, :type_2232c, :type_r, :type_2232h, :type_4232h, :type_232h)
|
@@ -89,9 +89,6 @@ module Ftdi
|
|
89
89
|
# end
|
90
90
|
class Context < FFI::ManagedStruct
|
91
91
|
layout(
|
92
|
-
# USB specific
|
93
|
-
# libusb's context
|
94
|
-
:usb_ctx, :pointer,
|
95
92
|
# libusb's usb_dev_handle
|
96
93
|
:usb_dev, :pointer,
|
97
94
|
# usb read timeout
|
@@ -133,11 +130,17 @@ module Ftdi
|
|
133
130
|
:bitbang_mode, :uint8,
|
134
131
|
|
135
132
|
# Decoded eeprom structure
|
136
|
-
:eeprom, :
|
133
|
+
:eeprom, :int,
|
137
134
|
|
138
135
|
# String representation of last error
|
139
136
|
:error_str, :string,
|
140
137
|
|
138
|
+
# Buffer needed for async communication
|
139
|
+
:async_usb_buffer, :pointer,
|
140
|
+
|
141
|
+
# Number of URB-structures we can buffer
|
142
|
+
:async_usb_buffer_size, :uint,
|
143
|
+
|
141
144
|
# Defines behavior in case a kernel module is already attached to the device
|
142
145
|
:module_detach_mode, Ftdi::ModuleDetachMode
|
143
146
|
)
|
@@ -376,6 +379,24 @@ module Ftdi
|
|
376
379
|
new_interface
|
377
380
|
end
|
378
381
|
|
382
|
+
# Set the DTR control line value.
|
383
|
+
# @param [Fixnum] value Either 0 or 1
|
384
|
+
# @raise [StatusCodeError] libftdi reports error.
|
385
|
+
# @return [Fixnum] The value
|
386
|
+
def dtr=(value)
|
387
|
+
check_result(Ftdi.ftdi_setdtr(ctx, value))
|
388
|
+
value
|
389
|
+
end
|
390
|
+
|
391
|
+
# Set the RTS control line value.
|
392
|
+
# @param [Fixnum] value Either 0 or 1
|
393
|
+
# @raise [StatusCodeError] libftdi reports error.
|
394
|
+
# @return [Fixnum] The value
|
395
|
+
def rts=(value)
|
396
|
+
check_result(Ftdi.ftdi_setrts(ctx, value))
|
397
|
+
value
|
398
|
+
end
|
399
|
+
|
379
400
|
private
|
380
401
|
def ctx
|
381
402
|
self.to_ptr
|
@@ -409,5 +430,7 @@ module Ftdi
|
|
409
430
|
attach_function :ftdi_set_interface, [ :pointer, Interface ], :int
|
410
431
|
attach_function :ftdi_set_bitmode, [ :pointer, :int, :int ], :int
|
411
432
|
attach_function :ftdi_read_pins, [ :pointer, :pointer ], :int
|
433
|
+
attach_function :ftdi_setdtr, [ :pointer, :int ], :int
|
434
|
+
attach_function :ftdi_setrts, [ :pointer, :int ], :int
|
412
435
|
end
|
413
436
|
|
data/lib/ftdi/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: libftdi-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.20
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-06-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: ffi
|