upm  1.7.1
Sensor/Actuator repository for libmraa (v2.0.0)
hmc5883l.hpp
1 /*
2  * Author: Jon Trulson <jtrulson@ics.com>
3  * Copyright (c) 2017 Intel Corporation.
4  *
5  * Ported based on original C++ code by:
6  * Author: Brendan Le Foll <brendan.le.foll@intel.com>
7  * Contributions: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
8  * Copyright (c) 2014 Intel Corporation.
9  *
10  * Permission is hereby granted, free of charge, to any person obtaining
11  * a copy of this software and associated documentation files (the
12  * "Software"), to deal in the Software without restriction, including
13  * without limitation the rights to use, copy, modify, merge, publish,
14  * distribute, sublicense, and/or sell copies of the Software, and to
15  * permit persons to whom the Software is furnished to do so, subject to
16  * the following conditions:
17  *
18  * The above copyright notice and this permission notice shall be
19  * included in all copies or substantial portions of the Software.
20  *
21  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
25  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
27  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28  */
29 #pragma once
30 
31 #include "hmc5883l.h"
32 
33 namespace upm {
34 
63 class Hmc5883l {
64  public:
71  Hmc5883l(int bus);
72 
73  /*
74  * Returns the direction
75  */
76  float direction();
77 
78  /*
79  * Returns the heading
80  */
81  float heading();
82 
88  const int16_t* coordinates();
89 
95  upm_result_t update();
96 
100  void set_declination(float dec);
101 
107  float get_declination();
108 
109  protected:
110  hmc5883l_context m_hmc5883l;
111 
112  private:
113 };
114 }
void set_declination(float dec)
Definition: hmc5883l.cxx:73
Definition: hmc5883l.h:52
const int16_t * coordinates()
Definition: hmc5883l.cxx:68
upm_result_t update()
Definition: hmc5883l.cxx:47
C++ API wrapper for the bh1749 driver.
Definition: a110x.hpp:29
API for the HMC5883L 3-Axis Digital Compass.
Definition: hmc5883l.hpp:63
Hmc5883l(int bus)
Definition: hmc5883l.cxx:39
HMC5883L 3-Axis Digital Compass.
float get_declination()
Definition: hmc5883l.cxx:78