smalruby 0.0.32-x86-mingw32 → 0.1.0-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of smalruby might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/lib/smalruby/hardware/button.rb +5 -25
- data/lib/smalruby/hardware/led.rb +2 -2
- data/lib/smalruby/hardware/motor_driver.rb +5 -5
- data/lib/smalruby/hardware/null_hardware.rb +0 -0
- data/lib/smalruby/hardware/pin.rb +11 -11
- data/lib/smalruby/hardware/rgb_led_anode.rb +9 -9
- data/lib/smalruby/hardware/rgb_led_cathode.rb +6 -6
- data/lib/smalruby/hardware/sensor.rb +4 -37
- data/lib/smalruby/hardware/servo.rb +2 -2
- data/lib/smalruby/hardware/two_wheel_drive_car.rb +11 -21
- data/lib/smalruby/hardware.rb +3 -12
- data/lib/smalruby/version.rb +1 -1
- data/samples/check_hardware_motor_driver.rb +145 -0
- data/smalruby.gemspec +1 -1
- metadata +39 -39
- data/lib/smalruby/hardware/dino/fix_gets.rb +0 -78
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3bdbbd5b69c734772bc38fe43b03e93c3f5ef9ff
|
4
|
+
data.tar.gz: 144736a1788627f04fde909e67f97562a1a76f89
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 744f9edee798445e6f036eb19da4e961599640c2fc840c38162b2450b79e7ab14d576f0837295f20119369f6a121a82e35cd6d99a088a1e055f7a6ab43c5f29a
|
7
|
+
data.tar.gz: 311f521c3a1cf9607a8014e525c763bff43c770d391661d117f48408bb36d368030f6c3f09b47635d983eca54962dd935252e38c16fd1c23fbc01982f8600423
|
@@ -4,44 +4,24 @@ require 'smalruby/hardware'
|
|
4
4
|
module Smalruby
|
5
5
|
module Hardware
|
6
6
|
# ボタンを表現するクラス
|
7
|
-
class Button <
|
7
|
+
class Button < Smalrubot::Components::BaseComponent
|
8
8
|
def initialize(options)
|
9
9
|
@using_pullup = true
|
10
|
-
super(board: world.board, pin: Pin.
|
10
|
+
super(board: world.board, pin: Pin.smalruby_to_smalrubot(options[:pin]),
|
11
11
|
pullup: true)
|
12
12
|
end
|
13
13
|
|
14
|
-
# プルアップ抵抗を使わない
|
15
|
-
def not_use_pullup
|
16
|
-
@using_pullup = false
|
17
|
-
board.set_pullup(pin, false)
|
18
|
-
end
|
19
|
-
|
20
|
-
def stop
|
21
|
-
@board.remove_digital_hardware(self)
|
22
|
-
end
|
23
|
-
|
24
14
|
def up?
|
25
|
-
|
15
|
+
digital_read(pin) == Smalrubot::Board::LOW
|
26
16
|
end
|
27
17
|
|
28
|
-
alias_method :
|
18
|
+
alias_method :off?, :up?
|
29
19
|
|
30
20
|
def down?
|
31
21
|
!up?
|
32
22
|
end
|
33
23
|
|
34
|
-
alias_method :
|
35
|
-
|
36
|
-
private
|
37
|
-
|
38
|
-
def after_initialize(options = {})
|
39
|
-
super(options)
|
40
|
-
|
41
|
-
s_pin = Pin.dino_to_smalruby(pin)
|
42
|
-
down { world.button_changed(s_pin, (@using_pullup ? :up : :down)) }
|
43
|
-
up { world.button_changed(s_pin, (@using_pullup ? :down : :up)) }
|
44
|
-
end
|
24
|
+
alias_method :on?, :down?
|
45
25
|
end
|
46
26
|
end
|
47
27
|
end
|
@@ -4,9 +4,9 @@ require 'smalruby/hardware'
|
|
4
4
|
module Smalruby
|
5
5
|
module Hardware
|
6
6
|
# LEDを表現するクラス
|
7
|
-
class Led <
|
7
|
+
class Led < Smalrubot::Components::Led
|
8
8
|
def initialize(options)
|
9
|
-
super(board: world.board, pin: Pin.
|
9
|
+
super(board: world.board, pin: Pin.smalruby_to_smalrubot(options[:pin]))
|
10
10
|
end
|
11
11
|
|
12
12
|
# @!method on
|
@@ -12,12 +12,12 @@ module Smalruby
|
|
12
12
|
# 動作確認済みのモータードライバの一覧
|
13
13
|
# * TOSHIBA
|
14
14
|
# * TA7291P
|
15
|
-
class MotorDriver <
|
15
|
+
class MotorDriver < Smalrubot::Components::BaseComponent
|
16
16
|
# モーターの回転速度の割合(0~100%)
|
17
17
|
attr_reader :speed
|
18
18
|
|
19
19
|
def initialize(options)
|
20
|
-
pin = Pin.
|
20
|
+
pin = Pin.smalruby_to_smalrubot(options[:pin])
|
21
21
|
case pin
|
22
22
|
when 3, 5, 6, 9, 10, 11
|
23
23
|
super(board: world.board, pin: (pin...(pin + 3)).to_a)
|
@@ -64,11 +64,11 @@ module Smalruby
|
|
64
64
|
levels.each.with_index do |level, i|
|
65
65
|
case level
|
66
66
|
when 0
|
67
|
-
digital_write(pins[i],
|
67
|
+
digital_write(pins[i], Smalrubot::Board::LOW)
|
68
68
|
when 100
|
69
|
-
digital_write(pins[i],
|
69
|
+
digital_write(pins[i], Smalrubot::Board::HIGH)
|
70
70
|
else
|
71
|
-
analog_write(pins[i], (
|
71
|
+
analog_write(pins[i], (Smalrubot::Board::HIGH * level / 100.0).round)
|
72
72
|
end
|
73
73
|
end
|
74
74
|
end
|
File without changes
|
@@ -1,26 +1,26 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
|
-
require '
|
2
|
+
require 'smalrubot'
|
3
3
|
|
4
4
|
module Smalruby
|
5
5
|
module Hardware
|
6
6
|
module Pin
|
7
7
|
module_function
|
8
8
|
|
9
|
-
|
9
|
+
DIO_SMALRUBOT_RE = /\A([0-9]|1[0-3])\z/
|
10
10
|
DIO_SMALRUBY_RE = /\AD([0-9]|1[0-3])\z/
|
11
11
|
AI_RE = /\AA[0-5]\z/
|
12
12
|
|
13
|
-
# Smalrubyのピン番号を
|
13
|
+
# Smalrubyのピン番号をSmalrubotのピン番号に変換する
|
14
14
|
#
|
15
15
|
# ピン番号が0~13、D0~D13、A0~A5でなければ例外が発生する
|
16
16
|
#
|
17
17
|
# @param [String|Numeric] pin Smalrubyのピン番号
|
18
|
-
# @return [Numeric]
|
19
|
-
# @return [String]
|
20
|
-
def
|
18
|
+
# @return [Numeric] Smalrubotのデジタル入出力のピン番号
|
19
|
+
# @return [String] Smalrubotのアナログ入力のピン番号
|
20
|
+
def smalruby_to_smalrubot(pin)
|
21
21
|
pin = pin.to_s
|
22
22
|
case pin
|
23
|
-
when
|
23
|
+
when DIO_SMALRUBOT_RE
|
24
24
|
pin.to_i
|
25
25
|
when DIO_SMALRUBY_RE
|
26
26
|
pin[1..-1].to_i
|
@@ -31,16 +31,16 @@ module Smalruby
|
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
|
-
#
|
34
|
+
# Smalrubotのピン番号をSmalrubyのピン番号に変換する
|
35
35
|
#
|
36
36
|
# ピン番号が0~13、D0~D13、A0~A5でなければ例外が発生する
|
37
37
|
#
|
38
|
-
# @param [String|Numeric] pin
|
38
|
+
# @param [String|Numeric] pin Smalrubotのピン番号
|
39
39
|
# @return [String] Smalrubyのピン番号
|
40
|
-
def
|
40
|
+
def smalrubot_to_smalruby(pin)
|
41
41
|
pin = pin.to_s
|
42
42
|
case pin
|
43
|
-
when
|
43
|
+
when DIO_SMALRUBOT_RE
|
44
44
|
"D#{pin}"
|
45
45
|
when DIO_SMALRUBY_RE
|
46
46
|
pin
|
@@ -4,9 +4,9 @@ require 'smalruby/hardware'
|
|
4
4
|
module Smalruby
|
5
5
|
module Hardware
|
6
6
|
# RGB LED(アノード)を表現するクラス
|
7
|
-
class RgbLedAnode <
|
7
|
+
class RgbLedAnode < Smalrubot::Components::BaseComponent
|
8
8
|
def initialize(options)
|
9
|
-
pin = Pin.
|
9
|
+
pin = Pin.smalruby_to_smalrubot(options[:pin])
|
10
10
|
case pin
|
11
11
|
when 3..6
|
12
12
|
super(board: world.board, pin: [3, 5, 6, 4])
|
@@ -28,12 +28,12 @@ module Smalruby
|
|
28
28
|
analog_write(pins[0], calc_value(color[0]))
|
29
29
|
analog_write(pins[1], calc_value(color[1]))
|
30
30
|
analog_write(pins[2], calc_value(color[2]))
|
31
|
-
digital_write(pins[3],
|
31
|
+
digital_write(pins[3], Smalrubot::Board::HIGH)
|
32
32
|
end
|
33
33
|
|
34
34
|
# RGB LEDをオフにする
|
35
35
|
def off
|
36
|
-
digital_write(pins[3],
|
36
|
+
digital_write(pins[3], Smalrubot::Board::LOW)
|
37
37
|
end
|
38
38
|
|
39
39
|
def stop
|
@@ -48,11 +48,11 @@ module Smalruby
|
|
48
48
|
end
|
49
49
|
|
50
50
|
def calc_value(value)
|
51
|
-
v =
|
52
|
-
if v <
|
53
|
-
|
54
|
-
elsif v >
|
55
|
-
|
51
|
+
v = Smalrubot::Board::HIGH - value
|
52
|
+
if v < Smalrubot::Board::LOW
|
53
|
+
Smalrubot::Board::LOW
|
54
|
+
elsif v > Smalrubot::Board::HIGH
|
55
|
+
Smalrubot::Board::HIGH
|
56
56
|
else
|
57
57
|
v
|
58
58
|
end
|
@@ -4,9 +4,9 @@ require 'smalruby/hardware'
|
|
4
4
|
module Smalruby
|
5
5
|
module Hardware
|
6
6
|
# RGB LED(カソード)を表現するクラス
|
7
|
-
class RgbLedCathode <
|
7
|
+
class RgbLedCathode < Smalrubot::Components::BaseComponent
|
8
8
|
def initialize(options)
|
9
|
-
pin = Pin.
|
9
|
+
pin = Pin.smalruby_to_smalrubot(options[:pin])
|
10
10
|
case pin
|
11
11
|
when 3, 5, 6
|
12
12
|
super(board: world.board, pin: [3, 5, 6])
|
@@ -49,10 +49,10 @@ module Smalruby
|
|
49
49
|
end
|
50
50
|
|
51
51
|
def calc_value(value)
|
52
|
-
if value <
|
53
|
-
|
54
|
-
elsif value >
|
55
|
-
|
52
|
+
if value < Smalrubot::Board::LOW
|
53
|
+
Smalrubot::Board::LOW
|
54
|
+
elsif value > Smalrubot::Board::HIGH
|
55
|
+
Smalrubot::Board::HIGH
|
56
56
|
else
|
57
57
|
value
|
58
58
|
end
|
@@ -4,46 +4,13 @@ require 'smalruby/hardware'
|
|
4
4
|
module Smalruby
|
5
5
|
module Hardware
|
6
6
|
# 汎用的なセンサーを表現するクラス
|
7
|
-
class Sensor <
|
8
|
-
# デフォルトのセンサーの値に変化があったかどうかをチェックする閾値
|
9
|
-
DEFAULT_THRESHOLD = 32
|
10
|
-
|
11
|
-
attr_reader :value
|
12
|
-
attr_accessor :threshold
|
13
|
-
|
7
|
+
class Sensor < Smalrubot::Components::BaseComponent
|
14
8
|
def initialize(options)
|
15
|
-
super(board: world.board, pin: Pin.
|
16
|
-
end
|
17
|
-
|
18
|
-
def stop
|
19
|
-
@board.remove_analog_hardware(self)
|
20
|
-
end
|
21
|
-
|
22
|
-
private
|
23
|
-
|
24
|
-
def after_initialize(options = {})
|
25
|
-
super(options)
|
26
|
-
|
27
|
-
@value = 0
|
28
|
-
@threshold = options[:threshold] || DEFAULT_THRESHOLD
|
29
|
-
|
30
|
-
start_receiving_data
|
9
|
+
super(board: world.board, pin: Pin.smalruby_to_smalrubot(options[:pin]))
|
31
10
|
end
|
32
11
|
|
33
|
-
def
|
34
|
-
|
35
|
-
when_data_received { |data|
|
36
|
-
begin
|
37
|
-
@value = data = data.to_i
|
38
|
-
if (data - prev_data).abs >= @threshold ||
|
39
|
-
(prev_data != data && (data == 0 || data >= 1023))
|
40
|
-
world.sensor_changed(pin, data)
|
41
|
-
prev_data = data
|
42
|
-
end
|
43
|
-
rescue
|
44
|
-
Util.print_exception($ERROR_INFO)
|
45
|
-
end
|
46
|
-
}
|
12
|
+
def value
|
13
|
+
board.analog_read(pin)
|
47
14
|
end
|
48
15
|
end
|
49
16
|
end
|
@@ -4,9 +4,9 @@ require 'smalruby/hardware'
|
|
4
4
|
module Smalruby
|
5
5
|
module Hardware
|
6
6
|
# サーボモーターを表現するクラス
|
7
|
-
class Servo <
|
7
|
+
class Servo < Smalrubot::Components::Servo
|
8
8
|
def initialize(options)
|
9
|
-
super(board: world.board, pin: Pin.
|
9
|
+
super(board: world.board, pin: Pin.smalruby_to_smalrubot(options[:pin]))
|
10
10
|
end
|
11
11
|
|
12
12
|
# @!method position=(angle)
|
@@ -4,7 +4,7 @@ require 'smalruby/hardware'
|
|
4
4
|
module Smalruby
|
5
5
|
module Hardware
|
6
6
|
# 2WD車のモーターを表現するクラス
|
7
|
-
class TwoWheelDriveCar <
|
7
|
+
class TwoWheelDriveCar < Smalrubot::Components::BaseComponent
|
8
8
|
# 左のモーターの速度%
|
9
9
|
attr_reader :left_speed
|
10
10
|
|
@@ -15,7 +15,7 @@ module Smalruby
|
|
15
15
|
@left_speed = 100
|
16
16
|
@right_speed = 100
|
17
17
|
|
18
|
-
pin = Pin.
|
18
|
+
pin = Pin.smalruby_to_smalrubot(options[:pin])
|
19
19
|
case pin
|
20
20
|
when 5
|
21
21
|
super(board: world.board, pin: [5, 6, 9, 10])
|
@@ -87,25 +87,15 @@ module Smalruby
|
|
87
87
|
end
|
88
88
|
|
89
89
|
def digital_write_pins(*speeds)
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
analog_write(pins[i], level)
|
100
|
-
end
|
101
|
-
end
|
102
|
-
else
|
103
|
-
2.times do
|
104
|
-
speeds.each.with_index do
|
105
|
-
|speed, i|
|
106
|
-
digital_write(pins[i], (Dino::Board::HIGH * speed / 100.0).floor)
|
107
|
-
sleep(0.05) if i.odd?
|
108
|
-
end
|
90
|
+
speeds.each.with_index do |speed, i|
|
91
|
+
level = (Smalrubot::Board::HIGH * speed / 100.0).floor
|
92
|
+
case level
|
93
|
+
when 0
|
94
|
+
digital_write(pins[i], Smalrubot::Board::LOW)
|
95
|
+
when 100
|
96
|
+
digital_write(pins[i], Smalrubot::Board::HIGH)
|
97
|
+
else
|
98
|
+
analog_write(pins[i], level)
|
109
99
|
end
|
110
100
|
end
|
111
101
|
end
|
data/lib/smalruby/hardware.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
|
-
require 'dino'
|
3
2
|
require 'mutex_m'
|
4
|
-
|
3
|
+
require 'smalrubot'
|
5
4
|
|
6
5
|
module Smalruby
|
7
6
|
# ハードウェアの名前空間
|
@@ -34,20 +33,12 @@ module Smalruby
|
|
34
33
|
defaults = {
|
35
34
|
device: nil,
|
36
35
|
baud: 115_200,
|
37
|
-
heart_rate: 40 # HACK: 実機で調整した値
|
38
36
|
}
|
39
37
|
opt = Util.process_options(options, defaults)
|
40
38
|
|
41
|
-
|
42
|
-
txrx = Dino::TxRx.new(opt)
|
43
|
-
elsif Dino::VERSION >= '0.10'
|
44
|
-
txrx = Dino::TxRx.new
|
45
|
-
txrx.io = opt[:device] if opt[:device]
|
46
|
-
end
|
39
|
+
txrx = Smalrubot::TxRx.new(opt)
|
47
40
|
begin
|
48
|
-
world.board =
|
49
|
-
world.board.heart_rate = opt[:heart_rate]
|
50
|
-
|
41
|
+
world.board = Smalrubot::Board.new(txrx)
|
51
42
|
@initialized_hardware = true
|
52
43
|
rescue Exception
|
53
44
|
Util.print_exception($!)
|
data/lib/smalruby/version.rb
CHANGED
@@ -0,0 +1,145 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
DESCRIPTION = <<EOS
|
4
|
+
モータードライバ(TA7291P)を操作します
|
5
|
+
EOS
|
6
|
+
|
7
|
+
# デジタルの6~11番ピンをそれぞれ左右のモーター用のモータードライバ
|
8
|
+
# (TA7291P)の4・5・6に接続してください。
|
9
|
+
|
10
|
+
require 'smalruby'
|
11
|
+
|
12
|
+
init_hardware
|
13
|
+
|
14
|
+
stage1 = Stage.new(color: 'white')
|
15
|
+
|
16
|
+
stage1.on(:start) do
|
17
|
+
fill(color: 'white')
|
18
|
+
draw_font(string: DESCRIPTION, color: 'black')
|
19
|
+
|
20
|
+
motor_driver('D6').speed = 100
|
21
|
+
motor_driver('D9').speed = 100
|
22
|
+
|
23
|
+
loop do
|
24
|
+
if Input.key_down?(K_UP)
|
25
|
+
fill(color: 'white')
|
26
|
+
draw_font(string: '進む', color: 'black')
|
27
|
+
|
28
|
+
motor_driver('D6').forward
|
29
|
+
motor_driver('D9').forward
|
30
|
+
|
31
|
+
await until !Input.key_down?(K_UP)
|
32
|
+
|
33
|
+
fill(color: 'white')
|
34
|
+
|
35
|
+
motor_driver('D6').stop
|
36
|
+
motor_driver('D9').stop
|
37
|
+
sleep(0.2)
|
38
|
+
end
|
39
|
+
|
40
|
+
if Input.key_down?(K_DOWN)
|
41
|
+
fill(color: 'white')
|
42
|
+
draw_font(string: 'バックする', color: 'black')
|
43
|
+
|
44
|
+
motor_driver('D6').backward
|
45
|
+
motor_driver('D9').backward
|
46
|
+
|
47
|
+
await until !Input.key_down?(K_DOWN)
|
48
|
+
|
49
|
+
fill(color: 'white')
|
50
|
+
|
51
|
+
motor_driver('D6').stop
|
52
|
+
motor_driver('D9').stop
|
53
|
+
sleep(0.2)
|
54
|
+
end
|
55
|
+
|
56
|
+
if Input.key_down?(K_LEFT)
|
57
|
+
fill(color: 'white')
|
58
|
+
draw_font(string: '左に旋回する', color: 'black')
|
59
|
+
|
60
|
+
motor_driver('D6').backward
|
61
|
+
motor_driver('D9').forward
|
62
|
+
|
63
|
+
await until !Input.key_down?(K_LEFT)
|
64
|
+
|
65
|
+
fill(color: 'white')
|
66
|
+
|
67
|
+
motor_driver('D6').stop
|
68
|
+
motor_driver('D9').stop
|
69
|
+
sleep(0.2)
|
70
|
+
end
|
71
|
+
|
72
|
+
if Input.key_down?(K_RIGHT)
|
73
|
+
fill(color: 'white')
|
74
|
+
draw_font(string: '右に旋回する', color: 'black')
|
75
|
+
|
76
|
+
motor_driver('D6').forward
|
77
|
+
motor_driver('D9').backward
|
78
|
+
|
79
|
+
await until !Input.key_down?(K_RIGHT)
|
80
|
+
|
81
|
+
fill(color: 'white')
|
82
|
+
|
83
|
+
motor_driver('D6').stop
|
84
|
+
motor_driver('D9').stop
|
85
|
+
sleep(0.2)
|
86
|
+
end
|
87
|
+
|
88
|
+
if Input.key_down?(K_W)
|
89
|
+
motor_driver('D6').speed += 10
|
90
|
+
|
91
|
+
fill(color: 'white')
|
92
|
+
draw_font(string: "左の速度: #{motor_driver('D6').speed}%", color: 'black')
|
93
|
+
end
|
94
|
+
|
95
|
+
if Input.key_down?(K_S)
|
96
|
+
motor_driver('D6').speed -= 10
|
97
|
+
|
98
|
+
fill(color: 'white')
|
99
|
+
draw_font(string: "左の速度: #{motor_driver('D6').speed}%", color: 'black')
|
100
|
+
end
|
101
|
+
|
102
|
+
if Input.key_down?(K_O)
|
103
|
+
motor_driver('D9').speed += 10
|
104
|
+
|
105
|
+
fill(color: 'white')
|
106
|
+
draw_font(string: "右の速度: #{motor_driver('D9').speed}%", color: 'black')
|
107
|
+
end
|
108
|
+
|
109
|
+
if Input.key_down?(K_L)
|
110
|
+
motor_driver('D9').speed -= 10
|
111
|
+
|
112
|
+
fill(color: 'white')
|
113
|
+
draw_font(string: "右の速度: #{motor_driver('D9').speed}%", color: 'black')
|
114
|
+
end
|
115
|
+
|
116
|
+
if Input.key_down?(K_SPACE)
|
117
|
+
fill(color: 'white')
|
118
|
+
draw_font(string: '右のLED赤色を光らせる', color: 'black')
|
119
|
+
|
120
|
+
led('D13').on
|
121
|
+
|
122
|
+
await until !Input.key_down?(K_SPACE)
|
123
|
+
|
124
|
+
led('D13').off
|
125
|
+
|
126
|
+
fill(color: 'white')
|
127
|
+
draw_font(string: '左のLED緑色を光らせる', color: 'black')
|
128
|
+
|
129
|
+
led('D2').on
|
130
|
+
|
131
|
+
sleep(1)
|
132
|
+
|
133
|
+
led('D2').off
|
134
|
+
end
|
135
|
+
|
136
|
+
if Input.key_down?(K_B)
|
137
|
+
until !Input.key_down?(K_B)
|
138
|
+
fill(color: 'white')
|
139
|
+
draw_font(string: "センサーの情報#{sensor('A0').value}", color: 'black')
|
140
|
+
await
|
141
|
+
end
|
142
|
+
fill(color: 'white')
|
143
|
+
end
|
144
|
+
end
|
145
|
+
end
|
data/smalruby.gemspec
CHANGED
metadata
CHANGED
@@ -1,181 +1,181 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smalruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: x86-mingw32
|
6
6
|
authors:
|
7
7
|
- Kouji Takao
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.3'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.3'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - '>='
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: yard
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - '>='
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: redcarpet
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rspec
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - '>='
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - '>='
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: coveralls
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - '>='
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - '>='
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: travis-lint
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - '>='
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - '>='
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: rubocop
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- -
|
115
|
+
- - ~>
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '0.16'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- -
|
122
|
+
- - ~>
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0.16'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: guard-rspec
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- -
|
129
|
+
- - '>='
|
130
130
|
- !ruby/object:Gem::Version
|
131
131
|
version: '0'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- -
|
136
|
+
- - '>='
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: guard-rubocop
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
|
-
- -
|
143
|
+
- - '>='
|
144
144
|
- !ruby/object:Gem::Version
|
145
145
|
version: '0'
|
146
146
|
type: :development
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
|
-
- -
|
150
|
+
- - '>='
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '0'
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: mime-types
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
156
156
|
requirements:
|
157
|
-
- -
|
157
|
+
- - ~>
|
158
158
|
- !ruby/object:Gem::Version
|
159
159
|
version: '1.6'
|
160
160
|
type: :runtime
|
161
161
|
prerelease: false
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
|
-
- -
|
164
|
+
- - ~>
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: '1.6'
|
167
167
|
- !ruby/object:Gem::Dependency
|
168
168
|
name: activesupport
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
170
170
|
requirements:
|
171
|
-
- -
|
171
|
+
- - '>='
|
172
172
|
- !ruby/object:Gem::Version
|
173
173
|
version: '0'
|
174
174
|
type: :runtime
|
175
175
|
prerelease: false
|
176
176
|
version_requirements: !ruby/object:Gem::Requirement
|
177
177
|
requirements:
|
178
|
-
- -
|
178
|
+
- - '>='
|
179
179
|
- !ruby/object:Gem::Version
|
180
180
|
version: '0'
|
181
181
|
- !ruby/object:Gem::Dependency
|
@@ -193,19 +193,19 @@ dependencies:
|
|
193
193
|
- !ruby/object:Gem::Version
|
194
194
|
version: 1.4.0
|
195
195
|
- !ruby/object:Gem::Dependency
|
196
|
-
name:
|
196
|
+
name: smalrubot
|
197
197
|
requirement: !ruby/object:Gem::Requirement
|
198
198
|
requirements:
|
199
|
-
- -
|
199
|
+
- - ~>
|
200
200
|
- !ruby/object:Gem::Version
|
201
|
-
version: 0.
|
201
|
+
version: 0.0.1
|
202
202
|
type: :runtime
|
203
203
|
prerelease: false
|
204
204
|
version_requirements: !ruby/object:Gem::Requirement
|
205
205
|
requirements:
|
206
|
-
- -
|
206
|
+
- - ~>
|
207
207
|
- !ruby/object:Gem::Version
|
208
|
-
version: 0.
|
208
|
+
version: 0.0.1
|
209
209
|
description: smalruby is a 2D game development library. This is part of "Smalruby"
|
210
210
|
project that is a learning ruby programming environment for kids.
|
211
211
|
email:
|
@@ -214,10 +214,10 @@ executables: []
|
|
214
214
|
extensions: []
|
215
215
|
extra_rdoc_files: []
|
216
216
|
files:
|
217
|
-
-
|
218
|
-
-
|
219
|
-
-
|
220
|
-
-
|
217
|
+
- .gitignore
|
218
|
+
- .rspec
|
219
|
+
- .rubocop.yml
|
220
|
+
- .travis.yml
|
221
221
|
- Gemfile
|
222
222
|
- LEGAL
|
223
223
|
- LICENSE
|
@@ -257,7 +257,6 @@ files:
|
|
257
257
|
- lib/smalruby/event_handler.rb
|
258
258
|
- lib/smalruby/hardware.rb
|
259
259
|
- lib/smalruby/hardware/button.rb
|
260
|
-
- lib/smalruby/hardware/dino/fix_gets.rb
|
261
260
|
- lib/smalruby/hardware/led.rb
|
262
261
|
- lib/smalruby/hardware/motor_driver.rb
|
263
262
|
- lib/smalruby/hardware/null_hardware.rb
|
@@ -276,6 +275,7 @@ files:
|
|
276
275
|
- samples/canvas_color.rb
|
277
276
|
- samples/car.rb
|
278
277
|
- samples/cat.rb
|
278
|
+
- samples/check_hardware_motor_driver.rb
|
279
279
|
- samples/console.rb
|
280
280
|
- samples/costume.rb
|
281
281
|
- samples/costumes.rb
|
@@ -310,17 +310,17 @@ require_paths:
|
|
310
310
|
- lib
|
311
311
|
required_ruby_version: !ruby/object:Gem::Requirement
|
312
312
|
requirements:
|
313
|
-
- -
|
313
|
+
- - '>='
|
314
314
|
- !ruby/object:Gem::Version
|
315
315
|
version: '0'
|
316
316
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
317
317
|
requirements:
|
318
|
-
- -
|
318
|
+
- - '>='
|
319
319
|
- !ruby/object:Gem::Version
|
320
320
|
version: '0'
|
321
321
|
requirements: []
|
322
322
|
rubyforge_project:
|
323
|
-
rubygems_version: 2.
|
323
|
+
rubygems_version: 2.0.14
|
324
324
|
signing_key:
|
325
325
|
specification_version: 4
|
326
326
|
summary: 2D game development library for kids.
|
@@ -1,78 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
|
-
# rubocop:disable all
|
4
|
-
|
5
|
-
# WindowsでのDinoの不具合を修正するモンキーパッチ
|
6
|
-
if Util.windows?
|
7
|
-
require 'dino'
|
8
|
-
|
9
|
-
if Dino::VERSION >= '0.11'
|
10
|
-
require 'mutex_m'
|
11
|
-
|
12
|
-
class Dino::TxRx::Base
|
13
|
-
def write(message)
|
14
|
-
loop do
|
15
|
-
if IO.select(nil, [io], nil)
|
16
|
-
io.synchronize { io.syswrite(message) }
|
17
|
-
break
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
def gets(timeout = 0.005)
|
23
|
-
@buffer ||= ""
|
24
|
-
if !@buffer.include?("\n")
|
25
|
-
return nil unless IO.select([io], nil, nil, timeout)
|
26
|
-
io.synchronize do
|
27
|
-
io.read_timeout = (timeout * 1000).to_i
|
28
|
-
end
|
29
|
-
bytes = []
|
30
|
-
until (x = io.synchronize { io.getbyte }).nil?
|
31
|
-
bytes.push(x)
|
32
|
-
end
|
33
|
-
return nil if bytes.empty?
|
34
|
-
@buffer += bytes.pack("C*")
|
35
|
-
end
|
36
|
-
@buffer.slice!(/\A[^\n]*\n/)
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
class Dino::TxRx::Serial
|
41
|
-
def io
|
42
|
-
unless @io
|
43
|
-
@io = connect
|
44
|
-
@io.extend(Mutex_m)
|
45
|
-
end
|
46
|
-
@io
|
47
|
-
end
|
48
|
-
end
|
49
|
-
elsif Dino::VERSION >= '0.10'
|
50
|
-
class Dino::TxRx::USBSerial
|
51
|
-
def read
|
52
|
-
@thread ||= Thread.new do
|
53
|
-
loop do
|
54
|
-
line = gets
|
55
|
-
if line
|
56
|
-
pin, message = *line.chomp.split(/::/)
|
57
|
-
pin && message && changed && notify_observers(pin, message)
|
58
|
-
end
|
59
|
-
sleep 0.004
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
def gets(timeout = 0.005)
|
65
|
-
return nil unless IO.select([io], nil, nil, timeout)
|
66
|
-
io.read_timeout = (timeout * 1000).to_i
|
67
|
-
bytes = []
|
68
|
-
until (x = io.getbyte).nil?
|
69
|
-
bytes.push(x)
|
70
|
-
end
|
71
|
-
return nil if bytes.empty?
|
72
|
-
bytes.pack("C*")
|
73
|
-
end
|
74
|
-
end
|
75
|
-
else
|
76
|
-
fail "Dinoのバージョン#{version}はサポートしていません"
|
77
|
-
end
|
78
|
-
end
|