line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package VIC::PIC::Functions::Power; |
2
|
31
|
|
|
31
|
|
14625
|
use strict; |
|
31
|
|
|
|
|
42
|
|
|
31
|
|
|
|
|
712
|
|
3
|
31
|
|
|
31
|
|
108
|
use warnings; |
|
31
|
|
|
|
|
35
|
|
|
31
|
|
|
|
|
1225
|
|
4
|
|
|
|
|
|
|
our $VERSION = '0.29'; |
5
|
|
|
|
|
|
|
$VERSION = eval $VERSION; |
6
|
31
|
|
|
31
|
|
107
|
use Carp; |
|
31
|
|
|
|
|
36
|
|
|
31
|
|
|
|
|
1316
|
|
7
|
31
|
|
|
31
|
|
120
|
use POSIX (); |
|
31
|
|
|
|
|
36
|
|
|
31
|
|
|
|
|
382
|
|
8
|
31
|
|
|
31
|
|
126
|
use Moo::Role; |
|
31
|
|
|
|
|
34
|
|
|
31
|
|
|
|
|
143
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub sleep { |
11
|
2
|
|
|
2
|
0
|
13
|
my $self = shift; |
12
|
2
|
50
|
|
|
|
6
|
unless ($self->doesrole('Power')) { |
13
|
0
|
|
|
|
|
0
|
carp $self->type . " does not support sleep\n"; |
14
|
0
|
|
|
|
|
0
|
return; |
15
|
|
|
|
|
|
|
} |
16
|
2
|
50
|
|
|
|
9
|
if (defined $self->chip_config->{on_off}) { |
17
|
2
|
|
|
|
|
3
|
foreach (keys %{$self->chip_config->{on_off}}) { |
|
2
|
|
|
|
|
13
|
|
18
|
14
|
100
|
|
|
|
39
|
$self->chip_config->{on_off}->{$_} = 1 if $_ =~ /PWRTE|WDT/; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
# best to clear the WDT before sleep always |
22
|
2
|
|
|
|
|
5
|
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
|
|
|
|
|
|
|
1; |
30
|
|
|
|
|
|
|
__END__ |