DS18B20 helloWorld

Dependents:   DS1820_HelloWorld

Committer:
jack__zen
Date:
Wed Sep 06 05:34:36 2017 +0000
Revision:
0:1934d9b9fd80
debug

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jack__zen 0:1934d9b9fd80 1 /*
jack__zen 0:1934d9b9fd80 2 * DebugTrace. Allows dumping debug messages/values to serial or
jack__zen 0:1934d9b9fd80 3 * to file.
jack__zen 0:1934d9b9fd80 4 *
jack__zen 0:1934d9b9fd80 5 * Copyright (C) <2009> Petras Saduikis <petras@petras.co.uk>
jack__zen 0:1934d9b9fd80 6 *
jack__zen 0:1934d9b9fd80 7 * This file is part of DebugTrace.
jack__zen 0:1934d9b9fd80 8 *
jack__zen 0:1934d9b9fd80 9 * DebugTrace is free software: you can redistribute it and/or modify
jack__zen 0:1934d9b9fd80 10 * it under the terms of the GNU General Public License as published by
jack__zen 0:1934d9b9fd80 11 * the Free Software Foundation, either version 3 of the License, or
jack__zen 0:1934d9b9fd80 12 * (at your option) any later version.
jack__zen 0:1934d9b9fd80 13 *
jack__zen 0:1934d9b9fd80 14 * DebugTrace is distributed in the hope that it will be useful,
jack__zen 0:1934d9b9fd80 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
jack__zen 0:1934d9b9fd80 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
jack__zen 0:1934d9b9fd80 17 * GNU General Public License for more details.
jack__zen 0:1934d9b9fd80 18 *
jack__zen 0:1934d9b9fd80 19 * You should have received a copy of the GNU General Public License
jack__zen 0:1934d9b9fd80 20 * along with DebugTrace. If not, see <http://www.gnu.org/licenses/>.
jack__zen 0:1934d9b9fd80 21 */
jack__zen 0:1934d9b9fd80 22
jack__zen 0:1934d9b9fd80 23 #ifndef SNATCH59_DEBUGTRACE_H
jack__zen 0:1934d9b9fd80 24 #define SNATCH59_DEBUGTRACE_H
jack__zen 0:1934d9b9fd80 25
jack__zen 0:1934d9b9fd80 26 enum eLog {OFF, ON};
jack__zen 0:1934d9b9fd80 27 enum eLogTarget {TO_SERIAL, TO_FILE};
jack__zen 0:1934d9b9fd80 28
jack__zen 0:1934d9b9fd80 29 class DebugTrace
jack__zen 0:1934d9b9fd80 30 {
jack__zen 0:1934d9b9fd80 31 public:
jack__zen 0:1934d9b9fd80 32 DebugTrace(eLog on, eLogTarget mode, const char* fileName = "log.txt", const int maxSize = 1024);
jack__zen 0:1934d9b9fd80 33 ~DebugTrace();
jack__zen 0:1934d9b9fd80 34
jack__zen 0:1934d9b9fd80 35 void clear();
jack__zen 0:1934d9b9fd80 36 void traceOut(const char* fmt, ...);
jack__zen 0:1934d9b9fd80 37
jack__zen 0:1934d9b9fd80 38 private:
jack__zen 0:1934d9b9fd80 39 eLog enabled;
jack__zen 0:1934d9b9fd80 40 eLogTarget logMode;
jack__zen 0:1934d9b9fd80 41 int maxFileSize;
jack__zen 0:1934d9b9fd80 42 int currentFileSize;
jack__zen 0:1934d9b9fd80 43 char* logFile;
jack__zen 0:1934d9b9fd80 44 char* logFileBackup;
jack__zen 0:1934d9b9fd80 45 int logFileStatus; // if things go wrong, don't write any more data to file
jack__zen 0:1934d9b9fd80 46
jack__zen 0:1934d9b9fd80 47 void backupLog();
jack__zen 0:1934d9b9fd80 48 };
jack__zen 0:1934d9b9fd80 49
jack__zen 0:1934d9b9fd80 50 #endif