| 1 | package App::duino::Command::models; | ||||||||||||||||||||||||||||
| 2 | { | ||||||||||||||||||||||||||||
| 3 | 1 | $App::duino::Command::models::VERSION = '0.10'; | |||||||||||||||||||||||||||
| 4 | } | ||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 1 | ▶ | use App::duino -command; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | =head1 NAME | ||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | App::duino::Command::models - List all known Arduino models | ||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | =head1 VERSION | ||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | version 0.10 | ||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | $ duino models | ||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | This command can be used to list all known Arduino models. | ||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | =cut | ||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | 0 | ▶ | sub abstract { 'list all known Arduino models' } | ||||||||||||||||||||||||||
|
Subroutine
abstract: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | 0 | ▶ | sub usage_desc { '%c models %o' } | ||||||||||||||||||||||||||
|
Subroutine
usage_desc: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | 0 | ▶ | sub opt_spec { | ||||||||||||||||||||||||||
|
Subroutine
opt_spec: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 34 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | return ( | ||||||||||||||||||||||||||||
| 37 | 0 | [ 'sketchbook|s=s', 'specify the user sketchbook directory', | |||||||||||||||||||||||||||
| 38 | { default => $self -> default_config('sketchbook') } ], | ||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | [ 'root|d=s', 'specify the Arduino installation directory', | ||||||||||||||||||||||||||||
| 41 | { default => $self -> default_config('root') } ], | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | [ 'hardware|r=s', 'specify the hardware type to build for', | ||||||||||||||||||||||||||||
| 44 | { default => $self -> default_config('hardware') } ], | ||||||||||||||||||||||||||||
| 45 | ); | ||||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | 0 | ▶ | sub execute { | ||||||||||||||||||||||||||
|
Subroutine
execute: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||
| 49 | 0 | my ($self, $opt, $args) = @_; | |||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | 0 | my $boards = $self -> file($opt, 'hardware/' . | |||||||||||||||||||||||||||
| 52 | $opt -> hardware . '/boards.txt'); | ||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | 0 | ▶ | open my $fh, '<', $boards | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 55 | or die "Can't open file 'boards.txt'.\n"; | ||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | 0 | print "Supported models:\n\n"; | |||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | 0 | ▶ | while (my $line = <$fh>) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 60 | 0 | chomp $line; | |||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | 0 | my $first = substr $line, 0, 1; | |||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | 0 | ▶ | next if $first eq '#' or $first eq ''; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$first eq "#" or $first eq ""
MC/DC0%0/2
$first eq "#" or $first eq ""
$first eq "#"
$first eq ""
Truth table0%0/3
A or B
A= $first eq "#"B= $first eq ""
| |||||||||||||||||||||||||||||
| 65 | 0 | ▶ | next unless $line =~ /^(.*)\.name\=/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | 0 | my $board = $1; | |||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | 0 | my (undef, $value) = split '=', $line; | |||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | 0 | printf "%10s: %s\n", $board, $value; | |||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||
| 74 | 0 | close $fh; | |||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||
| 77 | =head1 OPTIONS | ||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||
| 79 | =over 4 | ||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | =item B<--sketchbook>, B<-s> | ||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||
| 83 | The path to the user's sketchbook directory. The environment variable | ||||||||||||||||||||||||||||
| 84 | C<ARDUINO_SKETCHBOOK> will be used if present and if the command-line option is | ||||||||||||||||||||||||||||
| 85 | not set. If neither of them is set the default value (C<$HOME/sketchbook>) will | ||||||||||||||||||||||||||||
| 86 | be used. | ||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||
| 88 | =item B<--root>, B<-d> | ||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||
| 90 | The path to the Arduino installation directory. The environment variable | ||||||||||||||||||||||||||||
| 91 | C<ARDUINO_DIR> will be used if present and if the command-line option is not | ||||||||||||||||||||||||||||
| 92 | set. If neither of them is set the default value (C</usr/share/arduino>) will | ||||||||||||||||||||||||||||
| 93 | be used. | ||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||
| 95 | =item B<--hardware>, B<-r> | ||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||
| 97 | The "type" of hardware to target. The environment variable C<ARDUINO_HARDWARE> | ||||||||||||||||||||||||||||
| 98 | will be used if present and if the command-line option is not set. If neither | ||||||||||||||||||||||||||||
| 99 | of them is set the default value (C<arduino>) will be used. | ||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||
| 101 | This option is only useful when using MCUs not officially supported by the | ||||||||||||||||||||||||||||
| 102 | Arduino platform (e.g. L<ATTiny|https://code.google.com/p/arduino-tiny/>). | ||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||
| 104 | =back | ||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||
| 106 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||
| 108 | Alessandro Ghedini <alexbio@cpan.org> | ||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||
| 110 | =head1 LICENSE AND COPYRIGHT | ||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||
| 112 | Copyright 2013 Alessandro Ghedini. | ||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||
| 114 | This program is free software; you can redistribute it and/or modify it | ||||||||||||||||||||||||||||
| 115 | under the terms of either: the GNU General Public License as published | ||||||||||||||||||||||||||||
| 116 | by the Free Software Foundation; or the Artistic License. | ||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||
| 118 | See http://dev.perl.org/licenses/ for more information. | ||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||
| 120 | =cut | ||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||
| 122 | 1 | 1; # End of App::duino::Command::models | |||||||||||||||||||||||||||