WebIO/Device/PWM.pm

filter: Statementstmt 100% 18 / 18 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod 0.0% 0 / 2 totaltotal 91.6% 22 / 24 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
pwm_max_int
1.0
CRAP 1.0
« WebIO/Device/DigitalInputCallback.pm ↑ Summary WebIO/Device/ADC.pm »
1 package Device::WebIO::Device::PWM;
2 2 $Device::WebIO::Device::PWM::VERSION = '0.022';
3 2 ▶use v5.12;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use Moo::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 2 with 'Device::WebIO::Device';
7  
8 2 requires 'pwm_bit_resolution';
9 2 requires 'pwm_pin_count';
10 2 requires 'pwm_output_int';
11  
12  
13 sub pwm_max_int
14 3 ▶{
Subroutine pwm_max_int: called CC=1 SCAR=0.0
Pod undocumented
15 3 my ($self, $pin) = @_;
16 3 my $resolution = $self->pwm_bit_resolution( $pin );
17 3 return 2 ** $resolution - 1;
18 }
19  
20 sub pwm_output_float
21 1 ▶{
Subroutine pwm_output_float: called CC=1 SCAR=0.0
Pod undocumented
22 1 my ($self, $pin, $out) = @_;
23 1 my $max_int = $self->pwm_max_int( $pin );
24 1 my $int_out = sprintf( '%.0f', $max_int * $out );
25 1 return $self->pwm_output_int( $pin, $int_out );
26 }
27  
28  
29 2 1;
30 __END__
« WebIO/Device/DigitalInputCallback.pm ↑ Summary WebIO/Device/ADC.pm »