fuck this

Dependencies:   BMP280

Revision:
20:25939e03b803
Child:
21:6e733076f49c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Logging.h	Tue Jan 09 11:53:11 2018 +0000
@@ -0,0 +1,48 @@
+#ifndef __Logging__
+#define __Logging__
+
+/*
+* This module provides the logging functionality of the system.
+* The LogEvent function is inserted into the code at key points, passing an
+* integer value which represents the state. These are listed in the #defines
+* below.
+* The values are then insterted into a mailbox, where they fetched by the
+* CheckLoggingQueue function. This returns a string which also has a suffix
+* indicating logging. This can then be outputted to an interface. This function
+* should be placed within a repeating thread. To use the function with a printf
+* statement, you must convert between string and char array using:
+
+string QueueData = CheckLoggingQueue(); //Get the data from queue
+char char_array[QueueData.length()+1];  //Char array for message
+strcpy(char_array, QueueData.c_str());  //String must be converted to char array for printf
+PC.printf("%s\n\r",char_array); 
+
+* Functions incorporate a check on the state of Logging before acting. CheckLoggingQueue
+* will return an empty string if there is no logging.
+*/
+#include "mbed.h"
+#include "rtos.h"
+#include <string>
+
+#define Log_SampleTicker 0
+#define Log_EnviromSampled 1
+#define Log_TimeSampled 2
+#define Log_IndexInc 3
+#define Log_OldestInc 4
+#define Log_LCDScroll 5
+#define Log_LCDMessage 6
+#define Log_LCDTime 7
+#define Log_SetDateFail 8
+#define Log_SetTimeFail 9
+#define Log_EthCongifd 10
+#define Log_EthRequest 11
+
+extern Mail<uint32_t,32> ActivityLog;   //Mailbox that holds the activity
+
+extern bool logging;
+//Has logging been enabled in the system?
+void LogEvent(uint32_t eventCode);
+//Producer function - adds state to queue
+string CheckLoggingQueue(void);
+//Consumer function - wraps the number into a string with a suffix.
+#endif
\ No newline at end of file