File tree 1 file changed +8
-5
lines changed
1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change 1
1
require 'rake/clean'
2
2
require 'fileutils'
3
3
4
+ MCU = ENV [ 'MCU' ] || 'atmega328p'
5
+ PARTNO = ENV [ 'PARTNO' ] || MCU
6
+ F_CPU = ENV [ 'F_CPU' ] || '16000000UL'
4
7
SERIAL_PORT = ENV [ 'SERIAL_PORT' ]
5
8
PROG = 'scaffold'
6
9
SRCDIR = 'src'
@@ -23,16 +26,16 @@ TARGET = {
23
26
:compiler => 'avr-gcc' ,
24
27
:compiler_args => [
25
28
'-DTARGET' ,
26
- ' -DF_CPU=16000000UL' ,
27
- ' -mmcu=atmega328p' ,
29
+ " -DF_CPU=#{ F_CPU } " ,
30
+ " -mmcu=#{ MCU } " ,
28
31
'-Iinclude/' ,
29
32
'-Wall' ,
30
33
'-Os' ,
31
34
'-c'
32
35
] ,
33
36
:linker => 'avr-gcc' ,
34
37
:linker_args => [
35
- ' -mmcu=atmega328p'
38
+ " -mmcu=#{ MCU } "
36
39
] ,
37
40
:objcopy => 'avr-objcopy'
38
41
}
@@ -90,11 +93,11 @@ namespace :target do
90
93
91
94
desc "Program the Arduino over the serial port."
92
95
task :program => [ :convert , :serial_port ] do
93
- sh "avrdude -F -V -c arduino -p ATMEGA328P -P #{ SERIAL_PORT } -b 115200 -U flash:w:#{ PROG } .hex"
96
+ sh "avrdude -F -V -c arduino -p #{ PARTNO } -P #{ SERIAL_PORT } -b 115200 -U flash:w:#{ PROG } .hex"
94
97
end
95
98
96
99
desc "Make a backup hex image of the flash contents."
97
100
task :backup , [ :backup_name ] => :serial_port do |t , args |
98
- sh "avrdude -F -V -c arduino -p ATMEGA328P -P #{ SERIAL_PORT } -b 115200 -U flash:r:#{ args . backup_name } :i"
101
+ sh "avrdude -F -V -c arduino -p #{ PARTNO } -P #{ SERIAL_PORT } -b 115200 -U flash:r:#{ args . backup_name } :i"
99
102
end
100
103
end
You can’t perform that action at this time.
0 commit comments