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:
parent
9b38631d61
commit
c798eb26ea
3 changed files with 41 additions and 34 deletions
|
@ -19,7 +19,7 @@
|
||||||
#
|
#
|
||||||
# Original Arduino adaptation by mellis, eighthave, oli.keller
|
# Original Arduino adaptation by mellis, eighthave, oli.keller
|
||||||
#
|
#
|
||||||
# Current version: 0.10.5
|
# Current version: 0.10.6
|
||||||
#
|
#
|
||||||
# Refer to HISTORY.md file for complete history of changes
|
# Refer to HISTORY.md file for complete history of changes
|
||||||
#
|
#
|
||||||
|
@ -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 \
|
||||||
|
|
|
@ -7,16 +7,17 @@ use Device::SerialPort;
|
||||||
use Getopt::Long;
|
use Getopt::Long;
|
||||||
use Pod::Usage;
|
use Pod::Usage;
|
||||||
|
|
||||||
my %Opt =
|
my %Opt =
|
||||||
(
|
(
|
||||||
period => 0.1,
|
period => 0.1,
|
||||||
);
|
);
|
||||||
|
|
||||||
GetOptions(\%Opt,
|
GetOptions(\%Opt,
|
||||||
"period=f", # width of reset pulse in seconds
|
"period=f", # width of reset pulse in seconds
|
||||||
"verbose!",
|
"verbose!",
|
||||||
"help!",
|
"help!",
|
||||||
"info!",
|
"info!",
|
||||||
|
"leonardo!",
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($Opt{help} || $Opt{info})
|
if ($Opt{help} || $Opt{info})
|
||||||
|
@ -31,21 +32,33 @@ 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"
|
||||||
if $Opt{verbose};
|
if $Opt{verbose};
|
||||||
|
|
||||||
die "Invalid pulse width ($dt), "
|
die "Invalid pulse width ($dt), "
|
||||||
unless $dt > 0.0;
|
unless $dt > 0.0;
|
||||||
|
|
||||||
$p->pulse_dtr_on($dt * 1000.0);
|
$p->pulse_dtr_on($dt * 1000.0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
## here endeth the main
|
## here endeth the main
|
||||||
|
|
||||||
sub usage
|
sub usage
|
||||||
{
|
{
|
||||||
pod2usage(-verbose => 2);
|
pod2usage(-verbose => 2);
|
||||||
}
|
}
|
||||||
|
@ -53,20 +66,22 @@ sub usage
|
||||||
__END__
|
__END__
|
||||||
|
|
||||||
=head1 NAME
|
=head1 NAME
|
||||||
|
|
||||||
ard-reset-arduino - Reset an Arduino
|
ard-reset-arduino - Reset an Arduino
|
||||||
|
|
||||||
=head1 USAGE
|
=head1 USAGE
|
||||||
|
|
||||||
$ ard-reset-arduino /dev/cu.usb*
|
$ ard-reset-arduino /dev/cu.usb*
|
||||||
|
|
||||||
$ 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.
|
||||||
|
|
||||||
You can do that from the shell with stty, but there's an interesting
|
You can do that from the shell with stty, but there's an interesting
|
||||||
diversity of command flags. This little program gives a uniform interface
|
diversity of command flags. This little program gives a uniform interface
|
||||||
at the cost of requiring C<Device::SerialPort>.
|
at the cost of requiring C<Device::SerialPort>.
|
||||||
|
|
||||||
|
@ -82,8 +97,12 @@ 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
|
||||||
|
|
||||||
There are no known bugs in this application.
|
There are no known bugs in this application.
|
||||||
|
@ -91,18 +110,18 @@ There are no known bugs in this application.
|
||||||
Please report problems to the author.
|
Please report problems to the author.
|
||||||
|
|
||||||
Patches are welcome.
|
Patches are welcome.
|
||||||
|
|
||||||
=head1 AUTHOR
|
=head1 AUTHOR
|
||||||
|
|
||||||
Martin Oldfield, ex-atelier@mjo.tc
|
Martin Oldfield, ex-atelier@mjo.tc
|
||||||
|
|
||||||
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.
|
||||||
|
|
||||||
=head1 LICENCE AND COPYRIGHT
|
=head1 LICENCE AND COPYRIGHT
|
||||||
|
|
||||||
Copyright (c) 2012, Martin Oldfield. All rights reserved.
|
Copyright (c) 2012, Martin Oldfield. All rights reserved.
|
||||||
|
|
||||||
This file is free software; you can redistribute it and/or modify it
|
This file is free software; you can redistribute it and/or modify it
|
||||||
under the terms of the GNU Lesser General Public License as published
|
under the terms of the GNU Lesser General Public License as published
|
||||||
by the Free Software Foundation; either version 2.1 of the License, or
|
by the Free Software Foundation; either version 2.1 of the License, or
|
||||||
|
@ -110,6 +129,6 @@ by the Free Software Foundation; either version 2.1 of the License, or
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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()
|
|
Loading…
Reference in a new issue