Module: Raudi::Info

Defined in:
lib/raudi/info.rb

Class Method Summary collapse

Class Method Details

.configObject



7
8
9
10
11
12
# File 'lib/raudi/info.rb', line 7

def config
  @config ||= begin
    path = File.join(File.dirname(__FILE__), '../../', 'configuration/avr.yml')
    YAML.load_file(path)
  end
end

.headersObject



26
27
28
29
30
31
32
33
34
# File 'lib/raudi/info.rb', line 26

def headers
  @headers ||= begin
    list = []
    config['headers'].each do |namespace, headers|
      list += headers.map{|header| "#{process_namespace(namespace)}#{header}"}
    end
    list
  end
end

.interrupt_event(event_name) ⇒ Object



36
37
38
39
40
# File 'lib/raudi/info.rb', line 36

def interrupt_event(event_name)
  list = config['interrupts']['events'][event_name.to_s]
  raise "Undefined interrupt event - #{event_name}" unless list.is_a?(Fixnum)
  list
end

.method_missing(method_name, *args) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/raudi/info.rb', line 14

def method_missing(method_name, *args)
  if result = config[method_name.to_s]
    result
  else
    super(method_name, *args)
  end
end

.pin_statesObject



22
23
24
# File 'lib/raudi/info.rb', line 22

def pin_states
  gpio_states + specific_pin_states
end