Class: Phidgets::TextLCD::TextLCDScreens::TextLCDScreensRows
- Inherits:
-
Object
- Object
- Phidgets::TextLCD::TextLCDScreens::TextLCDScreensRows
- Defined in:
- lib/phidgets-ffi/text_lcd.rb
Overview
This class represents a row on a PhidgetTextLCD screen. All the properties of a row are stored and modified in this class.
Constant Summary collapse
- Klass =
Phidgets::FFI::CPhidgetTextLCD
Instance Method Summary collapse
-
#display_character(column, new_display_character) ⇒ Integer
Sets a single character for a specific column of a row, or raises an error.
-
#display_string=(new_display_string) ⇒ String
Sets the display string of a row, or raises an error.
-
#maximum_length ⇒ Integer
Returns the maximum length of a row, or raises an error.
Instance Method Details
#display_character(column, new_display_character) ⇒ Integer
Sets a single character for a specific column of a row, or raises an error.
example
lcd.screens[0].rows[1].display_character(4, 0x21) #hex for ! in ASCII
lcd.screens[0].rows[1].display_character(5, 067) #octal for 7 in ASCII
202 203 204 205 206 207 208 |
# File 'lib/phidgets-ffi/text_lcd.rb', line 202 def display_character(column, new_display_character) if (Common.device_id(@handle).to_s == "textlcd_adapter") Klass.setScreen(@handle, @screen_index) end Klass.setDisplayCharacter(@handle, @row, column, new_display_character) new_display_character end |
#display_string=(new_display_string) ⇒ String
Sets the display string of a row, or raises an error.
example
lcd.screens[0].rows[1].display_string = "\x48" #hex for H in ASCII
lcd.screens[0].rows[2].display_string = "\147" #octal for g in ASCII
186 187 188 189 190 191 192 |
# File 'lib/phidgets-ffi/text_lcd.rb', line 186 def display_string=(new_display_string) if (Common.device_id(@handle).to_s == "textlcd_adapter") Klass.setScreen(@handle, @screen_index) end Klass.setDisplayString(@handle, @row, new_display_string) new_display_string end |
#maximum_length ⇒ Integer
Returns the maximum length of a row, or raises an error.
211 212 213 214 215 |
# File 'lib/phidgets-ffi/text_lcd.rb', line 211 def maximum_length ptr = ::FFI::MemoryPointer.new(:int) Klass.getColumnCount(@handle, ptr) ptr.get_int(0) end |