Baseline for testing
Diff: EventLog.h
- Revision:
- 2:486d068deff9
- Parent:
- 1:aaddf80105fe
--- a/EventLog.h Thu Sep 12 11:28:11 2019 +0000 +++ b/EventLog.h Tue Sep 17 13:48:38 2019 +0000 @@ -1,10 +1,32 @@ +/************************************************************************** + * @file EventLog.h + * @brief Base class for wrapping the interface with the ESCM Event Log + * @version: V1.0 + * @date: 9/17/2019 + + * + * @note + * Copyright (C) 2019 E3 Design. All rights reserved. + * + * @par + * E3 Designers LLC is supplying this software for use with Cortex-M3 LPC1768 + * processor based microcontroller for the ESCM 2000 Monitor and Display. + * * + * @par + * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED + * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR + * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. + * + ******************************************************************************/ + #ifndef _EVENT_LOG_ #define _EVENT_LOG_ /* fault log */ #include "mbed.h" - -#define MAX_EVENT_LENGTH 40 +#define EVENT_LOG_FORMAT 0xFAFA #define MAX_EVENTS 50 class ESCM_Event @@ -45,21 +67,22 @@ int init(); int load(); int save(); + void clear(); void display(Serial *pc); void add(uint16_t address); void add(uint16_t address, uint16_t port); - void add(uint16_t address, char* timeStamp); - void clear(); ESCM_Event * index (int pos ); - - static const int max_size_ = 50; + Mutex _mutex; + + static const int max_size_ = MAX_EVENTS; int head_ ; int tail_ ; bool full_ ; - + bool dirty ; + void put(ESCM_Event item){ events[head_] = item; @@ -71,6 +94,8 @@ { tail_ = (tail_ + 1) % max_size_; } + + dirty = true; } @@ -86,7 +111,7 @@ full_ = false; tail_ = (tail_ + 1) % max_size_; - + dirty = true; return val; } @@ -95,6 +120,7 @@ { head_ = tail_; full_ = false; + dirty = true; } bool empty() const