| 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
| |||||||||||
| 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
| |||||||||||
| 17 | 2 | foreach (keys %{$self->chip_config->{on_off}}) { | |||||||||
| 18 | 14 | ▶ | $self->chip_config->{on_off}->{$_} = 1 if $_ =~ /PWRTE|WDT/; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 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__ | ||||||||||