digiusb 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/digiusb.rb +1 -2
- data/lib/digiusb/digiblink.rb +3 -3
- metadata +1 -1
data/lib/digiusb.rb
CHANGED
@@ -18,7 +18,6 @@ require 'libusb'
|
|
18
18
|
class DigiUSB
|
19
19
|
ProductID = 0x05df # product id number from Digistump
|
20
20
|
VendorID = 0x16c0 # vendor id number for Digistump
|
21
|
-
Manufacturer = "digistump.com" # manufacturer string is static
|
22
21
|
Timeout = 1_000 # one second till device crashes due to lack of calling DigiUSB.refresh()
|
23
22
|
DefaultPollingFrequency = 15 # 15hz when waiting for data to be printed
|
24
23
|
|
@@ -39,7 +38,7 @@ class DigiUSB
|
|
39
38
|
def self.sparks product_name = false
|
40
39
|
usb = LIBUSB::Context.new
|
41
40
|
usb.devices.select { |device|
|
42
|
-
device.idProduct == ProductID && device.idVendor == VendorID &&
|
41
|
+
device.idProduct == ProductID && device.idVendor == VendorID && (product_name == false || product_name.to_s == device.product)
|
43
42
|
}.map { |handle|
|
44
43
|
self.new(handle)
|
45
44
|
}
|
data/lib/digiusb/digiblink.rb
CHANGED
@@ -3,8 +3,8 @@ require 'digiusb'
|
|
3
3
|
require 'colorist'
|
4
4
|
|
5
5
|
class DigiBlink < DigiUSB
|
6
|
-
def color=
|
7
|
-
color =
|
6
|
+
def color=(color)
|
7
|
+
color = color.to_color unless color.is_a? Colorist::Color
|
8
8
|
|
9
9
|
# send out each byte
|
10
10
|
self.putc 's' # start character
|
@@ -12,4 +12,4 @@ class DigiBlink < DigiUSB
|
|
12
12
|
self.putc color.g
|
13
13
|
self.putc color.b
|
14
14
|
end
|
15
|
-
end
|
15
|
+
end
|