Class: Phidgets::Bridge::BridgeInputs
- Inherits:
-
Object
- Object
- Phidgets::Bridge::BridgeInputs
- Defined in:
- lib/phidgets-ffi/bridge.rb
Overview
This class represents a bridge input for a PhidgetBridge. All the properties of an bridge input are stored and modified in this class.
Constant Summary collapse
- Klass =
Phidgets::FFI::CPhidgetBridge
Instance Method Summary collapse
-
#bridge_max ⇒ Float
Returns the maximum supported input value, in mV/V, or raises an error.
-
#bridge_min ⇒ Float
Returns the minimum supported input value, in mV/V, or raises an error.
-
#bridge_value ⇒ Float
Returns the value of a bridge input, in mV/V, or raises an error.
-
#enabled ⇒ Boolean
Returns the enabled state of a bridge input, or raises an error.
-
#enabled=(new_state) ⇒ Boolean
Sets the enabled state of a bridge input, or raises an error.
-
#gain ⇒ Phidgets::FFI::BridgeGains
Returns the gain type of a bridge input, or raises an error.
-
#gain=(new_gain) ⇒ Phidgets::FFI::BridgeGains
Sets the gain type of a bridge input, or raises an error.
-
#index ⇒ Integer
Returns the index of the bridge input, or raises an error.
-
#inspect ⇒ Object
Displays data for the bridge input.
Instance Method Details
#bridge_max ⇒ Float
Returns the maximum supported input value, in mV/V, or raises an error.
99 100 101 102 103 |
# File 'lib/phidgets-ffi/bridge.rb', line 99 def bridge_max ptr = ::FFI::MemoryPointer.new(:double) Klass.getBridgeMax(@handle, @index, ptr) ptr.get_double(0) end |
#bridge_min ⇒ Float
Returns the minimum supported input value, in mV/V, or raises an error.
106 107 108 109 110 |
# File 'lib/phidgets-ffi/bridge.rb', line 106 def bridge_min ptr = ::FFI::MemoryPointer.new(:double) Klass.getBridgeMin(@handle, @index, ptr) ptr.get_double(0) end |
#bridge_value ⇒ Float
Returns the value of a bridge input, in mV/V, or raises an error.
92 93 94 95 96 |
# File 'lib/phidgets-ffi/bridge.rb', line 92 def bridge_value ptr = ::FFI::MemoryPointer.new(:double) Klass.getBridgeValue(@handle, @index, ptr) ptr.get_double(0) end |
#enabled ⇒ Boolean
Returns the enabled state of a bridge input, or raises an error.
113 114 115 116 117 |
# File 'lib/phidgets-ffi/bridge.rb', line 113 def enabled ptr = ::FFI::MemoryPointer.new(:int) Klass.getEnabled(@handle, @index, ptr) (ptr.get_int(0) == 0) ? false : true end |
#enabled=(new_state) ⇒ Boolean
Sets the enabled state of a bridge input, or raises an error.
122 123 124 125 126 |
# File 'lib/phidgets-ffi/bridge.rb', line 122 def enabled=(new_state) tmp = new_state ? 1 : 0 Klass.setEnabled(@handle, @index, tmp) new_state end |
#gain ⇒ Phidgets::FFI::BridgeGains
Returns the gain type of a bridge input, or raises an error.
129 130 131 132 133 |
# File 'lib/phidgets-ffi/bridge.rb', line 129 def gain ptr = ::FFI::MemoryPointer.new(:int) Klass.getGain(@handle, @index, ptr) Phidgets::FFI::BridgeGains[ptr.get_int(0)] end |
#gain=(new_gain) ⇒ Phidgets::FFI::BridgeGains
Sets the gain type of a bridge input, or raises an error.
138 139 140 141 142 |
# File 'lib/phidgets-ffi/bridge.rb', line 138 def gain=(new_gain) ptr = ::FFI::MemoryPointer.new(:int) Klass.setGain(@handle, @index, Phidgets::FFI::BridgeGains[new_gain]) new_gain end |
#index ⇒ Integer
Returns the index of the bridge input, or raises an error.
87 88 89 |
# File 'lib/phidgets-ffi/bridge.rb', line 87 def index @index end |
#inspect ⇒ Object
Displays data for the bridge input.
82 83 84 |
# File 'lib/phidgets-ffi/bridge.rb', line 82 def inspect "#<#{self.class} @index=#{index}, @bridge_value=#{bridge_value}, @bridge_min=#{bridge_min}, @bridge_max=#{bridge_max}, @enabled=#{enabled}, @gain=#{gain}>" end |