arduino leonardo support.
Reset leonardo and wait for the connection to be established.
This commit is contained in:
parent
184230fcf2
commit
349d254013
3 changed files with 28 additions and 8 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,2 +1,3 @@
|
|||
*.o
|
||||
build-cli
|
||||
*~
|
|
@ -297,10 +297,10 @@ ifdef ARDUINO_DIR
|
|||
|
||||
ifndef AVR_TOOLS_DIR
|
||||
AVR_TOOLS_DIR = $(ARDUINO_DIR)/hardware/tools/avr
|
||||
endif
|
||||
# The avrdude bundled with Arduino can't find its config
|
||||
ifndef AVRDUDE_CONF
|
||||
AVRDUDE_CONF = $(AVR_TOOLS_DIR)/etc/avrdude.conf
|
||||
endif
|
||||
AVRDUDE_CONF = $(ARDUINO_DIR)/hardware/tools/avrdude.conf
|
||||
endif
|
||||
|
||||
ifndef AVR_TOOLS_PATH
|
||||
|
@ -358,12 +358,6 @@ ifndef MONITOR_CMD
|
|||
MONITOR_CMD = screen
|
||||
endif
|
||||
|
||||
########################################################################
|
||||
# Reset
|
||||
ifndef RESET_CMD
|
||||
RESET_CMD = $(ARDMK_PATH)/ard-reset-arduino $(ARD_RESET_OPTS)
|
||||
endif
|
||||
|
||||
########################################################################
|
||||
# boards.txt parsing
|
||||
#
|
||||
|
@ -445,6 +439,17 @@ ifndef OBJDIR
|
|||
OBJDIR = build-$(BOARD_TAG)
|
||||
endif
|
||||
|
||||
|
||||
########################################################################
|
||||
# Reset
|
||||
ifndef RESET_CMD
|
||||
ifeq ($(BOARD_TAG),leonardo)
|
||||
RESET_CMD = $(ARDMK_PATH)/ard-reset-leonardo $(ARD_RESET_OPTS)
|
||||
else
|
||||
RESET_CMD = $(ARDMK_PATH)/ard-reset-arduino $(ARD_RESET_OPTS)
|
||||
endif
|
||||
endif
|
||||
|
||||
########################################################################
|
||||
# Local sources
|
||||
#
|
||||
|
@ -672,10 +677,16 @@ $(DEP_FILE): $(OBJDIR) $(DEPS)
|
|||
upload: reset raw_upload
|
||||
|
||||
raw_upload: $(TARGET_HEX)
|
||||
while [ ! -e $(ARDUINO_PORT) ] ;\
|
||||
do \
|
||||
echo "Waiting for arduino at $(ARD_PORT)";\
|
||||
sleep 0.3 ;\
|
||||
done
|
||||
$(AVRDUDE) $(AVRDUDE_COM_OPTS) $(AVRDUDE_ARD_OPTS) \
|
||||
-U flash:w:$(TARGET_HEX):i
|
||||
|
||||
reset:
|
||||
$(ECHO) "Resetting Arduino..."
|
||||
$(RESET_CMD) $(ARD_PORT)
|
||||
|
||||
# stty on MacOS likes -F, but on Debian it likes -f redirecting
|
||||
|
|
8
bin/ard-reset-leonardo
Executable file
8
bin/ard-reset-leonardo
Executable file
|
@ -0,0 +1,8 @@
|
|||
#! /usr/bin/python
|
||||
|
||||
import sys
|
||||
import serial
|
||||
|
||||
ser = serial.Serial(sys.argv[1], 1200)
|
||||
ser.open()
|
||||
ser.close()
|
Loading…
Reference in a new issue