#!/usr/bin/perl

use strict;
use warnings;

use App::duino;

=head1 NAME

duino - Command-line toolkit for working with Arduino boards

=head1 VERSION

version 0.08

=cut

=head1 SYNOPSIS

 duino COMMAND [OPTIONS]

=over

=item List the supported Arduino models:

   $ duino models

=item Build a sketch:

   $ duino build --board uno

=item Upload the sketch to the Arduino:

   $ duino upload --board uno --port /dev/ttyACM0

=item Build and upload a given sketch file:

   $ duino build --board uno some_sketch.ino
   $ duino upload --board uno --port /dev/ttyACM0 some_sketch.ino

=item Upload a previously built hex file:

   $ duino upload --board uno some_file.hex

=item Communicate with the Arduino:

   $ duino com --port /dev/ttyACM0

=item Clean the build directory:

   $ duino clean --board uno

=back

=head1 DESCRIPTION

B<duino> is a command-line toolkit for working with Arduino boards that can
replace the Arduino IDE. It can be either used directly on the command-line or
integrated into third-party IDEs. With duino you can quickly build and upload
sketches to a variety of Arduino boards, and communicate with them using the
built-in serial monitor.

To work it needs the Arduino software environment that can be found on the
L<Arduino website|http://arduino.cc/en/Main/Software>, or in most package
repositories (e.g. the C<arduino-core> package on Debian/Ubuntu).

=cut

App::duino -> run;

=head1 OPTIONS

=over 4

=item B<--board>, B<-b>

The Arduino board model. The environment variable C<ARDUINO_BOARD> will be used
if present and if the command-line option is not set. If neither of them is set
the default value (C<uno>) will be used.

=item B<--port>, B<-p>

The path to the Arduino serial port. The environment variable C<ARDUINO_PORT>
will be used if present and if the command-line option is not set. If neither
of them is set the default value (C</dev/ttyACM0>) will be used.

=item B<--sketchbook>, B<-s>

The path to the user's sketchbook directory. The environment variable
C<ARDUINO_SKETCHBOOK> will be used if present and if the command-line option is
not set. If neither of them is set the default value (C<$HOME/sketchbook>) will
be used.

=item B<--root>, B<-d>

The path to the Arduino installation directory. The environment variable
C<ARDUINO_DIR> will be used if present and if the command-line option is not
set. If neither of them is set the default value (C</usr/share/arduino>) will
be used.

=item B<--libs>, B<-l>

List of space-separated, non-core Arduino libraries to build. The environment
variable C<ARDUINO_LIBS> will be used if present and if the command-line option
is not set. If neither of them is set no libraries are built.

Example:

    $ duino build --libs "Wire Wire/utility SPI"

=item B<--hardware>, B<-r>

The "type" of hardware to target. The environment variable C<ARDUINO_HARDWARE>
will be used if present and if the command-line option is not set. If neither
of them is set the default value (C<arduino>) will be used.

This option is only useful when using MCUs not officially supported by the
Arduino platform (e.g. L<ATTiny|https://code.google.com/p/arduino-tiny/>).

=back

=head1 CONFIGURATION

Per-project configurations can be specified in the C<duino.ini> file under the
project directory. Valid configurations are:

=over 4

=item B<board>

The Arduino board model.

=item B<libs>

A list of non-core libraries needed by the project.

=back

Example:

    board = leonardo
    libs  = Wire Wire/utility SPI SD SD/utility

=head1 AUTHOR

Alessandro Ghedini <alexbio@cpan.org>

=head1 LICENSE AND COPYRIGHT

Copyright 2013 Alessandro Ghedini.

This program is free software; you can redistribute it and/or modify it
under the terms of either: the GNU General Public License as published
by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.

=cut
