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
|
*.o
|
||||||
build-cli
|
build-cli
|
||||||
|
*~
|
|
@ -297,10 +297,10 @@ ifdef ARDUINO_DIR
|
||||||
|
|
||||||
ifndef AVR_TOOLS_DIR
|
ifndef AVR_TOOLS_DIR
|
||||||
AVR_TOOLS_DIR = $(ARDUINO_DIR)/hardware/tools/avr
|
AVR_TOOLS_DIR = $(ARDUINO_DIR)/hardware/tools/avr
|
||||||
|
endif
|
||||||
# The avrdude bundled with Arduino can't find its config
|
# The avrdude bundled with Arduino can't find its config
|
||||||
ifndef AVRDUDE_CONF
|
ifndef AVRDUDE_CONF
|
||||||
AVRDUDE_CONF = $(AVR_TOOLS_DIR)/etc/avrdude.conf
|
AVRDUDE_CONF = $(ARDUINO_DIR)/hardware/tools/avrdude.conf
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifndef AVR_TOOLS_PATH
|
ifndef AVR_TOOLS_PATH
|
||||||
|
@ -358,12 +358,6 @@ ifndef MONITOR_CMD
|
||||||
MONITOR_CMD = screen
|
MONITOR_CMD = screen
|
||||||
endif
|
endif
|
||||||
|
|
||||||
########################################################################
|
|
||||||
# Reset
|
|
||||||
ifndef RESET_CMD
|
|
||||||
RESET_CMD = $(ARDMK_PATH)/ard-reset-arduino $(ARD_RESET_OPTS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
# boards.txt parsing
|
# boards.txt parsing
|
||||||
#
|
#
|
||||||
|
@ -445,6 +439,17 @@ ifndef OBJDIR
|
||||||
OBJDIR = build-$(BOARD_TAG)
|
OBJDIR = build-$(BOARD_TAG)
|
||||||
endif
|
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
|
# Local sources
|
||||||
#
|
#
|
||||||
|
@ -672,10 +677,16 @@ $(DEP_FILE): $(OBJDIR) $(DEPS)
|
||||||
upload: reset raw_upload
|
upload: reset raw_upload
|
||||||
|
|
||||||
raw_upload: $(TARGET_HEX)
|
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) \
|
$(AVRDUDE) $(AVRDUDE_COM_OPTS) $(AVRDUDE_ARD_OPTS) \
|
||||||
-U flash:w:$(TARGET_HEX):i
|
-U flash:w:$(TARGET_HEX):i
|
||||||
|
|
||||||
reset:
|
reset:
|
||||||
|
$(ECHO) "Resetting Arduino..."
|
||||||
$(RESET_CMD) $(ARD_PORT)
|
$(RESET_CMD) $(ARD_PORT)
|
||||||
|
|
||||||
# stty on MacOS likes -F, but on Debian it likes -f redirecting
|
# 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