![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
First Publish
Dependencies: BridgeDriver2 FrontPanelButtons MAX31855 MCP23017 SDFileSystem TextLCD mbed
DebugTrace.h@0:20e78c9d2ea9, 2014-11-10 (annotated)
- Committer:
- mehatfie
- Date:
- Mon Nov 10 22:56:20 2014 +0000
- Revision:
- 0:20e78c9d2ea9
First Commit of Falcon Wing
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mehatfie | 0:20e78c9d2ea9 | 1 | /* |
mehatfie | 0:20e78c9d2ea9 | 2 | * DebugTrace. Allows dumping debug messages/values to serial or |
mehatfie | 0:20e78c9d2ea9 | 3 | * to file. |
mehatfie | 0:20e78c9d2ea9 | 4 | * |
mehatfie | 0:20e78c9d2ea9 | 5 | * Copyright (C) <2009> Petras Saduikis <petras@petras.co.uk> |
mehatfie | 0:20e78c9d2ea9 | 6 | * |
mehatfie | 0:20e78c9d2ea9 | 7 | * This file is part of DebugTrace. |
mehatfie | 0:20e78c9d2ea9 | 8 | * |
mehatfie | 0:20e78c9d2ea9 | 9 | * DebugTrace is free software: you can redistribute it and/or modify |
mehatfie | 0:20e78c9d2ea9 | 10 | * it under the terms of the GNU General Public License as published by |
mehatfie | 0:20e78c9d2ea9 | 11 | * the Free Software Foundation, either version 3 of the License, or |
mehatfie | 0:20e78c9d2ea9 | 12 | * (at your option) any later version. |
mehatfie | 0:20e78c9d2ea9 | 13 | * |
mehatfie | 0:20e78c9d2ea9 | 14 | * DebugTrace is distributed in the hope that it will be useful, |
mehatfie | 0:20e78c9d2ea9 | 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
mehatfie | 0:20e78c9d2ea9 | 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
mehatfie | 0:20e78c9d2ea9 | 17 | * GNU General Public License for more details. |
mehatfie | 0:20e78c9d2ea9 | 18 | * |
mehatfie | 0:20e78c9d2ea9 | 19 | * You should have received a copy of the GNU General Public License |
mehatfie | 0:20e78c9d2ea9 | 20 | * along with DebugTrace. If not, see <http://www.gnu.org/licenses/>. |
mehatfie | 0:20e78c9d2ea9 | 21 | */ |
mehatfie | 0:20e78c9d2ea9 | 22 | |
mehatfie | 0:20e78c9d2ea9 | 23 | #ifndef SNATCH59_DEBUGTRACE_H |
mehatfie | 0:20e78c9d2ea9 | 24 | #define SNATCH59_DEBUGTRACE_H |
mehatfie | 0:20e78c9d2ea9 | 25 | |
mehatfie | 0:20e78c9d2ea9 | 26 | enum eLog {OFF, ON}; |
mehatfie | 0:20e78c9d2ea9 | 27 | enum eLogTarget {TO_SERIAL, TO_FILE}; |
mehatfie | 0:20e78c9d2ea9 | 28 | |
mehatfie | 0:20e78c9d2ea9 | 29 | class DebugTrace |
mehatfie | 0:20e78c9d2ea9 | 30 | { |
mehatfie | 0:20e78c9d2ea9 | 31 | public: |
mehatfie | 0:20e78c9d2ea9 | 32 | DebugTrace(eLog on, eLogTarget mode, const char* fileName = "log.txt", const int maxSize = 1024); |
mehatfie | 0:20e78c9d2ea9 | 33 | ~DebugTrace(); |
mehatfie | 0:20e78c9d2ea9 | 34 | |
mehatfie | 0:20e78c9d2ea9 | 35 | void clear(); |
mehatfie | 0:20e78c9d2ea9 | 36 | void traceOut(const char* fmt, ...); |
mehatfie | 0:20e78c9d2ea9 | 37 | |
mehatfie | 0:20e78c9d2ea9 | 38 | private: |
mehatfie | 0:20e78c9d2ea9 | 39 | eLog enabled; |
mehatfie | 0:20e78c9d2ea9 | 40 | eLogTarget logMode; |
mehatfie | 0:20e78c9d2ea9 | 41 | int maxFileSize; |
mehatfie | 0:20e78c9d2ea9 | 42 | int currentFileSize; |
mehatfie | 0:20e78c9d2ea9 | 43 | char* logFile; |
mehatfie | 0:20e78c9d2ea9 | 44 | char* logFileBackup; |
mehatfie | 0:20e78c9d2ea9 | 45 | int logFileStatus; // if things go wrong, don't write any more data to file |
mehatfie | 0:20e78c9d2ea9 | 46 | |
mehatfie | 0:20e78c9d2ea9 | 47 | void backupLog(); |
mehatfie | 0:20e78c9d2ea9 | 48 | }; |
mehatfie | 0:20e78c9d2ea9 | 49 | |
mehatfie | 0:20e78c9d2ea9 | 50 | #endif |