File Coverage

blib/lib/Device/LSM303DLHC.pm
Criterion Covered Total %
statement 24 30 80.0
branch n/a
condition n/a
subroutine 8 10 80.0
pod n/a
total 32 40 80.0


line stmt bran cond sub pod time code
1 1     1   22421 use strict;
  1         2  
  1         34  
2 1     1   3 use warnings;
  1         2  
  1         44  
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) 2015 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.013'; # VERSION
17              
18             # Dependencies
19 1     1   18 use 5.010;
  1         2  
  1         28  
20 1     1   557 use Moose;
  1         318065  
  1         7  
21 1     1   4972 use POSIX;
  1         3892  
  1         8  
22              
23 1     1   1979 use Device::SMBus;
  1         17154  
  1         30  
24 1     1   333 use Device::Magnetometer::LSM303DLHC;
  1         2  
  1         29  
25 1     1   364 use Device::Accelerometer::LSM303DLHC;
  1         3  
  1         133  
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             =head1 VERSION
74              
75             version 0.013
76              
77             =head1 ATTRIBUTES
78              
79             =head2 I2CBusDevicePath
80              
81             this is the device file path for your I2CBus that the LSM303DLHC is connected on e.g. /dev/i2c-1
82             This must be provided during object creation.
83              
84             =head2 Magnetometer
85              
86             $self->Magnetometer->enable();
87             $self->Magnetometer->getReading();
88              
89             This is a object of L<Device::Magnetometer::LSM303DLHC>
90              
91             =head2 Accelerometer
92              
93             $self->Accelerometer->enable();
94             $self->Accelerometer->getReading();
95              
96             This is a object of L<Device::Accelerometer::LSM303DLHC>
97              
98             =for :stopwords cpan testmatrix url annocpan anno bugtracker rt cpants kwalitee diff irc mailto metadata placeholders metacpan
99              
100             =head1 SUPPORT
101              
102             =head2 Bugs / Feature Requests
103              
104             Please report any bugs or feature requests through github at
105             L<https://github.com/shantanubhadoria/perl-device-lsm303dlhc/issues>.
106             You will be notified automatically of any progress on your issue.
107              
108             =head2 Source Code
109              
110             This is open source software. The code repository is available for
111             public review and contribution under the terms of the license.
112              
113             L<https://github.com/shantanubhadoria/perl-device-lsm303dlhc>
114              
115             git clone git://github.com/shantanubhadoria/perl-device-lsm303dlhc.git
116              
117             =head1 AUTHOR
118              
119             Shantanu Bhadoria <shantanu at cpan dott org>
120              
121             =head1 CONTRIBUTORS
122              
123             =for stopwords Shantanu Bhadoria
124              
125             =over 4
126              
127             =item *
128              
129             Shantanu <shantanu@cpan.org>
130              
131             =item *
132              
133             Shantanu Bhadoria <shantanu@cpan.org>
134              
135             =back
136              
137             =head1 COPYRIGHT AND LICENSE
138              
139             This software is copyright (c) 2015 by Shantanu Bhadoria.
140              
141             This is free software; you can redistribute it and/or modify it under
142             the same terms as the Perl 5 programming language system itself.
143              
144             =cut