smalruby 0.0.10-x86-mingw32 → 0.0.11-x86-mingw32
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.
Potentially problematic release.
This version of smalruby might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -0
- data/lib/smalruby/hardware/pin.rb +10 -6
- data/lib/smalruby/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 97f67453d379aa35debc94a5001717b9a9d5462a
|
4
|
+
data.tar.gz: 8e61b50a286045a95f1d17990ff7a67d0140dab1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48b3df938441ce028b9ef79d59769e035d33b07bba8e7ab412192e038d97bc9e16f13de77f4f39b5a5cec4a419e68dce8fb6aa0f1f198f3c79ace11864fac967
|
7
|
+
data.tar.gz: 4947ebb00dc75b53992c386ac1007bd622dd81bcdf65f62cae0051d1d503520aa365bb62faa4cc263ace67e4bf479877c40c34b597134dffbee1a6bb2a8e4502
|
data/.rubocop.yml
CHANGED
@@ -6,6 +6,10 @@ module Smalruby
|
|
6
6
|
module Pin
|
7
7
|
module_function
|
8
8
|
|
9
|
+
DIO_DINO_RE = /\A([0-9]|1[0-3])\z/
|
10
|
+
DIO_SMALRUBY_RE = /\AD([0-9]|1[0-3])\z/
|
11
|
+
AI_RE = /\AA[0-5]\z/
|
12
|
+
|
9
13
|
# Smalrubyのピン番号をDinoのピン番号に変換する
|
10
14
|
#
|
11
15
|
# ピン番号が0~13、D0~D13、A0~A5でなければ例外が発生する
|
@@ -16,11 +20,11 @@ module Smalruby
|
|
16
20
|
def smalruby_to_dino(pin)
|
17
21
|
pin = pin.to_s
|
18
22
|
case pin
|
19
|
-
when
|
23
|
+
when DIO_DINO_RE
|
20
24
|
pin.to_i
|
21
|
-
when
|
25
|
+
when DIO_SMALRUBY_RE
|
22
26
|
pin[1..-1].to_i
|
23
|
-
when
|
27
|
+
when AI_RE
|
24
28
|
pin
|
25
29
|
else
|
26
30
|
fail "ハードウェアのピンの番号が間違っています: #{pin}"
|
@@ -36,11 +40,11 @@ module Smalruby
|
|
36
40
|
def dino_to_smalruby(pin)
|
37
41
|
pin = pin.to_s
|
38
42
|
case pin
|
39
|
-
when
|
43
|
+
when DIO_DINO_RE
|
40
44
|
"D#{pin}"
|
41
|
-
when
|
45
|
+
when DIO_SMALRUBY_RE
|
42
46
|
pin
|
43
|
-
when
|
47
|
+
when AI_RE
|
44
48
|
pin
|
45
49
|
else
|
46
50
|
fail "ハードウェアのピンの番号が間違っています: #{pin}"
|
data/lib/smalruby/version.rb
CHANGED