aboutsummaryrefslogtreecommitdiff
path: root/src/drivers/hmc5883/hmc5883.cpp
diff options
context:
space:
mode:
authorpx4dev <px4@purgatory.org>2013-09-09 22:23:48 -0700
committerLorenz Meier <lm@inf.ethz.ch>2013-09-12 00:53:08 +0200
commitcefc7ac00e55ade983562a081c3ccda8030e95ce (patch)
treef2353bfb6714af357d509c3e99aa97588255f485 /src/drivers/hmc5883/hmc5883.cpp
parenta5821d29281243385363745d1725a6b3210f7f96 (diff)
downloadpx4-firmware-cefc7ac00e55ade983562a081c3ccda8030e95ce.tar.gz
px4-firmware-cefc7ac00e55ade983562a081c3ccda8030e95ce.tar.bz2
px4-firmware-cefc7ac00e55ade983562a081c3ccda8030e95ce.zip
Rework the ringbuffer class so that it's not templated, and refactor its clients so they aren't dancing around the linker anymore.
Diffstat (limited to 'src/drivers/hmc5883/hmc5883.cpp')
-rw-r--r--src/drivers/hmc5883/hmc5883.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/drivers/hmc5883/hmc5883.cpp b/src/drivers/hmc5883/hmc5883.cpp
index b838bf16b..58a1593ed 100644
--- a/src/drivers/hmc5883/hmc5883.cpp
+++ b/src/drivers/hmc5883/hmc5883.cpp
@@ -149,7 +149,7 @@ private:
work_s _work;
unsigned _measure_ticks;
- RingBuffer<struct mag_report> *_reports;
+ RingBuffer *_reports;
mag_scale _scale;
float _range_scale;
float _range_ga;
@@ -367,7 +367,7 @@ HMC5883::init()
goto out;
/* allocate basic report buffers */
- _reports = new RingBuffer<struct mag_report>(2);
+ _reports = new RingBuffer(2, sizeof(mag_report));
if (_reports == nullptr)
goto out;
@@ -496,7 +496,7 @@ HMC5883::read(struct file *filp, char *buffer, size_t buflen)
* we are careful to avoid racing with them.
*/
while (count--) {
- if (_reports->get(*mag_buf)) {
+ if (_reports->get(mag_buf)) {
ret += sizeof(struct mag_report);
mag_buf++;
}
@@ -526,7 +526,7 @@ HMC5883::read(struct file *filp, char *buffer, size_t buflen)
break;
}
- if (_reports->get(*mag_buf)) {
+ if (_reports->get(mag_buf)) {
ret = sizeof(struct mag_report);
}
} while (0);
@@ -878,7 +878,7 @@ HMC5883::collect()
orb_publish(ORB_ID(sensor_mag), _mag_topic, &new_report);
/* post a report to the ring */
- if (_reports->force(new_report)) {
+ if (_reports->force(&new_report)) {
perf_count(_buffer_overflows);
}