Class: OdroidLCD::LCD
- Inherits:
-
Object
- Object
- OdroidLCD::LCD
- Defined in:
- lib/odroid_lcd/lcd.rb
Instance Attribute Summary collapse
-
#max_column ⇒ Object
readonly
Returns the value of attribute max_column.
-
#max_row ⇒ Object
readonly
Returns the value of attribute max_row.
Instance Method Summary collapse
- #clear ⇒ Object
-
#initialize(mocks: {}) ⇒ LCD
constructor
A new instance of LCD.
- #set_character(row:, column:, character:) ⇒ Object
- #set_string(row: 0, string:) ⇒ Object
Constructor Details
Instance Attribute Details
#max_column ⇒ Object (readonly)
Returns the value of attribute max_column.
5 6 7 |
# File 'lib/odroid_lcd/lcd.rb', line 5 def max_column @max_column end |
#max_row ⇒ Object (readonly)
Returns the value of attribute max_row.
6 7 8 |
# File 'lib/odroid_lcd/lcd.rb', line 6 def max_row @max_row end |
Instance Method Details
#clear ⇒ Object
15 16 17 |
# File 'lib/odroid_lcd/lcd.rb', line 15 def clear @hw.clear end |
#set_character(row:, column:, character:) ⇒ Object
19 20 21 |
# File 'lib/odroid_lcd/lcd.rb', line 19 def set_character(row:, column:, character:) @hw.set_character(row, column, character) end |
#set_string(row: 0, string:) ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/odroid_lcd/lcd.rb', line 23 def set_string(row: 0, string:) column = 0 string[0, @max_column].ljust(@max_column - 1).chars do |chr| set_character(row: row, column: column, character: chr) column += 1 end end |