Module: Lunchbox::Tasks

Defined in:
lib/lunchbox/tasks.rb

Defined Under Namespace

Classes: Environment

Constant Summary collapse

E =
Environment.new

Instance Method Summary collapse

Instance Method Details

#autodetect!Object



133
134
135
136
137
138
139
140
141
142
# File 'lib/lunchbox/tasks.rb', line 133

def autodetect!
  re = /\A#include <(lunchbox|lunchbox\/([^>]*))\.h>/

  i = File.readlines('src/main.c').grep(re) { |inc|
    $2 || $1
  }
  (%w{ lunchbox port dht } & i).each do |lib|
    use lib
  end
end

#cpu(cpu) ⇒ Object



113
114
115
# File 'lib/lunchbox/tasks.rb', line 113

def cpu cpu
  E.cpu = cpu
end

#hardware_uart!Object



125
126
127
# File 'lib/lunchbox/tasks.rb', line 125

def hardware_uart!
  E.hardware_uart!
end

#have_crystal!Object



129
130
131
# File 'lib/lunchbox/tasks.rb', line 129

def have_crystal!
  E.have_crystal!
end

#use(lib) ⇒ Object



117
118
119
120
121
122
123
# File 'lib/lunchbox/tasks.rb', line 117

def use lib
  E.add_lib lib

  if lib == 'port' && E.cpu =~ /3$/
    hardware_uart!
  end
end