Переглянути джерело

doxygen: add basic doxygen documentation for upm

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
Brendan Le Foll 10 роки тому
джерело
коміт
21991e3598
5 змінених файлів з 2405 додано та 22 видалено
  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 Переглянути файл

@@ -7,8 +7,20 @@ include (${SWIG_USE_FILE})
7 7
 
8 8
 find_package (PkgConfig REQUIRED)
9 9
 pkg_check_modules (MAA maa>=0.2.1)
10
+message (INFO " found libmaa version: ${MAA_VERSION}")
10 11
 
11 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 25
 add_subdirectory (src)
14 26
 add_subdirectory (examples)

+ 2354
- 0
Doxyfile.in
Різницю між файлами не показано, бо вона завелика
Переглянути файл


README → README.md Переглянути файл

@@ -1,4 +1,5 @@
1 1
 UPM - Sensor/Actuator repository for Maa
2
+==============
2 3
 
3 4
 UPM is a high level repository for sensors that use maa. Each sensor links to
4 5
 libmaa and are not meant to be interlinked although some groups of sensors may
@@ -22,4 +23,4 @@ However implementation and API design is compeltely up to the developer, some
22 23
 enumerable sensors for example may provide much clever instanciation. Displays
23 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 Переглянути файл

@@ -79,17 +79,17 @@ using namespace upm;
79 79
 
80 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 94
     Hmc5883l::update();
95 95
 }
@@ -97,18 +97,18 @@ Hmc5883l::Hmc5883l()
97 97
 int
98 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 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 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 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 113
     return MAA_SUCCESS;
114 114
 }
@@ -116,7 +116,7 @@ Hmc5883l::update(void)
116 116
 float
117 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 122
 float
@@ -128,5 +128,5 @@ Hmc5883l::heading(void)
128 128
 int*
129 129
 Hmc5883l::coordinates(void)
130 130
 {
131
-    return &coor[0];
131
+    return &m_coor[0];
132 132
 }

+ 19
- 3
src/hmc5883l/hmc5883l.h Переглянути файл

@@ -31,15 +31,31 @@ namespace upm {
31 31
 
32 32
 class Hmc5883l {
33 33
 public:
34
+    /// Creates a Hmc5883l object
34 35
     Hmc5883l();
36
+
37
+    /// Returns the direction
35 38
     float direction();
39
+
40
+    /// Returns the heading
36 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 47
     int* coordinates();
48
+
49
+    /**
50
+     * Updates the values by reading from i2c
51
+     * 
52
+     * @return 0 for success
53
+     */
38 54
     int update();
39 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
 }