littlewire 0.9.8 → 0.9.9
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.
- checksums.yaml +4 -4
- data/bin/littlewire.rb +7 -6
- data/examples/i2c/nunchuck.rb +19 -16
- data/lib/littlewire/version.rb +1 -1
- metadata +15 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d9ca8fcff30feecd9fe4ebc8e8f45c739a5323e1
|
|
4
|
+
data.tar.gz: 778139b656900649e89474a1e09ca81b4fe583b7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e74dbb1edb11ddae5b29f0e98e36b9976fb9840ef7ad6ba296f97a7f26ba148fd014684bad80e6b403280d942ce7b56c24f9c80388f3f9571a252ffe5cf9b873
|
|
7
|
+
data.tar.gz: 2aae285f83ff40926bb389cb1c91eeb3fc20d65d94867d94565de6d67b7aa839f90105ac2ccff7c385018c7c5cb518d625f2c5de8405a5ac236a9ba8d29fc0fd
|
data/bin/littlewire.rb
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
|
-
__dir__ ||= File.dirname(__FILE__)
|
|
3
|
-
#$:.unshift File.join(__dir__, '..', 'lib')
|
|
4
2
|
require 'thor'
|
|
5
3
|
require 'pp'
|
|
6
4
|
require 'littlewire'
|
|
7
5
|
require 'littlewire/gadgets/micronucleus'
|
|
8
6
|
|
|
9
7
|
class LittleWireUtility < Thor
|
|
8
|
+
# for ruby 1.9 compatibility, we use this instead of ruby 2.0 __dir__
|
|
9
|
+
Directory = defined?(__dir__) ? __dir__ : File.pathname(__FILE__)
|
|
10
|
+
|
|
10
11
|
desc "install [version]", "Install a specific firmware on to the littlewire device"
|
|
11
12
|
def install version = 'latest'
|
|
12
|
-
path = File.join(
|
|
13
|
+
path = File.join(Directory, "..", "firmware", "#{version}.hex")
|
|
13
14
|
raise "Unknown Version" unless File.file? path
|
|
14
15
|
|
|
15
16
|
data = HexProgram.new(open path).binary
|
|
@@ -44,7 +45,7 @@ class LittleWireUtility < Thor
|
|
|
44
45
|
desc "firmwares", "List all versions which can be installed via install command"
|
|
45
46
|
def firmwares
|
|
46
47
|
puts "Available LittleWire Firmware:"
|
|
47
|
-
Dir[File.join(
|
|
48
|
+
Dir[File.join(Directory, "..", "firmware", "*.hex")].each do |filename|
|
|
48
49
|
puts File.basename(filename, '.hex')
|
|
49
50
|
end
|
|
50
51
|
end
|
|
@@ -56,7 +57,7 @@ class LittleWireUtility < Thor
|
|
|
56
57
|
wire = LittleWire.connect
|
|
57
58
|
puts "Device Firmware: #{wire.version}" if wire
|
|
58
59
|
|
|
59
|
-
latest_path = File.join(
|
|
60
|
+
latest_path = File.join(Directory, "..", "firmware", "#{LittleWire::SupportedVersions.first}.hex")
|
|
60
61
|
if LittleWire::SupportedVersions.index(wire.version) != 0 and File.exists? latest_path
|
|
61
62
|
puts "An updated firmware is available, version #{LittleWire::SupportedVersions.first}"
|
|
62
63
|
puts "To update, run:"
|
|
@@ -71,7 +72,7 @@ class LittleWireUtility < Thor
|
|
|
71
72
|
desc "racer", "Attach a Wii Nunchuck and play a game"
|
|
72
73
|
def racer
|
|
73
74
|
ruby_vm = File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name'])
|
|
74
|
-
system(ruby_vm, File.join(
|
|
75
|
+
system(ruby_vm, File.join(Directory, '..', 'examples', 'i2c', 'nunchuck.rb'))
|
|
75
76
|
end
|
|
76
77
|
end
|
|
77
78
|
|
data/examples/i2c/nunchuck.rb
CHANGED
|
@@ -5,17 +5,20 @@ require 'littlewire'
|
|
|
5
5
|
require 'littlewire/gadgets/nunchuck'
|
|
6
6
|
|
|
7
7
|
wire = LittleWire.connect
|
|
8
|
-
|
|
9
|
-
wire.digital_write :ds5, :low
|
|
8
|
+
raise "No LittleWire device connected" unless wire
|
|
10
9
|
|
|
11
10
|
car = 0.0
|
|
12
11
|
wall = 0.0
|
|
13
12
|
wall_width = 16
|
|
14
13
|
constraint = 20.0
|
|
15
14
|
|
|
15
|
+
# wait till C button is released...
|
|
16
|
+
sleep 0.1 while wire.nunchuck.sample.buttons.c
|
|
17
|
+
|
|
16
18
|
puts DATA.read
|
|
17
19
|
puts ''
|
|
18
20
|
puts "Point your nunchuck at the screen, and press C button to start your engines!"
|
|
21
|
+
# wait untill C button is pressed
|
|
19
22
|
sleep 0.1 until wire.nunchuck.sample.buttons.c
|
|
20
23
|
|
|
21
24
|
seconds = 0.0
|
|
@@ -60,21 +63,21 @@ loop do
|
|
|
60
63
|
end
|
|
61
64
|
|
|
62
65
|
__END__
|
|
63
|
-
______ __ __ ____ ____ ____
|
|
64
|
-
/_ __/ / / / / / __ \ / __ ) / __ \
|
|
65
|
-
/ / / / / / / /_/ / / __ | / / / /
|
|
66
|
-
/ / / /_/ / / _, _/ / /_/ / / /_/ /
|
|
67
|
-
/_/ \____/ /_/ |_| /_____/ \____/
|
|
68
|
-
____ ___ ______ ______ ____
|
|
69
|
-
/ __ \ / | / ____/ / ____/ / __ \
|
|
70
|
-
/ /_/ / / /| | / / / __/ / /_/ /
|
|
71
|
-
/ _, _/ / ___ | / /___ / /___ / _, _/
|
|
72
|
-
/_/ |_| /_/ |_| \____/ /_____/ /_/ |_|
|
|
66
|
+
______ __ __ ____ ____ ____
|
|
67
|
+
/_ __/ / / / / / __ \ / __ ) / __ \
|
|
68
|
+
/ / / / / / / /_/ / / __ | / / / /
|
|
69
|
+
/ / / /_/ / / _, _/ / /_/ / / /_/ /
|
|
70
|
+
/_/ \____/ /_/ |_| /_____/ \____/
|
|
71
|
+
____ ___ ______ ______ ____
|
|
72
|
+
/ __ \ / | / ____/ / ____/ / __ \
|
|
73
|
+
/ /_/ / / /| | / / / __/ / /_/ /
|
|
74
|
+
/ _, _/ / ___ | / /___ / /___ / _, _/
|
|
75
|
+
/_/ |_| /_/ |_| \____/ /_____/ /_/ |_|
|
|
73
76
|
______ _ __ ______ ____ ______ __ ___ ______
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
77
|
+
~~~~~~~~~/ ____/ ~| |/ /~/_ __/ ~/ __ \ ~~/ ____/ ~/ |/ / ~/ ____/
|
|
78
|
+
~~~~~~~~/ __/ ~~~~| / ~~/ / ~~~/ /_/ / ~/ __/ ~~~/ /|_/ / ~/ __/
|
|
79
|
+
~~~~~~~/ /___ ~~~/ | ~~/ / ~~~/ _, _/ ~/ /___ ~~/ / / / ~/ /___
|
|
80
|
+
~~~~~~/_____/ ~~/_/|_| ~/_/ ~~~/_/~|_| ~/_____/ ~/_/ /_/ ~/_____/
|
|
78
81
|
|
|
79
82
|
Motion Nunchuck Ninja Edition 2.1 - Insert Coin
|
|
80
83
|
Published by Mechanum Industries for PC-DOS, Amega, VIC 20, and iPhone 5c
|
data/lib/littlewire/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: littlewire
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.9.
|
|
4
|
+
version: 0.9.9
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Bluebie
|
|
@@ -38,6 +38,20 @@ dependencies:
|
|
|
38
38
|
- - '>='
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
40
|
version: 0.0.2
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: thor
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - '>='
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: 0.18.1
|
|
48
|
+
type: :runtime
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - '>='
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: 0.18.1
|
|
41
55
|
description: A little library for a little wire. Providing a pure ruby interface (via
|
|
42
56
|
the nonpure libusb gem) to littlewire.cc's wonderful gadget. littlewire.rb provides
|
|
43
57
|
general purpose digital IO, pulse width modulation analog outputs, analog inputs,
|