App-AVR-Fuses
view release on metacpan or search on metacpan
lib/App/AVR/Fuses.pm view on Meta::CPAN
# You may distribute under the terms of either the GNU General Public License
# or the Artistic License (the same terms as Perl itself)
#
# (C) Paul Evans, 2019 -- leonerd@leonerd.org.uk
package App::AVR::Fuses;
use strict;
use warnings;
use feature qw( say );
use 5.010;
our $VERSION = '0.01';
use File::ShareDir qw( module_dir );
use Getopt::Long qw( GetOptionsFromArray );
use List::Util qw( first );
use YAML ();
lib/App/AVR/Fuses.pm view on Meta::CPAN
yamlpath => $yamlpath,
);
$self->set_fusereg( $_ => $current{$_} ) for keys %current;
foreach my $arg ( @argv ) {
my ( $name, $val ) = $arg =~ m/^(\w+)=(.*)$/ or
die "Unable to parse '$arg'\n";
if( $val eq "?" ) {
say join "\n",
"Possible values for $name are:",
$self->list_values_for_fuse( $name );
return 1;
}
$self->set_fuse( uc $name, $val );
}
if( $VERBOSE ) {
lib/App/AVR/Fuses.pm view on Meta::CPAN
my $val = $self->{regs}{ $fuseinfo->{reg} } & $mask;
if( $fuseinfo->{values} ) {
my $chosen = first { $_->{value} == $val } $fuseinfo->{values}->@*;
$val = "$chosen->{name} - $chosen->{caption}";
}
else {
$val = $val ? "1" : "0";
}
say "using $name=$val";
}
}
say join " ", $self->gen_fuses_avrdude;
}
sub new
{
my $class = shift;
my %opts = @_;
my $data = YAML::LoadFile( $opts{yamlpath} );
my %regs;
( run in 1.664 second using v1.01-cache-2.11-cpan-d7a12ab2c7f )