File Coverage

blib/lib/Device/LSM303DLHC.pm
Criterion Covered Total %
statement 23 29 79.3
branch n/a
condition n/a
subroutine 8 10 80.0
pod n/a
total 31 39 79.4


line stmt bran cond sub pod time code
1 1     1   13273 use strict;
  1         2  
  1         26  
2 1     1   3 use warnings;
  1         1  
  1         47  
3              
4             package Device::LSM303DLHC;
5              
6             # PODNAME: Device::LSM303DLHC
7             # ABSTRACT: I2C interface to LSM303DLHC 3 axis magnetometer(compass) and accelerometer using Device::SMBus
8             #
9             # This file is part of Device-LSM303DLHC
10             #
11             # This software is copyright (c) 2016 by Shantanu Bhadoria.
12             #
13             # This is free software; you can redistribute it and/or modify it under
14             # the same terms as the Perl 5 programming language system itself.
15             #
16             our $VERSION = '0.014'; # VERSION
17              
18             # Dependencies
19 1     1   16 use 5.010;
  1         2  
20 1     1   452 use Moose;
  1         311557  
  1         6  
21 1     1   5220 use POSIX;
  1         4510  
  1         5  
22              
23 1     1   2270 use Device::SMBus;
  1         32425  
  1         32  
24 1     1   372 use Device::Magnetometer::LSM303DLHC;
  1         3  
  1         34  
25 1     1   377 use Device::Accelerometer::LSM303DLHC;
  1         3  
  1         148  
26              
27              
28             has 'I2CBusDevicePath' => (
29             is => 'ro',
30             required => 1,
31             );
32              
33              
34             has Magnetometer => (
35             is => 'ro',
36             isa => 'Device::Magnetometer::LSM303DLHC',
37             lazy_build => 1,
38             );
39              
40             sub _build_Magnetometer {
41 0     0     my ($self) = @_;
42 0           my $obj =
43             Device::Magnetometer::LSM303DLHC->new(
44             I2CBusDevicePath => $self->I2CBusDevicePath );
45 0           return $obj;
46             }
47              
48              
49             has Accelerometer => (
50             is => 'ro',
51             isa => 'Device::Accelerometer::LSM303DLHC',
52             lazy_build => 1,
53             );
54              
55             sub _build_Accelerometer {
56 0     0     my ($self) = @_;
57 0           my $obj =
58             Device::Accelerometer::LSM303DLHC->new(
59             I2CBusDevicePath => $self->I2CBusDevicePath );
60 0           return $obj;
61             }
62              
63             1;
64              
65             __END__
66              
67             =pod
68              
69             =head1 NAME
70              
71             Device::LSM303DLHC - I2C interface to LSM303DLHC 3 axis magnetometer(compass) and accelerometer using Device::SMBus
72              
73              
74              
75             =begin html
76              
77             <p>
78             <img src="https://img.shields.io/badge/perl-5.10+-brightgreen.svg" alt="Requires Perl 5.10+" />
79             <a href="https://travis-ci.org/shantanubhadoria/perl-Device-LSM303DLHC"><img src="https://api.travis-ci.org/shantanubhadoria/perl-Device-LSM303DLHC.svg?branch=build/master" alt="Travis status" /></a>
80             <a href="http://matrix.cpantesters.org/?dist=Device-LSM303DLHC%200.014"><img src="https://badgedepot.code301.com/badge/cpantesters/Device-LSM303DLHC/0.014" alt="CPAN Testers result" /></a>
81             <a href="http://cpants.cpanauthors.org/dist/Device-LSM303DLHC-0.014"><img src="https://badgedepot.code301.com/badge/kwalitee/Device-LSM303DLHC/0.014" alt="Distribution kwalitee" /></a>
82             <a href="https://gratipay.com/shantanubhadoria"><img src="https://img.shields.io/gratipay/shantanubhadoria.svg" alt="Gratipay" /></a>
83             </p>
84              
85             =end html
86              
87             =head1 VERSION
88              
89             version 0.014
90              
91             =head1 ATTRIBUTES
92              
93             =head2 I2CBusDevicePath
94              
95             this is the device file path for your I2CBus that the LSM303DLHC is connected on e.g. /dev/i2c-1
96             This must be provided during object creation.
97              
98             =head2 Magnetometer
99              
100             $self->Magnetometer->enable();
101             $self->Magnetometer->getReading();
102              
103             This is a object of L<Device::Magnetometer::LSM303DLHC>
104              
105             =head2 Accelerometer
106              
107             $self->Accelerometer->enable();
108             $self->Accelerometer->getReading();
109              
110             This is a object of L<Device::Accelerometer::LSM303DLHC>
111              
112             =for :stopwords cpan testmatrix url annocpan anno bugtracker rt cpants kwalitee diff irc mailto metadata placeholders metacpan
113              
114             =head1 SUPPORT
115              
116             =head2 Bugs / Feature Requests
117              
118             Please report any bugs or feature requests through github at
119             L<https://github.com/shantanubhadoria/perl-device-lsm303dlhc/issues>.
120             You will be notified automatically of any progress on your issue.
121              
122             =head2 Source Code
123              
124             This is open source software. The code repository is available for
125             public review and contribution under the terms of the license.
126              
127             L<https://github.com/shantanubhadoria/perl-device-lsm303dlhc>
128              
129             git clone git://github.com/shantanubhadoria/perl-device-lsm303dlhc.git
130              
131             =head1 AUTHOR
132              
133             Shantanu Bhadoria <shantanu at cpan dott org>
134              
135             =head1 CONTRIBUTOR
136              
137             =for stopwords Shantanu
138              
139             Shantanu <shantanu@cpan.org>
140              
141             =head1 COPYRIGHT AND LICENSE
142              
143             This software is copyright (c) 2016 by Shantanu Bhadoria.
144              
145             This is free software; you can redistribute it and/or modify it under
146             the same terms as the Perl 5 programming language system itself.
147              
148             =cut