aboutsummaryrefslogtreecommitdiff
path: root/apps/drivers/hmc5883/hmc5883.cpp
diff options
context:
space:
mode:
authorpx4dev <px4@purgatory.org>2012-10-27 11:34:20 -0700
committerpx4dev <px4@purgatory.org>2012-10-27 11:34:20 -0700
commit6cec7f131ea9f68bd750d462333543f451bc4405 (patch)
tree6c536693550b51176bb948d79a81aa1b1244277b /apps/drivers/hmc5883/hmc5883.cpp
parent5135e5308b5689794b0497ed6be103d1bc332b7b (diff)
downloadpx4-firmware-6cec7f131ea9f68bd750d462333543f451bc4405.tar.gz
px4-firmware-6cec7f131ea9f68bd750d462333543f451bc4405.tar.bz2
px4-firmware-6cec7f131ea9f68bd750d462333543f451bc4405.zip
Minor board.h changes.
Diffstat (limited to 'apps/drivers/hmc5883/hmc5883.cpp')
-rw-r--r--apps/drivers/hmc5883/hmc5883.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/apps/drivers/hmc5883/hmc5883.cpp b/apps/drivers/hmc5883/hmc5883.cpp
index 7943012cc..f9079c3ff 100644
--- a/apps/drivers/hmc5883/hmc5883.cpp
+++ b/apps/drivers/hmc5883/hmc5883.cpp
@@ -58,17 +58,21 @@
#include <nuttx/wqueue.h>
#include <nuttx/clock.h>
-#include <drivers/drv_hrt.h>
+#include <arch/board/board.h>
#include <systemlib/perf_counter.h>
#include <systemlib/err.h>
#include <drivers/drv_mag.h>
+#include <drivers/drv_hrt.h>
/*
* HMC5883 internal constants and data structures.
*/
+#define HMC5883L_BUS PX4_I2C_BUS_ONBOARD
+#define HMC5883L_ADDRESS PX4_I2C_OBDEV_HMC5883
+
/* Max measurement rate is 160Hz */
#define HMC5883_CONVERSION_INTERVAL (1000000 / 160) /* microseconds */
@@ -86,8 +90,6 @@
#define ADDR_ID_B 0x0b
#define ADDR_ID_C 0x0c
-#define HMC5883L_ADDRESS 0x1E
-
/* modes not changeable outside of driver */
#define HMC5883L_MODE_NORMAL (0 << 0) /* default */
#define HMC5883L_MODE_POSITIVE_BIAS (1 << 0) /* positive bias */
@@ -1100,8 +1102,7 @@ start()
errx(1, "already started");
/* create the driver */
- /* XXX HORRIBLE hack - the bus number should not come from here */
- g_dev = new HMC5883(2);
+ g_dev = new HMC5883(HMC5883L_BUS);
if (g_dev == nullptr)
goto fail;