Device-AVR-UPDI
view release on metacpan or search on metacpan
bin/avr-updi view on Meta::CPAN
m/^\s*(\w+)\s*=\s*(.*)\s*$/ and
$configvars{$1} = $2;
}
}
our $PORT
:GlobalOption("port|P=",
"Path to the device where the UPDI adapter is connected")
= join ",", grep { defined } $configvars{port}, "/dev/ttyUSB0";
if( $PORT =~ m/,/ ) {
my $chosen_port = first { -e $_ } map { glob $_ } split m/,/, $PORT;
defined $chosen_port or
die "Cannot find a UPDI port out of $PORT\n";
$PORT = $chosen_port;
}
our $PART
:GlobalOption("part|p=",
"Name of the ATmega or ATtiny chip that is expected");
our $BAUD
bin/avr-updi view on Meta::CPAN
}
check_signature;
my @FUSES = @{ $updi->partinfo->fusenames };
my $fuseinfo = $updi->fuseinfo;
my @values;
while( @$fuseargs ) {
my ( $name, $value ) = split m/=/, $fuseargs->[0] or last;
shift @$fuseargs;
if( $name =~ m/\./ ) {
my ( $regname, $fusename ) = $name =~ m/^(.*?)\.(.*)$/;
my $idx = first { defined $FUSES[$_] and $FUSES[$_] eq $regname } 0 .. $#FUSES;
defined $idx or die "Unrecognised fuse register $regname";
my $fuse = $fuseinfo->{fusemap}{$fusename} or
die "Unrecognised fuse $fusename";
$fuse->{reg} eq $regname or
lib/Device/AVR/UPDI.pm view on Meta::CPAN
field $size_eeprom;
field $fusenames;
}
my %partinfos;
{
while( readline DATA ) {
m/^#/ and next;
chomp;
my ( $name, $signature, @fields ) = split m/\|/, $_;
$signature = pack "H*", $signature;
my $fuses = [ map { length $_ ? $_ : undef } split m/,/, pop @fields ];
m/^0x/ and $_ = hex $_ for @fields;
my $partinfo = Device::AVR::UPDI::_PartInfo->new_values( $name, $signature, @fields, $fuses );
$partinfos{lc $name} = $partinfo;
$partinfos{"m$1"} = $partinfo if $name =~ m/^ATmega(.*)$/;
$partinfos{"t$1"} = $partinfo if $name =~ m/^ATtiny(.*)$/;
}
close DATA;
( run in 1.903 second using v1.01-cache-2.11-cpan-71847e10f99 )