papirus 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (6) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +54 -10
  3. data/README.rdoc +4 -4
  4. data/lib/chunky.rb +1 -2
  5. data/lib/papirus.rb +0 -2
  6. metadata +3 -17
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e058ef8f10445a56a69a14ae4d8044ac941548a3
4
- data.tar.gz: 756b5c818963af406a77fbcf4140d93f67d2d620
3
+ metadata.gz: 2ea7eafaea2155d636ec9e6b712ce6310679a57e
4
+ data.tar.gz: 967ca7fb5503b8079e098b98f43c76e77c6d8477
5
5
  SHA512:
6
- metadata.gz: 10d7c085d808892a893d3317d57490bdeed02ef2bffd5352300264ae5b37454725d89677c9c7f5b0568166926022ae049b3b2628989b56cd3cf27072711f23b2
7
- data.tar.gz: fb164c0c081400db678970787ba88d7da0444fcd3cbb9875116fc79ed6bacd1411770169fda1dbc7d780597d1fa64a467b566f610b3df0dbe399e67aa53889dd
6
+ metadata.gz: 3f99ad2bcf1bd57e4fb8504e411718654d65c456f996eb72a8540d795e6983ad437902ae869e866983880d6ae870a6b81b3c5e7ff10e251f7481adf4c90a0d4a
7
+ data.tar.gz: e97870beae1b628636cba2630a0b3f0a4b2a5b5f0b6596a42ec2804c9f90223980d605a475b969e7c448c4e04cc9e94153038be8ca9f5c1565d487e42e45d91c
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # papirus
2
2
 
