mono_matrix 0.0.0
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 +7 -0
- data/lib/mono_matrix.rb +54 -0
- metadata +64 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 5f6eebc2ff296aa2a615fdec0b8d97bfd7d1107f
|
4
|
+
data.tar.gz: 0c7f57ccfe65cd46d5d1636db88fd120995fa2ed
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4db0fa23b91543c8e4f73288a0ebd2c487d4dce23351d41b622d1fcdddc7899e72aa1b33cc128624d53f1bbe1b23e1574a4bc43a5764ba2a8f8cd76fc997be28
|
7
|
+
data.tar.gz: 95679ba07cb72481b3775a52f32fb4c7f178b3e6f3263351a10aaa5e6f836faf615012a9dee95d12a966c8fb15189f39e593f5e128ca84fff928abda0b93d85f
|
data/lib/mono_matrix.rb
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
|
2
|
+
require 'serialport'
|
3
|
+
|
4
|
+
class MonoMatrix
|
5
|
+
|
6
|
+
def initialize(tty)
|
7
|
+
# Instance variables
|
8
|
+
@tty = tty
|
9
|
+
end
|
10
|
+
|
11
|
+
def switch(channel, input)
|
12
|
+
|
13
|
+
# A = 1 "\x00\xFF\xD5\x7B";
|
14
|
+
# A = 2 "\x01\xFE\xD5\x7B";
|
15
|
+
# A = 3 "\x02\xFD\xD5\x7B";
|
16
|
+
# A = 4 "\x03\xFC\xD5\x7B";
|
17
|
+
# B = 1 "\x04\xFB\xD5\x7B";
|
18
|
+
# B = 2 "\x05\xFA\xD5\x7B";
|
19
|
+
# B = 3 "\x06\xF9\xD5\x7B";
|
20
|
+
# B = 4 "\x07\xF8\xD5\x7B";
|
21
|
+
|
22
|
+
end_bytes = ["\xD5","\x7B"]
|
23
|
+
if channel == "A"
|
24
|
+
case input
|
25
|
+
when 1
|
26
|
+
bytes = ["\x00", "\xFF"] + end_bytes
|
27
|
+
when 2
|
28
|
+
bytes = ["\x01", "\xFE"] + end_bytes
|
29
|
+
when 3
|
30
|
+
bytes = ["\x02", "\xFD"] + end_bytes
|
31
|
+
when 4
|
32
|
+
bytes = ["\x03", "\xFC"] + end_bytes
|
33
|
+
end
|
34
|
+
|
35
|
+
elsif channel == "B"
|
36
|
+
case input
|
37
|
+
when 1
|
38
|
+
bytes = ["\x04", "\xFB"] + end_bytes
|
39
|
+
when 2
|
40
|
+
bytes = ["\x05", "\xFA"] + end_bytes
|
41
|
+
when 3
|
42
|
+
bytes = ["\x06", "\xF9"] + end_bytes
|
43
|
+
when 4
|
44
|
+
bytes = ["\x07", "\xF8"] + end_bytes
|
45
|
+
end
|
46
|
+
end
|
47
|
+
puts channel +" to "+ input.to_s
|
48
|
+
serialConnection = SerialPort.new @tty, 9600
|
49
|
+
bytes.each {|byte| serialConnection.write byte}
|
50
|
+
bytes.each {|byte| serialConnection.write byte}
|
51
|
+
serialConnection.close
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
metadata
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mono_matrix
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- defektive
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-11-26 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: serialport
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 1.3.1
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.3'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 1.3.1
|
33
|
+
description: A simple way to control your Monoprice 4x2 HDX***
|
34
|
+
email: sirbradleyd@gmail.com
|
35
|
+
executables: []
|
36
|
+
extensions: []
|
37
|
+
extra_rdoc_files: []
|
38
|
+
files:
|
39
|
+
- lib/mono_matrix.rb
|
40
|
+
homepage: http://rubygems.org/gems/mono_matrix
|
41
|
+
licenses:
|
42
|
+
- MIT
|
43
|
+
metadata: {}
|
44
|
+
post_install_message:
|
45
|
+
rdoc_options: []
|
46
|
+
require_paths:
|
47
|
+
- lib
|
48
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '0'
|
53
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '0'
|
58
|
+
requirements: []
|
59
|
+
rubyforge_project:
|
60
|
+
rubygems_version: 2.2.2
|
61
|
+
signing_key:
|
62
|
+
specification_version: 4
|
63
|
+
summary: Control monoprice 4x2 swithcer/splitter via serial
|
64
|
+
test_files: []
|