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.
Diff: recordsMaster/recordsMaster.cpp
- Revision:
- 2:e2b885367ba8
- Child:
- 5:becb1545229d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/recordsMaster/recordsMaster.cpp Wed Dec 27 15:28:20 2017 +0000
@@ -0,0 +1,38 @@
+#include "mbed.h"
+#include <iostream>
+#include "recordsMaster.hpp"
+
+circularBuffer::circularBuffer()
+{
+
+ if (sizeof(record)/sizeof(TDS_record) == 120) {
+ readPointer = 0;
+ writePointer = record; // N.B. This is not an instance variable
+ clog <<"Buffer aquired\n\r\n"<<endl;
+ } else {
+ cerr << "Could not aquire buffer - bad length\n\r" << endl;
+ cerr << "Attempted to aquire buffer of length 120\n\r" << endl;
+ cerr << "Got buffer of " << sizeof(record)/sizeof(TDS_record) << "\n\r\n" << endl;
+ }
+}
+
+// circularBuffer::write()
+
+TDS_record circularBuffer::read(int index)
+{
+ // add code so you can not read more than is written
+ return record[index];
+}
+
+
+
+//int circularBuffer::del(number)
+//int circularBuffer::readAll()
+//int circularBuffer::delAll()
+
+circularBuffer::~circularBuffer()
+{
+ readPointer = 0;
+ writePointer = 0;
+ cerr << "Buffer Destroyed\n\r\n" << endl;
+}
\ No newline at end of file