Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
CircularBuffer.cpp
00001 #include "CircularBuffer.h" 00002 00003 #include <algorithm> 00004 #include <math.h> 00005 00006 CircularBuffer::CircularBuffer(int size) : size(size) { 00007 } 00008 00009 void CircularBuffer::push_back(float v) { 00010 values.push_back(v); 00011 } 00012 00013 bool isFirstGreater(float x, float y) { 00014 return x > y; 00015 } 00016 00017 float CircularBuffer::median() { 00018 std::sort(values.begin(), values.end(), isFirstGreater); 00019 return values[floor((float)values.size()/2)]; 00020 } 00021
Generated on Sat Jul 16 2022 02:23:26 by
1.7.2