Rework the ringbuffer class so that it's not templated, and refactor its clients so they aren't dancing around the linker anymore.

This commit is contained in:
px4dev
2013-09-12 00:53:08 +02:00
committed by Lorenz Meier
parent a5821d2928
commit cefc7ac00e
10 changed files with 396 additions and 266 deletions
+5 -5
View File
@@ -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);
}