class Ev3dev::Screen
Constants
- BLANK_IMAGE
- FRAME_BUFFER_SIZE
- PATH
Attributes
imgs[RW]
Public Class Methods
new()
click to toggle source
# File lib/ev3dev/screen.rb, line 25 def initialize raise "couldn't find screen attributes" unless File.exist?(PATH) @imgs = [] end
Public Instance Methods
load(image_file)
click to toggle source
# File lib/ev3dev/screen.rb, line 30 def load(image_file) raise "couldn't load a image file except .mono format" unless image_file.end_with?('.mono') file_size = File.size(image_file) raise "file size:#{file_size} is not correct:(#{FRAME_BUFFER_SIZE})" unless file_size == FRAME_BUFFER_SIZE @imgs << File.binread(image_file) end
load_blank()
click to toggle source
# File lib/ev3dev/screen.rb, line 39 def load_blank @imgs << BLANK_IMAGE end
show()
click to toggle source
# File lib/ev3dev/screen.rb, line 43 def show if @imgs.size >= 2 File.binwrite(PATH, @imgs.shift) else File.binwrite(PATH, @imgs.first) end end
show_blank()
click to toggle source
# File lib/ev3dev/screen.rb, line 51 def show_blank File.binwrite(PATH, BLANK_IMAGE) end