Library for Programmable Resolution 1-Wire Digital ThermometerDS18B20

Dependents:   DS18B20_HGC

Committer:
kriedel
Date:
Thu Feb 03 12:10:20 2011 +0000
Revision:
0:21c0c97a5d7c

        

Who changed what in which revision?

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