DAC7513.pm

filter: Statementstmt 100% 27 / 27 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 8 / 8 Podpod 0.0% 0 / 1 totaltotal 97.2% 35 / 36 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« MAX1166x.pm ↑ Summary
1 # You may distribute under the terms of either the GNU General Public License
2 # or the Artistic License (the same terms as Perl itself)
3 #
4 # (C) Paul Evans, 2020-2023 -- leonerd@leonerd.org.uk
5  
6 2 ▶use v5.26;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 ▶use Object::Pad 0.800;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 package Device::Chip::DAC7513 0.16;
11 class Device::Chip::DAC7513
12 2 ▶ :isa(Device::Chip::DAC75xx);
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 2 ▶use Future::AsyncAwait;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 2 ▶use constant PROTOCOL => "SPI";
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 =encoding UTF-8
19  
20 =head1 NAME
21  
22 C<Device::Chip::DAC7513> - chip driver for F<DAC7513>
23  
24 =head1 SYNOPSIS
25  
26 use Device::Chip::DAC7513;
27 use Future::AsyncAwait;
28  
29 my $chip = Device::Chip::DAC7513->new;
30 await $chip->mount( Device::Chip::Adapter::...->new );
31  
32 # Presuming Vcc = 5V
33 await $chip->write_dac_ratio( 1.23 / 5 );
34 print "Output is now set to 1.23V\n";
35  
36 =head1 DESCRIPTION
37  
38 This L<Device::Chip> subclass provides specific communication to a
39 F<Texas Instruments> F<DAC7513> attached to a computer via an SPI adapter.
40  
41 The reader is presumed to be familiar with the general operation of this chip;
42 the documentation here will not attempt to explain or define chip-specific
43 concepts or features, only the use of this module to access them.
44  
45 This class is derived from L<Device::Chip::DAC75xx>, and inherits the methods
46 defined there.
47  
48 =cut
49  
50 1 ▶sub SPI_options ( $, %params )
Subroutine SPI_options: called CC=1 SCAR=0.0
Pod undocumented
51 {
52 return (
53 1 max_bitrate => 30E6,
54 );
55 }
56  
57 3 ▶async method _write ( $code )
Subroutine _write: called CC=1 SCAR=0.0
58 3 {
59 3 await $self->protocol->write( pack "S>", $code );
60 2 }
61  
62 =head1 AUTHOR
63  
64 Paul Evans <leonerd@leonerd.org.uk>
65  
66 =cut
67  
68 2 0x55AA;
« MAX1166x.pm ↑ Summary