SSD1306 0.1.1 → 0.1.2
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/lib/SSD1306/display.rb +3 -6
- data/lib/SSD1306/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 312a13dc64d461f52cd889de231bef33f4ace668
|
4
|
+
data.tar.gz: 1dfd6225f5047ea6c954885b81d4a82aa86d4113
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f85b784d0eb6d0290a3b1e182b360c76dcc7e68beb97cf2a0d9f9d4e3e3f148147901d51c8426d43ff6f1616741cb9419910f7897a9a90b5947d93bb1955c1b
|
7
|
+
data.tar.gz: c1a063b908c21fd1e588bb5574bfa2451d46af38770287921418a68fe2aa0840d63befa4a135cc57a9eeb6d889dc271cc8af1ac431c7c5ab9b7e81d4e39fd9ab
|
data/lib/SSD1306/display.rb
CHANGED
@@ -37,7 +37,7 @@ SSD1306_VERTICAL_AND_RIGHT_HORIZONTAL_SCROLL = 0x29
|
|
37
37
|
SSD1306_VERTICAL_AND_LEFT_HORIZONTAL_SCROLL = 0x2A
|
38
38
|
|
39
39
|
class Display
|
40
|
-
attr_accessor :protocol, :path, :address, :width, :height
|
40
|
+
attr_accessor :protocol, :path, :address, :width, :height, :buffer
|
41
41
|
|
42
42
|
def initialize(opts = {})
|
43
43
|
default_options = {
|
@@ -49,14 +49,11 @@ SSD1306_VERTICAL_AND_LEFT_HORIZONTAL_SCROLL = 0x2A
|
|
49
49
|
}
|
50
50
|
options = default_options.merge(opts)
|
51
51
|
|
52
|
-
# Attributes for attr_accessor
|
53
52
|
@protocol = options[:protocol]
|
54
53
|
@path = options[:path]
|
55
54
|
@address = options[:address]
|
56
55
|
@width = options[:width]
|
57
56
|
@height = options[:height]
|
58
|
-
|
59
|
-
# Variables needed internally
|
60
57
|
@pages = @height / 8
|
61
58
|
@buffer = [0]*(@width*@pages)
|
62
59
|
if @protocol == :i2c
|
@@ -120,7 +117,7 @@ SSD1306_VERTICAL_AND_LEFT_HORIZONTAL_SCROLL = 0x2A
|
|
120
117
|
self.command(@pages - 1)
|
121
118
|
# Write buffer data
|
122
119
|
# TODO: This works for I2C only
|
123
|
-
for i in
|
120
|
+
for i in (0..@buffer.length).step(16)
|
124
121
|
control = 0x40
|
125
122
|
@interface.write control, @buffer[i:i+16]
|
126
123
|
end
|
@@ -137,7 +134,7 @@ SSD1306_VERTICAL_AND_LEFT_HORIZONTAL_SCROLL = 0x2A
|
|
137
134
|
|
138
135
|
def clear!
|
139
136
|
self.clear
|
140
|
-
self.display
|
137
|
+
self.display!
|
141
138
|
end
|
142
139
|
|
143
140
|
#TODO Implement Contrast functionality
|
data/lib/SSD1306/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: SSD1306
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Xavier Bick
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-04-
|
11
|
+
date: 2016-04-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|