mbed library sources. Supersedes mbed-src.

Dependents:   Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more

Revision:
180:96ed750bd169
Parent:
178:79309dc6340a
Child:
184:08ed48f1de7f
--- a/platform/CircularBuffer.h	Thu Dec 07 14:01:42 2017 +0000
+++ b/platform/CircularBuffer.h	Wed Jan 17 15:23:54 2018 +0000
@@ -109,6 +109,23 @@
         core_util_critical_section_exit();
     }
 
+    /** Get the number of elements currently stored in the circular_buffer */
+    CounterType size() const {
+        core_util_critical_section_enter();
+        CounterType elements;
+        if (!_full) {
+            if (_head < _tail) {
+                elements = BufferSize + _head - _tail;
+            } else {
+                elements = _head - _tail;
+            }
+        } else {
+            elements = BufferSize;
+        }
+        core_util_critical_section_exit();
+        return elements;
+    }
+    
 private:
     T _pool[BufferSize];
     volatile CounterType _head;