hmc5883l: improve documentation and sample

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
Brendan Le Foll 2014-09-07 15:20:04 +01:00
parent 88bf6956fe
commit 0ef50b8be2
4 changed files with 10 additions and 5 deletions

BIN
docs/images/hmc5883l.jpeg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

View File

@ -1,4 +1,4 @@
add_executable (compass compass.cxx) add_executable (hmc5883l-example hmc5883l.cxx)
add_executable (groveled groveled.cxx) add_executable (groveled groveled.cxx)
add_executable (grovetemp grovetemp.cxx) add_executable (grovetemp grovetemp.cxx)
add_executable (lcm-lcd lcm-lcd.cxx) add_executable (lcm-lcd lcm-lcd.cxx)
@ -67,7 +67,7 @@ include_directories (${PROJECT_SOURCE_DIR}/src/tcs3414cs)
include_directories (${PROJECT_SOURCE_DIR}/src/th02) include_directories (${PROJECT_SOURCE_DIR}/src/th02)
include_directories (${PROJECT_SOURCE_DIR}/src/lsm303) include_directories (${PROJECT_SOURCE_DIR}/src/lsm303)
target_link_libraries (compass hmc5883l ${CMAKE_THREAD_LIBS_INIT}) target_link_libraries (hmc5883l-example hmc5883l ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries (groveled grove ${CMAKE_THREAD_LIBS_INIT}) target_link_libraries (groveled grove ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries (grovetemp grove ${CMAKE_THREAD_LIBS_INIT}) target_link_libraries (grovetemp grove ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries (lcm-lcd i2clcd ${CMAKE_THREAD_LIBS_INIT}) target_link_libraries (lcm-lcd i2clcd ${CMAKE_THREAD_LIBS_INIT})

View File

@ -27,9 +27,10 @@
int int
main(int argc, char **argv) main(int argc, char **argv)
{ {
// Use i2c device 0 all the time //! [Interesting]
upm::Hmc5883l* compass = new upm::Hmc5883l(0); upm::Hmc5883l* compass = new upm::Hmc5883l(0);
fprintf(stdout, "heading: %f\n", compass->heading()); fprintf(stdout, "heading: %f\n", compass->heading());
//! [Interesting]
return 0; return 0;
} }

View File

@ -32,10 +32,14 @@ namespace upm {
/** /**
* @brief C++ API for HMC5883l (3-axis digital compass) * @brief C++ API for HMC5883l (3-axis digital compass)
* *
* This file defines the HMC5883l C++ interface for libhmc5883l * The Honeywell [HMC5883L]
* (http://www.adafruit.com/datasheets/HMC5883L_3-Axis_Digital_Compass_IC.pdf)
* is a 3-axis digital compass. Communication with the HMC5883L is simple and
* all done through an I2C interface. Different breakout boards are available,
* typically a 3V supply is all that is needed to power the sensor.
* *
* @snippet hmc5883l.cxx Interesting * @snippet hmc5883l.cxx Interesting
* * @image html hmc5883l.jpeg
*/ */
class Hmc5883l { class Hmc5883l {