Class: Workshop::Uploader
- Inherits:
-
Object
- Object
- Workshop::Uploader
- Includes:
- FileUtils
- Defined in:
- lib/workshop/uploader.rb
Instance Attribute Summary collapse
-
#hex_filename ⇒ Object
Returns the value of attribute hex_filename.
-
#project ⇒ Object
Returns the value of attribute project.
-
#tools ⇒ Object
Returns the value of attribute tools.
Instance Method Summary collapse
- #com_port ⇒ Object
-
#initialize(project, hex_filename) ⇒ Uploader
constructor
A new instance of Uploader.
- #upload ⇒ Object
- #upload_command ⇒ Object
Constructor Details
#initialize(project, hex_filename) ⇒ Uploader
Returns a new instance of Uploader.
6 7 8 9 10 |
# File 'lib/workshop/uploader.rb', line 6 def initialize(project, hex_filename) self.project = project self.tools = Workshop::Tools.new project.arduino_hardware_directory self.hex_filename = hex_filename end |
Instance Attribute Details
#hex_filename ⇒ Object
Returns the value of attribute hex_filename.
4 5 6 |
# File 'lib/workshop/uploader.rb', line 4 def hex_filename @hex_filename end |
#project ⇒ Object
Returns the value of attribute project.
4 5 6 |
# File 'lib/workshop/uploader.rb', line 4 def project @project end |
#tools ⇒ Object
Returns the value of attribute tools.
4 5 6 |
# File 'lib/workshop/uploader.rb', line 4 def tools @tools end |
Instance Method Details
#com_port ⇒ Object
12 13 14 |
# File 'lib/workshop/uploader.rb', line 12 def com_port project.com_port end |
#upload ⇒ Object
30 31 32 |
# File 'lib/workshop/uploader.rb', line 30 def upload sh upload_command end |
#upload_command ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/workshop/uploader.rb', line 16 def upload_command [ tools.avrdude, "-C #{tools.avrdude_config}", "-v -v -v -v -v -v", "-p #{project.build_mcu}", "-c #{project.programmer}", "-P #{project.com_port}", "-b #{project.baud_rate}", "-D", "-Uflash:w:#{hex_filename}:i" ].join(' ') end |