Class: Phidgets::TextLCD::TextLCDScreens
- Inherits:
-
Object
- Object
- Phidgets::TextLCD::TextLCDScreens
- Defined in:
- lib/phidgets-ffi/text_lcd.rb
Overview
This class represents a screen a PhidgetTextLCD. All the properties of a screen are stored and modified in this class.
Defined Under Namespace
Classes: TextLCDScreensRows
Constant Summary collapse
- Klass =
Phidgets::FFI::CPhidgetTextLCD
Instance Attribute Summary collapse
-
#rows ⇒ TextLCDScreensRows
readonly
Collection of rows of text display in a PhidgetTextLCD.
Instance Method Summary collapse
-
#back_light ⇒ Boolean
Returns the back light state of a screen, or raises an error.
-
#back_light=(new_state) ⇒ Boolean
Sets the back light state of a screen, or raises an error.
-
#brightness ⇒ Integer
Returns the brightness value of a screen, or raises an error.
-
#brightness=(new_brightness) ⇒ Integer
Sets the brightness value of a screen, or raises an error.
-
#contrast ⇒ Integer
Returns the contrast of a screen, or raises an error.
-
#contrast=(new_contrast) ⇒ Integer
Sets the contrast value of a screen, or raises an error.
-
#cursor ⇒ Boolean
Returns the cursor state of a screen, or raises an error.
-
#cursor=(new_state) ⇒ Boolean
Sets the cursor state of a screen, or raises an error.
-
#cursor_blink ⇒ Boolean
The cursor blink is a flashing box which appears directly to the right of the last entered character on the display, in the same apot as the cursor if it is enabled.
-
#cursor_blink=(new_state) ⇒ Boolean
Sets the cursor blink state of a screen, or raises an error.
-
#index ⇒ Integer
Returns index of the screen, or raises an error.
-
#initialize_screen ⇒ Boolean
Initializes a screen, or raises an error.
-
#inspect ⇒ Object
Displays data for the servo motor.
-
#screen_size ⇒ Phidgets::FFI::TextLCDScreenSizes
Returns the screen size of a screen, or raises an error.
-
#screen_size=(new_screen_size) ⇒ Phidgets::FFI::TextLCDScreenSizes
Sets the screen size of a screen, or raises an error.
Instance Attribute Details
#rows ⇒ TextLCDScreensRows (readonly)
Collection of rows of text display in a PhidgetTextLCD
44 45 46 |
# File 'lib/phidgets-ffi/text_lcd.rb', line 44 def rows @rows end |
Instance Method Details
#back_light ⇒ Boolean
Returns the back light state of a screen, or raises an error.
52 53 54 55 56 57 |
# File 'lib/phidgets-ffi/text_lcd.rb', line 52 def back_light try_set_screen ptr = ::FFI::MemoryPointer.new(:int) Klass.getBacklight(@handle, ptr) (ptr.get_int(0) == 0) ? false : true end |
#back_light=(new_state) ⇒ Boolean
Sets the back light state of a screen, or raises an error.
62 63 64 65 66 67 |
# File 'lib/phidgets-ffi/text_lcd.rb', line 62 def back_light=(new_state) try_set_screen tmp = new_state ? 1 : 0 Klass.setBacklight(@handle, tmp) new_state end |
#brightness ⇒ Integer
Returns the brightness value of a screen, or raises an error. Not all PhidgetTextLCDs support brightness.
70 71 72 73 74 75 |
# File 'lib/phidgets-ffi/text_lcd.rb', line 70 def brightness try_set_screen ptr = ::FFI::MemoryPointer.new(:int) Klass.getBrightness(@handle, ptr) ptr.get_int(0) end |
#brightness=(new_brightness) ⇒ Integer
Sets the brightness value of a screen, or raises an error. Not all PhidgetTextLCDs support brightness.
80 81 82 83 84 |
# File 'lib/phidgets-ffi/text_lcd.rb', line 80 def brightness=(new_brightness) try_set_screen Klass.setBrightness(@handle, new_brightness.to_i) new_brightness.to_i end |
#contrast ⇒ Integer
Returns the contrast of a screen, or raises an error.
87 88 89 90 91 92 |
# File 'lib/phidgets-ffi/text_lcd.rb', line 87 def contrast try_set_screen ptr = ::FFI::MemoryPointer.new(:int) Klass.getContrast(@handle, ptr) ptr.get_int(0) end |
#contrast=(new_contrast) ⇒ Integer
Sets the contrast value of a screen, or raises an error.
97 98 99 100 101 |
# File 'lib/phidgets-ffi/text_lcd.rb', line 97 def contrast=(new_contrast) try_set_screen Klass.setContrast(@handle, new_contrast.to_i) new_contrast.to_i end |
#cursor ⇒ Boolean
Returns the cursor state of a screen, or raises an error.
105 106 107 108 109 110 |
# File 'lib/phidgets-ffi/text_lcd.rb', line 105 def cursor try_set_screen ptr = ::FFI::MemoryPointer.new(:int) Klass.getCursonOn(@handle, ptr) (ptr.get_int(0) == 0) ? false : true end |
#cursor=(new_state) ⇒ Boolean
Sets the cursor state of a screen, or raises an error.
115 116 117 118 119 120 |
# File 'lib/phidgets-ffi/text_lcd.rb', line 115 def cursor=(new_state) try_set_screen tmp = new_state ? 1 : 0 Klass.setCursorOn(@handle, tmp) new_state end |
#cursor_blink ⇒ Boolean
The cursor blink is a flashing box which appears directly to the right of the last entered character on the display, in the same apot as the cursor if it is enabled.
124 125 126 127 128 129 |
# File 'lib/phidgets-ffi/text_lcd.rb', line 124 def cursor_blink try_set_screen ptr = ::FFI::MemoryPointer.new(:int) Klass.getCursonBlink(@handle, ptr) (ptr.get_int(0) == 0) ? false : true end |
#cursor_blink=(new_state) ⇒ Boolean
Sets the cursor blink state of a screen, or raises an error.
134 135 136 137 138 139 |
# File 'lib/phidgets-ffi/text_lcd.rb', line 134 def cursor_blink=(new_state) try_set_screen tmp = new_state ? 1 : 0 Klass.setCursorBlink(@handle, tmp) new_state end |
#index ⇒ Integer
Returns index of the screen, or raises an error.
47 48 49 |
# File 'lib/phidgets-ffi/text_lcd.rb', line 47 def index @index end |
#initialize_screen ⇒ Boolean
Initializes a screen, or raises an error. Not all PhidgetTextLCDs support initialize
162 163 164 165 166 |
# File 'lib/phidgets-ffi/text_lcd.rb', line 162 def initialize_screen try_set_screen Klass.initialize(@handle) true end |
#inspect ⇒ Object
Displays data for the servo motor.
38 39 40 |
# File 'lib/phidgets-ffi/text_lcd.rb', line 38 def inspect "#<#{self.class} @index=#{index}>" end |
#screen_size ⇒ Phidgets::FFI::TextLCDScreenSizes
Returns the screen size of a screen, or raises an error. Not all PhidgetTextLCDs support screen_size.
142 143 144 145 146 147 |
# File 'lib/phidgets-ffi/text_lcd.rb', line 142 def screen_size try_set_screen ptr = ::FFI::MemoryPointer.new(:int) Klass.getScreenSize(@handle, ptr) Phidgets::FFI::TextLCDScreenSizes[ptr.get_int(0)] end |
#screen_size=(new_screen_size) ⇒ Phidgets::FFI::TextLCDScreenSizes
Sets the screen size of a screen, or raises an error. Not all PhidgetTextLCDs support screen_size.
152 153 154 155 156 157 158 |
# File 'lib/phidgets-ffi/text_lcd.rb', line 152 def screen_size=(new_screen_size) try_set_screen Klass.setScreenSize(@handle, Phidgets::FFI::TextLCDScreenSizes[new_screen_size]) load_rows(@index) #readjust screen rows new_screen_size end |