3
- ruby gem to talk to the PAPiRus display
3
+ ruby gem to talk to the [PaPiRus](https://www.pi-supply.com/?s=papirus&post_type=product&tags=1&limit=5&ixwps=1) display
4
+
5
+ before you start playing make sure you got the edp-fuse setup
4
6
 
5
7
  ## epaper fuse driver installation instructions (if you have not done that already ::)
6
8
  ```bash
@@ -13,6 +15,9 @@ make rpi-install EPD_IO=epd_io.h PANEL_VERSION='V231_G2'
13
15
  systemctl enable epd-fuse.service
14
16
  systemctl start epd-fuse
15
17
  ```
18
+
19
+ You can find more detailed instructions [https://github.com/repaper/gratis](here)
20
+
16
21
  ## gem installation
17
22
 
18
23
  ```bash
@@ -25,13 +30,29 @@ require 'papirus'
25
30
 
26
31
  # first we get ourself a display
27
32
  display = PaPiRus::Display.new()
33
+ ```
28
34
 
29
- #lets get a clean clean png of the size of the display to play with using chunky_png
35
+ # Playing with RMagic
36
+
37
+ ```
38
+ require 'rmakgick'
39
+ img = Magick::Image::read('mischa.jpg')[0]
40
+ display.show(img.resize_to_fit(display.width, display.height).quantize(2, Magick::GRAYColorspace).to_blob()
41
+ ```
42
+
43
+ # Playing with Chunky_PNG
44
+ ```
45
+ require_relative "lib/chunky" # add's to_bit_stream function to chucky
46
+
47
+ #lets get a clean png of the size of the display to play with using chunky_png
30
48
  image = ChunkyPNG::Image.new(display.width, display.height, ChunkyPNG::Color::WHITE)
31
49
  #and we draw a circle on it which is about the size of the screen
32
50
  image.circle(display.width/2, display.height/2, display.height/2-2)
33
- # have a look at https://github.com/wvanbergen/chunky_png for more examples
51
+ ```
52
+
53
+ have a look at [chunky_png](https://github.com/wvanbergen/chunky_png/wiki) for more examples
34
54
 
55
+ ```
35
56
  #and last we dump the image as bitsteam to the display
36
57
  display.show(image.to_bit_stream)
37
58
 
@@ -47,15 +68,35 @@ display.clear
47
68
  image.circle(display.width/2, display.height/2, radius)
48
69
  display.show(image.to_bit_stream, 'F')
49
70
  end
71
+ ```
72
+
73
+ ## there are multiple screen commands ['F', 'P', 'U', 'C']
74
+
75
+ Full update (with screen cleaning):
76
+
77
+ ```display.show(image.to_bit_stream); display.update``` or
78
+
79
+ ```display.show(image.to_bit_stream, 'U')```
80
+
81
+ Fast update:
82
+
83
+ ```display.show(image.to_bit_stream); display.fast_update```
84
+ ```display.show(image.to_bit_stream, 'F')```
50
85
 
51
- # there are multiple screen commands ['F', 'P', 'U', 'C']
86
+ Partial update:
52
87
 
53
- * you can call `display.show(image.to_bit_stream); display.update` or `display.show(image.to_bit_stream, 'U')`
54
- * you can call `display.show(image.to_bit_stream); display.fast_update` or `display.show(image.to_bit_stream, 'F')`
55
- * you can call `display.show(image.to_bit_stream); display.partial_update` or `display.show(image.to_bit_stream, 'P')`
88
+ ```display.show(image.to_bit_stream); display.partial_update``` or
56
89
 
90
+ ```display.show(image.to_bit_stream, 'P')```
91
+
92
+ ## Load an image from a png file
93
+
94
+ ```
95
+ image = ChunkyPNG::Image.from_file('/some/png/file/path.png')
96
+ display.show(encode_png_pixels_to_scanline_grayscale_1bit(pixels))
57
97
  ```
58
- # Testing without a PAPiRus display
98
+
99
+ ## Testing without a PAPiRus display
59
100
 
60
101
  If you want to test the gem, but don't have your PaPiRus available, you can do the following
61
102
 
@@ -68,12 +109,15 @@ If you want to test the gem, but don't have your PaPiRus available, you can do t
68
109
  * when you run `display.show` the **fake** display /tmp/epd/LE/display is filled with your image
69
110
  * now you can use a bin editor like xxd to have a look at the result: `xxd -b /tmp/epd/LE/display`
70
111
 
71
- # TODO
112
+ ## TODO
72
113
 
73
114
  * make the image.to_bit_stream routine faster (as it is now to slow to do animations with partial updates)
74
115
  * add support for reading the temperature of the display
75
116
  * add support for changing the update rate
76
- * make the gem not depending on chunky_png
77
117
  * make load png image with chunky_png work (now output is black)
78
118
  * make a display.load(image) that takes multiple formats and figures out how to present them
79
119
  * create an issue to add your own requests :)
120
+
121
+ ## Other resources
122
+
123
+ * [pi supply python driver](https://github.com/PiSupply/PaPiRus)
data/README.rdoc CHANGED
@@ -1,9 +1,10 @@
1
1
  = papirus
2
2
 
3
- Description goes here.
3
+ This gem can be used to communicate with the {PaPiRus}[https://github.com/PiSupply/PaPiRus] display.
4
+ Checkout {GitHub}[http://github.com/mmolhoek/papirus] for examples
4
5
 
5
6
  == Contributing to papirus
6
-
7
+
7
8
  * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
8
9
  * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
9
10
  * Fork the project.
@@ -14,5 +15,4 @@ Description goes here.
14
15
 
15
16
  == Copyright
16
17
 
17
- Copyright (c) 2017 Mischa Molhoek. See LICENSE.txt for
18
- further details.
18
+ Copyright (c) 2017 Mischa Molhoek. See LICENSE.txt for further details.
data/lib/chunky.rb CHANGED
@@ -11,7 +11,6 @@ module ChunkyPNG::Canvas::StreamExporting
11
11
  #as the ChunkyPNG library works with 4 bytes data per pixel (1 byte for R, G, B and transparancy)
12
12
  #and the EDP needs 1 bit per pixel (on or off), we need some way to traverse over all pixels
13
13
  #and add a bit to a byte stream for each pixel. so
14
-
15
14
  bytes = []
16
15
  #for each 8 pixels (the ChunkyPNG library keeps an array of all pixels used, containing ChunkyPNG::Color elements)
17
16
  pixels.each_slice(8).map do |pixels|
@@ -26,6 +25,6 @@ module ChunkyPNG::Canvas::StreamExporting
26
25
  bytes.push(byte)
27
26
  end
28
27
  #now we just need to pack all bytes into a file writable string
29
- bytes.pack('C'*bytes.length)
28
+ bytes.pack('C*')
30
29
  end
31
30
  end
data/lib/papirus.rb CHANGED
@@ -1,5 +1,3 @@
1
- require_relative "chunky"
2
-
3
1
  module PaPiRus
4
2
  class Display
5
3
  attr_reader :epd_path, :width, :height, :panel, :cog, :film, :auto, :allowed_commands
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: papirus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mischa Molhoek
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-06 00:00:00.000000000 Z
11
+ date: 2017-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: shoulda
@@ -80,20 +80,6 @@ dependencies:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
- - !ruby/object:Gem::Dependency
84
- name: chunky_png
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: '0'
90
- type: :runtime
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- version: '0'
97
83
  description: This gem can be used to talk to the PaPiRus e-paper display
98
84
  email: mischamolhoek@gmail.com
99
85
  executables: []
@@ -130,7 +116,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
130
116
  version: '0'
131
117
  requirements: []
132
118
  rubyforge_project:
133
- rubygems_version: 2.6.13
119
+ rubygems_version: 2.5.1
134
120
  signing_key:
135
121
  specification_version: 4
136
122
  summary: ruby gem to access the PaPiRus display