VIC/PIC/Functions/Power.pm

filter: Statementstmt 92.5% 25 / 27 Branchbran 66.6% 4 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 1 totaltotal 87.5% 35 / 40 CC 5 SCAR 11.7
CC
5
Cov
88%
sleep
5.5
BEGIN
1.0
BEGIN
1.0
CRAP 3.2
« VIC/PIC/Any.pm ↑ Summary VIC/PIC/P18F442.pm »
1 package VIC::PIC::Functions::Power;
2 31 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 31 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 31 our $VERSION = '0.32';
5 31 $VERSION = eval $VERSION;
6 31 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 31 ▶use POSIX ();
Subroutine BEGIN: called CC=1 SCAR=0.0
8 31 ▶use Moo::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 2 ▶sub sleep {
Subroutine sleep: called CC=5 SCAR=17.0
Pod undocumented
11 2 my $self = shift;
12 2 ▶ unless ($self->doesrole('Power')) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->doesrole("Power")) 0 2 2
13 0 carp $self->type . " does not support sleep\n";
14 0 return;
15 }
16 2 ▶ if (defined $self->chip_config->{on_off}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->chip_config->{"on_off"}) 2 0 2
17 2 foreach (keys %{$self->chip_config->{on_off}}) {
18 14 ▶ $self->chip_config->{on_off}->{$_} = 1 if $_ =~ /PWRTE|WDT/;
Branch: 1 branch
BranchTrueFalseTotal
if $_ =~ /PWRTE|WDT/ 4 10 14
19 }
20 }
21 # best to clear the WDT before sleep always
22 2 return << "...";
23 \tclrwdt ;; ensure WDT is cleared
24 \tsleep
25 \tnop ;; in case the user is using interrupts to wake up
26 ...
27 }
28  
29 31 1;
30 __END__
« VIC/PIC/Any.pm ↑ Summary VIC/PIC/P18F442.pm »