diff options
author | px4dev <px4@purgatory.org> | 2013-09-09 22:23:48 -0700 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2013-09-12 00:53:08 +0200 |
commit | cefc7ac00e55ade983562a081c3ccda8030e95ce (patch) | |
tree | f2353bfb6714af357d509c3e99aa97588255f485 /src/drivers/mb12xx/mb12xx.cpp | |
parent | a5821d29281243385363745d1725a6b3210f7f96 (diff) | |
download | px4-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/mb12xx/mb12xx.cpp')
-rw-r--r-- | src/drivers/mb12xx/mb12xx.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/drivers/mb12xx/mb12xx.cpp b/src/drivers/mb12xx/mb12xx.cpp index fabe10b87..ccc5bc15e 100644 --- a/src/drivers/mb12xx/mb12xx.cpp +++ b/src/drivers/mb12xx/mb12xx.cpp @@ -120,7 +120,7 @@ private: float _min_distance; float _max_distance; work_s _work; - RingBuffer<struct range_finder_report> *_reports; + RingBuffer *_reports; bool _sensor_ok; int _measure_ticks; bool _collect_phase; @@ -226,7 +226,7 @@ MB12XX::init() goto out; /* allocate basic report buffers */ - _reports = new RingBuffer<struct range_finder_report>(2); + _reports = new RingBuffer(2, sizeof(range_finder_report)); if (_reports == nullptr) goto out; @@ -403,7 +403,7 @@ MB12XX::read(struct file *filp, char *buffer, size_t buflen) * we are careful to avoid racing with them. */ while (count--) { - if (_reports->get(*rbuf)) { + if (_reports->get(rbuf)) { ret += sizeof(*rbuf); rbuf++; } @@ -433,7 +433,7 @@ MB12XX::read(struct file *filp, char *buffer, size_t buflen) } /* state machine will have generated a report, copy it out */ - if (_reports->get(*rbuf)) { + if (_reports->get(rbuf)) { ret = sizeof(*rbuf); } @@ -496,7 +496,7 @@ MB12XX::collect() /* publish it */ orb_publish(ORB_ID(sensor_range_finder), _range_finder_topic, &report); - if (_reports->force(report)) { + if (_reports->force(&report)) { perf_count(_buffer_overflows); } |