Class: Mkduino::Probe
- Inherits:
-
Object
- Object
- Mkduino::Probe
- Defined in:
- lib/probe.rb
Constant Summary collapse
- DEVICES =
["/dev/ttyUSB0", "/dev/ttyUSB1", "/dev/ttyUSB2", "/dev/ttyACM0", "/dev/ttyACM1", "/dev/ttyACM2", "/dev/rfcomm0", "/dev/rfcomm1", "/dev/rfcomm2"]
- BOARDS =
{ "mega" => { variant: "mega", clock_speed: 16000000, device: "/dev/ACM0", baud_rate: "115200", programmer: "stk500", mcu: "atmega2560" }, "mega1280" => { variant: "mega", clock_speed: 16000000, device: "/dev/ACM0", baud_rate: "115200", programmer: "stk500", mcu: "atmega1280" }, "uno" => { variant: "standard", clock_speed: 16000000, device: "/dev/USB0", baud_rate: "57600", programmer: "arduino", mcu: "atmega328p" }, "mini" => { variant: "standard", clock_speed: 16000000, device: "/dev/USB0", baud_rate: "57600", programmer: "arduino", mcu: "atmega328p" }, "mini3v" => { variant: "standard", clock_speed: 8000000, device: "/dev/USB0", baud_rate: "57600", programmer: "arduino", mcu: "atmega328p" } }
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
-
#probe_options ⇒ Object
Returns the value of attribute probe_options.
Instance Method Summary collapse
-
#initialize(probe_options = {}) ⇒ Probe
constructor
A new instance of Probe.
- #probe ⇒ Object
- #probe_device ⇒ Object
- #probe_variant ⇒ Object
Constructor Details
#initialize(probe_options = {}) ⇒ Probe
Returns a new instance of Probe.
62 63 64 65 |
# File 'lib/probe.rb', line 62 def initialize = {} @probe_options = @options = {} end |
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
3 4 5 |
# File 'lib/probe.rb', line 3 def @options end |
#probe_options ⇒ Object
Returns the value of attribute probe_options.
4 5 6 |
# File 'lib/probe.rb', line 4 def @probe_options end |
Instance Method Details
#probe ⇒ Object
67 68 69 70 |
# File 'lib/probe.rb', line 67 def probe probe_device probe_variant end |
#probe_device ⇒ Object
80 81 82 83 84 85 86 87 88 |
# File 'lib/probe.rb', line 80 def probe_device @options[:device] = DEVICES[0] DEVICES.each do |d| if File.exist?(d) @options[:device] = d break end end end |
#probe_variant ⇒ Object
72 73 74 75 76 77 78 |
# File 'lib/probe.rb', line 72 def probe_variant if @options[:device] && @options[:device] =~ /ACM[0-9]/ @options[:variant] = "mega" else @options[:variant] = "standard" end end |