Browse Source

doxygen: add basic doxygen documentation for upm

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
Brendan Le Foll 10 years ago
parent
commit
21991e3598
5 changed files with 2405 additions and 22 deletions
  1. 12
    0
      CMakeLists.txt
  2. 2354
    0
      Doxyfile.in
  3. 2
    1
      README.md
  4. 18
    18
      src/hmc5883l/hmc5883l.cxx
  5. 19
    3
      src/hmc5883l/hmc5883l.h

+ 12
- 0
CMakeLists.txt View File

7
 
7
 
8
 find_package (PkgConfig REQUIRED)
8
 find_package (PkgConfig REQUIRED)
9
 pkg_check_modules (MAA maa>=0.2.1)
9
 pkg_check_modules (MAA maa>=0.2.1)
10
+message (INFO " found libmaa version: ${MAA_VERSION}")
10
 
11
 
11
 set (CMAKE_SWIG_FLAGS "")
12
 set (CMAKE_SWIG_FLAGS "")
12
 
13
 
14
+# add a target to generate API documentation with Doxygen
15
+find_package (Doxygen)
16
+if (DOXYGEN_FOUND)
17
+  configure_file (${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
18
+  add_custom_target (doc
19
+    ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
20
+    WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
21
+    COMMENT "Generating API documentation with Doxygen" VERBATIM
22
+  )
23
+endif (DOXYGEN_FOUND)
24
+
13
 add_subdirectory (src)
25
 add_subdirectory (src)
14
 add_subdirectory (examples)
26
 add_subdirectory (examples)

+ 2354
- 0
Doxyfile.in
File diff suppressed because it is too large
View File


README → README.md View File

1
 UPM - Sensor/Actuator repository for Maa
1
 UPM - Sensor/Actuator repository for Maa
2
+==============
2
 
3
 
3
 UPM is a high level repository for sensors that use maa. Each sensor links to
4
 UPM is a high level repository for sensors that use maa. Each sensor links to
4
 libmaa and are not meant to be interlinked although some groups of sensors may
5
 libmaa and are not meant to be interlinked although some groups of sensors may
22
 enumerable sensors for example may provide much clever instanciation. Displays
23
 enumerable sensors for example may provide much clever instanciation. Displays
23
 may also create more complex structures in order to interface with them.
24
 may also create more complex structures in order to interface with them.
24
 
25
 
25
-For more information on maa, see the maa README
26
+For more information on maa, see the maa documentation

+ 18
- 18
src/hmc5883l/hmc5883l.cxx View File

79
 
79
 
80
 Hmc5883l::Hmc5883l()
80
 Hmc5883l::Hmc5883l()
81
 {
81
 {
82
-    i2c = maa_i2c_init();
82
+    m_i2c = maa_i2c_init();
83
 
83
 
84
-    maa_i2c_address(i2c, HMC5883L_I2C_ADDR);
85
-    rx_tx_buf[0] = HMC5883L_CONF_REG_B;
86
-    rx_tx_buf[1] = GA_1_3_REG;
87
-    maa_i2c_write(i2c, rx_tx_buf, 2);
84
+    maa_i2c_address(m_i2c, HMC5883L_I2C_ADDR);
85
+    m_rx_tx_buf[0] = HMC5883L_CONF_REG_B;
86
+    m_rx_tx_buf[1] = GA_1_3_REG;
87
+    maa_i2c_write(m_i2c, m_rx_tx_buf, 2);
88
 
88
 
89
-    maa_i2c_address(i2c, HMC5883L_I2C_ADDR);
90
-    rx_tx_buf[0] = HMC5883L_MODE_REG;
91
-    rx_tx_buf[1] = HMC5883L_CONT_MODE;
92
-    maa_i2c_write(i2c, rx_tx_buf, 2);
89
+    maa_i2c_address(m_i2c, HMC5883L_I2C_ADDR);
90
+    m_rx_tx_buf[0] = HMC5883L_MODE_REG;
91
+    m_rx_tx_buf[1] = HMC5883L_CONT_MODE;
92
+    maa_i2c_write(m_i2c, m_rx_tx_buf, 2);
93
 
93
 
94
     Hmc5883l::update();
94
     Hmc5883l::update();
95
 }
95
 }
97
 int
97
 int
98
 Hmc5883l::update(void)
98
 Hmc5883l::update(void)
99
 {
99
 {
100
-    maa_i2c_address(i2c, HMC5883L_I2C_ADDR);
101
-    maa_i2c_write_byte(i2c, HMC5883L_DATA_REG);
100
+    maa_i2c_address(m_i2c, HMC5883L_I2C_ADDR);
101
+    maa_i2c_write_byte(m_i2c, HMC5883L_DATA_REG);
102
 
102
 
103
-    maa_i2c_address(i2c, HMC5883L_I2C_ADDR);
104
-    maa_i2c_read(i2c, rx_tx_buf, DATA_REG_SIZE);
103
+    maa_i2c_address(m_i2c, HMC5883L_I2C_ADDR);
104
+    maa_i2c_read(m_i2c, m_rx_tx_buf, DATA_REG_SIZE);
105
 
105
 
106
     // x
106
     // x
107
-    coor[0] = (rx_tx_buf[HMC5883L_X_MSB_REG] << 8 ) | rx_tx_buf[HMC5883L_X_LSB_REG] ;
107
+    m_coor[0] = (m_rx_tx_buf[HMC5883L_X_MSB_REG] << 8 ) | m_rx_tx_buf[HMC5883L_X_LSB_REG];
108
     // z
108
     // z
109
-    coor[2] = (rx_tx_buf[HMC5883L_Z_MSB_REG] << 8 ) | rx_tx_buf[HMC5883L_Z_LSB_REG] ;
109
+    m_coor[2] = (m_rx_tx_buf[HMC5883L_Z_MSB_REG] << 8 ) | m_rx_tx_buf[HMC5883L_Z_LSB_REG];
110
     // y
110
     // y
111
-    coor[1] = (rx_tx_buf[HMC5883L_Y_MSB_REG] << 8 ) | rx_tx_buf[HMC5883L_Y_LSB_REG] ;
111
+    m_coor[1] = (m_rx_tx_buf[HMC5883L_Y_MSB_REG] << 8 ) | m_rx_tx_buf[HMC5883L_Y_LSB_REG];
112
 
112
 
113
     return MAA_SUCCESS;
113
     return MAA_SUCCESS;
114
 }
114
 }
116
 float
116
 float
117
 Hmc5883l::direction(void)
117
 Hmc5883l::direction(void)
118
 {
118
 {
119
-    return atan2(coor[1] * SCALE_0_92_MG, coor[0] * SCALE_0_92_MG);
119
+    return atan2(m_coor[1] * SCALE_0_92_MG, m_coor[0] * SCALE_0_92_MG);
120
 }
120
 }
121
 
121
 
122
 float
122
 float
128
 int*
128
 int*
129
 Hmc5883l::coordinates(void)
129
 Hmc5883l::coordinates(void)
130
 {
130
 {
131
-    return &coor[0];
131
+    return &m_coor[0];
132
 }
132
 }

+ 19
- 3
src/hmc5883l/hmc5883l.h View File

31
 
31
 
32
 class Hmc5883l {
32
 class Hmc5883l {
33
 public:
33
 public:
34
+    /// Creates a Hmc5883l object
34
     Hmc5883l();
35
     Hmc5883l();
36
+
37
+    /// Returns the direction
35
     float direction();
38
     float direction();
39
+
40
+    /// Returns the heading
36
     float heading();
41
     float heading();
42
+
43
+    /**
44
+     * Returns a pointer to an int[3] that contains the coordinates as ints
45
+     * @return *int to an int[3]
46
+     */
37
     int* coordinates();
47
     int* coordinates();
48
+
49
+    /**
50
+     * Updates the values by reading from i2c
51
+     * 
52
+     * @return 0 for success
53
+     */
38
     int update();
54
     int update();
39
 private:
55
 private:
40
-    int coor[3];
41
-    char rx_tx_buf[MAX_BUFFER_LENGTH];
42
-    maa_i2c_context* i2c;
56
+    int m_coor[3];
57
+    char m_rx_tx_buf[MAX_BUFFER_LENGTH];
58
+    maa_i2c_context* m_i2c;
43
 };
59
 };
44
 
60
 
45
 }
61
 }