Module: Radio::Rig::LO

Included in:
Radio::Rig
Defined in:
lib/radio/rig/lo.rb

Instance Method Summary collapse

Instance Method Details

#initializeObject



20
21
22
23
# File 'lib/radio/rig/lo.rb', line 20

def initialize
  @lo = Controls::Null.new
  super
end

#loObject

Returns a float of the LO frequency in MHz. This will read from the actual device for the case of an operator adjusting outside this application, such as with the main dial of a stand-alone radio.



47
48
49
50
51
# File 'lib/radio/rig/lo.rb', line 47

def lo
  @semaphore.synchronize do
    @lo.lo
  end
end

#lo=(freq_or_control) ⇒ Object

Accepts an instance of any LO control to use. Float for the frequency in MHz (sub-Hz ok). Integer for the frequency in Hz.



28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/radio/rig/lo.rb', line 28

def lo= freq_or_control
  @semaphore.synchronize do
    if Numeric === freq_or_control
      @lo.lo = if freq_or_control.integer?
        freq_or_control.to_f / 1000000
      else
        freq_or_control
      end
    else
      @lo.stop if @lo
      @lo = freq_or_control
    end
  end
end