Move reseting Leonardo logic to ard-reset-arduino

ard-reset-leonardo which was used for reseting Leonardo was written in
Python. Now the logic is added inside the ard-reset-arduino perl script
itself.

Fix #62

Squashed commit of the following:

commit a63366980f
Author: Simon John <git@the-jedi.co.uk>
Date:   Fri Jun 14 11:36:00 2013 +0200

    who put a space in the shebangs?!

commit c798eb26ea
Author: Simon John <git@the-jedi.co.uk>
Date:   Fri Jun 14 11:10:12 2013 +0200

    replaced ard-reset-leonardo with an update to ard-reset-arduino
    which is now called from Arduino.mk with the --leonardo flag

    removed some trailing whitespace

    upped version string in Arduino.mk
This commit is contained in:
Sudar 2013-06-14 16:09:38 +05:30
parent 9b38631d61
commit 60ca7d2852
5 changed files with 46 additions and 35 deletions

View file

@ -7,6 +7,8 @@ The following is the rough list of changes that went into different versions. I
- Fix whitespace and add /dev/null redirection (https://github.com/sej7278) - Fix whitespace and add /dev/null redirection (https://github.com/sej7278)
- Change the way AUTO_ARDUINO_VERSION is computed (https://github.com/sej7278) - Change the way AUTO_ARDUINO_VERSION is computed (https://github.com/sej7278)
- Make serial monitor baudrate detection work in Mac as well(https://github.com/sej7278) - Make serial monitor baudrate detection work in Mac as well(https://github.com/sej7278)
- Fix directory creation for library source files (https://github.com/matthijskooijman)
- Rewrite ard-leonardo-reset script in perl (https://github.com/sej7278)
### 0.10.5 (2013-06-11) ### 0.10.5 (2013-06-11)
- Add USB_VID and USB_PID to CPPFLAGS only if the board is Leonardo. - Add USB_VID and USB_PID to CPPFLAGS only if the board is Leonardo.

View file

@ -382,7 +382,7 @@ endif
# #
ifndef RESET_CMD ifndef RESET_CMD
ifeq ($(BOARD_TAG),leonardo) ifeq ($(BOARD_TAG),leonardo)
RESET_CMD = $(ARDMK_PATH)/ard-reset-leonardo \ RESET_CMD = $(ARDMK_PATH)/ard-reset-arduino --leonardo \
$(ARD_RESET_OPTS) $(call get_arduino_port) $(ARD_RESET_OPTS) $(call get_arduino_port)
else else
RESET_CMD = $(ARDMK_PATH)/ard-reset-arduino \ RESET_CMD = $(ARDMK_PATH)/ard-reset-arduino \

View file

@ -1,4 +1,4 @@
#! /usr/bin/env perl #!/usr/bin/env perl
use strict; use strict;
use warnings; use warnings;
@ -17,6 +17,7 @@ GetOptions(\%Opt,
"verbose!", "verbose!",
"help!", "help!",
"info!", "info!",
"leonardo!",
); );
if ($Opt{help} || $Opt{info}) if ($Opt{help} || $Opt{info})
@ -32,6 +33,17 @@ foreach my $dev (@ARGV)
my $p = Device::SerialPort->new($dev) my $p = Device::SerialPort->new($dev)
or die "Unable to open $dev: $!\n"; or die "Unable to open $dev: $!\n";
if ($Opt{leonardo})
{
$p->baudrate(1200);
$p->write_settings;
$p->close;
print STDERR "Switching to 1200 baud on $dev\n"
if $Opt{verbose};
}
else
{
my $dt = $Opt{period}; my $dt = $Opt{period};
print STDERR "Setting DTR high for ${dt}s on $dev\n" print STDERR "Setting DTR high for ${dt}s on $dev\n"
@ -42,6 +54,7 @@ foreach my $dev (@ARGV)
$p->pulse_dtr_on($dt * 1000.0); $p->pulse_dtr_on($dt * 1000.0);
} }
}
## here endeth the main ## here endeth the main
@ -62,6 +75,8 @@ ard-reset-arduino - Reset an Arduino
$ ard-reset-arduino --verbose --period=0.1 /dev/cu.usb* $ ard-reset-arduino --verbose --period=0.1 /dev/cu.usb*
$ ard-reset-arduino --verbose --leonardo /dev/ttyUSB0
=head1 DESCRIPTION =head1 DESCRIPTION
To reset (most) Arduinos, it's enough to just pulse the DTR line. To reset (most) Arduinos, it's enough to just pulse the DTR line.
@ -82,6 +97,10 @@ Watch what's going on on STDERR.
Specify the DTR pulse width in seconds. Specify the DTR pulse width in seconds.
=item --leonardo
Reset a Leonardo.
=back =back
=head1 BUGS AND LIMITATIONS =head1 BUGS AND LIMITATIONS
@ -96,6 +115,8 @@ Patches are welcome.
Martin Oldfield, ex-atelier@mjo.tc Martin Oldfield, ex-atelier@mjo.tc
Support for Leonardo added by sej7278, https://github.com/sej7278
Thanks to Daniele Vergini who suggested this to me, and supplied Thanks to Daniele Vergini who suggested this to me, and supplied
a command line version. a command line version.

View file

@ -1,12 +0,0 @@
#! /usr/bin/python
import sys
import serial
ser = serial.Serial(sys.argv[1], 57600)
ser.close()
ser.open()
ser.close()
ser.setBaudrate(1200)
ser.open()
ser.close()

View file

@ -1,4 +1,4 @@
#! /bin/bash #!/bin/bash
while [ ! -e $1 ] while [ ! -e $1 ]
do do