Class: Tamashii::Agent::Device::Lcd::Lcm1602I2c

Inherits:
Base show all
Defined in:
lib/tamashii/agent/device/lcd/lcm1602_i2c.rb

Constant Summary collapse

WIDTH =
16
LINE_COUNT =
2
OP_CHR =
1
OP_CMD =
0
LINES =
[
  0x80,
  0xC0
].freeze
BACKLIGHT_ON =
0x08
BACKLIGHT_OFF =
0x00
ENABLE =
0b00000100
PULSE =
0.0005
DELAY =
0.0005

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#print_message

Methods inherited from DeviceBase

#fetch_option, #fetch_option!, #unexport_pin

Methods included from Common::Loggable

#display_name, #logger, #progname

Constructor Details

#initialize(*args) ⇒ Lcm1602I2c

Returns a new instance of Lcm1602I2c.



38
39
40
41
# File 'lib/tamashii/agent/device/lcd/lcm1602_i2c.rb', line 38

def initialize(*args)
  super
  initialize_lcd
end

Instance Attribute Details

#backlightObject

Returns the value of attribute backlight.



28
29
30
# File 'lib/tamashii/agent/device/lcd/lcm1602_i2c.rb', line 28

def backlight
  @backlight
end

Instance Method Details

#default_addressObject



47
48
49
# File 'lib/tamashii/agent/device/lcd/lcm1602_i2c.rb', line 47

def default_address
  0x27
end

#default_pathObject



43
44
45
# File 'lib/tamashii/agent/device/lcd/lcm1602_i2c.rb', line 43

def default_path
  '/dev/i2c-1'
end

#line_countObject



34
35
36
# File 'lib/tamashii/agent/device/lcd/lcm1602_i2c.rb', line 34

def line_count
  2
end


51
52
53
# File 'lib/tamashii/agent/device/lcd/lcm1602_i2c.rb', line 51

def print_line(message, line)
  write_line(message, LINES[line])
end

#shutdownObject



55
56
57
# File 'lib/tamashii/agent/device/lcd/lcm1602_i2c.rb', line 55

def shutdown
  print_message("")
end

#widthObject



30
31
32
# File 'lib/tamashii/agent/device/lcd/lcm1602_i2c.rb', line 30

def width
  16
end