lignite 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,24 @@
1
+ require_relative "spec_helper"
2
+ require "lignite"
3
+
4
+ require "fileutils"
5
+
6
+ describe Lignite::Assembler do
7
+ shared_examples "compiles" do |base|
8
+ let(:datadir) { File.expand_path("../data", __FILE__) }
9
+
10
+ let(:in_rb) { "#{datadir}/#{base}.rb" }
11
+ let(:actual_rbf) { "#{datadir}/#{base}.out.rbf" }
12
+ let(:expected_rbf) { "#{datadir}/#{base}.rbf" }
13
+
14
+ it "correctly assembles #{base}" do
15
+ subject.assemble(in_rb, actual_rbf)
16
+ expect(FileUtils.compare_file(expected_rbf, actual_rbf)).to be_truthy
17
+ FileUtils.rm actual_rbf
18
+ end
19
+ end
20
+
21
+ include_examples "compiles", "HelloWorld"
22
+ include_examples "compiles", "HelloWorld-subop"
23
+ include_examples "compiles", "VernierReadout"
24
+ end
@@ -0,0 +1,6 @@
1
+ vmthread :MAIN do
2
+ ui_draw(FILLWINDOW, 0x00, 0, 0)
3
+ ui_draw(TEXT, FG_COLOR, 10, 50, 'Hello, world!')
4
+ ui_draw(UPDATE)
5
+ ui_button(WAIT_FOR_PRESS)
6
+ end
Binary file
@@ -0,0 +1,7 @@
1
+ vmthread MAIN
2
+ {
3
+ UI_DRAW(FILLWINDOW, 0x00, 0, 0)
4
+ UI_DRAW(TEXT, FG_COLOR, 10, 50, 'Hello, world!')
5
+ UI_DRAW(UPDATE)
6
+ UI_BUTTON(WAIT_FOR_PRESS)
7
+ }
@@ -0,0 +1,6 @@
1
+ vmthread :MAIN do
2
+ ui_draw_fillwindow(0x00, 0, 0)
3
+ ui_draw_text(1, 10, 50, 'Hello, world!')
4
+ ui_draw_update
5
+ ui_button_wait_for_press
6
+ end
Binary file
@@ -0,0 +1,31 @@
1
+ define PORT 1
2
+
3
+ vmthread MAIN
4
+ {
5
+ DATA32 Timer
6
+ DATA32 Data1
7
+ DATAS String 8
8
+
9
+ Loop:
10
+
11
+ UI_DRAW(FILLWINDOW,0x00,0,0)
12
+ UI_DRAW(SELECT_FONT,SMALL_FONT)
13
+ UI_DRAW(TEXT,FG_COLOR,0,10,'Vernier Readout V0.00')
14
+
15
+ UI_DRAW(TEXT,FG_COLOR,0,50,'Raw 1')
16
+ UI_DRAW(SELECT_FONT,NORMAL_FONT)
17
+
18
+ INPUT_DEVICE(READY_RAW,0,PORT,1,0,1,Data1)
19
+
20
+ AND32(Data1,0xFFFF,Data1)
21
+ STRINGS(NUMBER_FORMATTED,Data1,'%-5d',8,String)
22
+ UI_DRAW(TEXT,FG_COLOR,64,50,String)
23
+
24
+ UI_DRAW(UPDATE)
25
+
26
+ TIMER_WAIT(250,Timer)
27
+ TIMER_READY(Timer)
28
+
29
+ JR(Loop)
30
+ }
31
+
@@ -0,0 +1,27 @@
1
+ PORT = 1
2
+
3
+ vmthread :MAIN do
4
+ data32 :Timer
5
+ data32 :Data1
6
+ datas :String, 8
7
+
8
+ self.loop do
9
+ ui_draw(FILLWINDOW, 0x00, 0, 0)
10
+ ui_draw(SELECT_FONT, SMALL_FONT)
11
+ ui_draw(TEXT, FG_COLOR, 0, 10, 'Vernier Readout V0.00')
12
+
13
+ ui_draw(TEXT, FG_COLOR, 0, 50, 'Raw 1')
14
+ ui_draw(SELECT_FONT, NORMAL_FONT)
15
+
16
+ input_device(READY_RAW, 0, PORT, 1, 0, 1, :Data1)
17
+
18
+ and32(:Data1, 0xFFFF, :Data1)
19
+ strings(NUMBER_FORMATTED, :Data1, '%-5d', 8, :String)
20
+ ui_draw(TEXT, FG_COLOR, 64, 50, :String)
21
+
22
+ ui_draw(UPDATE)
23
+
24
+ timer_wait(250, :Timer)
25
+ timer_ready(:Timer)
26
+ end
27
+ end
Binary file
@@ -0,0 +1,26 @@
1
+
2
+ RSpec.configure do |config|
3
+ config.mock_with :rspec do |mocks|
4
+ # If you misremember a method name both in code and in tests,
5
+ # this will save you.
6
+ # https://relishapp.com/rspec/rspec-mocks/v/3-0/docs/verifying-doubles/partial-doubles
7
+ mocks.verify_partial_doubles = true
8
+ end
9
+ end
10
+
11
+ if ENV["COVERAGE"]
12
+ require "simplecov"
13
+ lib = File.expand_path("../../lib", __FILE__)
14
+ # track all ruby files under src
15
+ SimpleCov.track_files("#{lib}/**/*.rb")
16
+
17
+ # use coveralls for on-line code coverage reporting at Travis CI
18
+ if ENV["TRAVIS"]
19
+ require "coveralls"
20
+ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new [
21
+ SimpleCov::Formatter::HTMLFormatter,
22
+ Coveralls::SimpleCov::Formatter
23
+ ]
24
+ end
25
+ SimpleCov.start
26
+ end
metadata ADDED
@@ -0,0 +1,158 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: lignite
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Martin Vidner
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-02-18 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: libusb
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.6'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.6'
27
+ - !ruby/object:Gem::Dependency
28
+ name: coveralls
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: simplecov
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3'
69
+ - !ruby/object:Gem::Dependency
70
+ name: yard
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: |
84
+ Lignite is a set of Ruby tools to interact with LEGO Mindstorms EV3.
85
+ It uses the original LMS2012 firmware, so ev3dev is not required.
86
+ email: martin@vidner.net
87
+ executables:
88
+ - ev3tool
89
+ extensions: []
90
+ extra_rdoc_files: []
91
+ files:
92
+ - ".gitignore"
93
+ - COPYING
94
+ - Gemfile
95
+ - README.md
96
+ - Rakefile
97
+ - VERSION
98
+ - bin/ev3tool
99
+ - data/ev3.yml
100
+ - data/lignite-btaddr
101
+ - data/sysops.yml
102
+ - examples/hello.rb
103
+ - examples/lights.rb
104
+ - examples/motors.rb
105
+ - examples/sound.rb
106
+ - examples/sys_list_files.rb
107
+ - lib/lignite.rb
108
+ - lib/lignite/assembler.rb
109
+ - lib/lignite/body_compiler.rb
110
+ - lib/lignite/bytes.rb
111
+ - lib/lignite/connection.rb
112
+ - lib/lignite/connection/bluetooth.rb
113
+ - lib/lignite/connection/usb.rb
114
+ - lib/lignite/direct_commands.rb
115
+ - lib/lignite/logger.rb
116
+ - lib/lignite/message.rb
117
+ - lib/lignite/message_sender.rb
118
+ - lib/lignite/op_compiler.rb
119
+ - lib/lignite/rbf_object.rb
120
+ - lib/lignite/system_commands.rb
121
+ - lib/lignite/variables.rb
122
+ - lib/lignite/version.rb
123
+ - lignite.gemspec
124
+ - spec/assembler_spec.rb
125
+ - spec/data/HelloWorld-subop.rb
126
+ - spec/data/HelloWorld-subop.rbf
127
+ - spec/data/HelloWorld.lms
128
+ - spec/data/HelloWorld.rb
129
+ - spec/data/HelloWorld.rbf
130
+ - spec/data/VernierReadout.lms
131
+ - spec/data/VernierReadout.rb
132
+ - spec/data/VernierReadout.rbf
133
+ - spec/spec_helper.rb
134
+ homepage: https://github.com/mvidner/lignite
135
+ licenses:
136
+ - GPL-3.0-only
137
+ metadata: {}
138
+ post_install_message:
139
+ rdoc_options: []
140
+ require_paths:
141
+ - lib
142
+ required_ruby_version: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - ">="
145
+ - !ruby/object:Gem::Version
146
+ version: '2.1'
147
+ required_rubygems_version: !ruby/object:Gem::Requirement
148
+ requirements:
149
+ - - ">="
150
+ - !ruby/object:Gem::Version
151
+ version: '0'
152
+ requirements: []
153
+ rubyforge_project:
154
+ rubygems_version: 2.2.5
155
+ signing_key:
156
+ specification_version: 4
157
+ summary: Program LEGO Mindstorms EV3 in Ruby
158
+ test_files: []