Wojciech Rynczuk / Mbed 2 deprecated vcdMaker_Demo

Dependencies:   mbed vcdLogger vcdSignal

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers serialLogger.cpp Source File

serialLogger.cpp

Go to the documentation of this file.
00001 /*!
00002   @file serialLogger.cpp
00003 
00004   The implementation of the serial logger class.
00005 
00006   @par Full Description
00007   The implementation of the serial logger class.
00008 
00009   @if REVISION_HISTORY_INCLUDED
00010   @par Edit History
00011   @li [0]    wojciech.rynczuk@wp.pl    20-JAN-2015    Initial file revision.
00012   @endif
00013 
00014   @ingroup Logger
00015 
00016   @par Copyright (c) MMXV Wojciech Rynczuk
00017 
00018   Distributed under MIT License
00019 
00020 */
00021 
00022 #include "serialLogger.hpp "
00023 #include "mbed.h"
00024 
00025 SerialLogger::SerialLogger(uint32_t n_Lines, uint32_t n_Characters) : Logger(n_Lines,n_Characters)
00026 {
00027     serialOut = new Serial(USBTX, USBRX);
00028     alarm = new DigitalOut(LED_GREEN);
00029     rec_indicator = new DigitalOut(LED_RED);
00030     
00031     serialOut->baud(115200);
00032     *alarm = 1;
00033     *rec_indicator = 1;
00034 }
00035 
00036 SerialLogger::~SerialLogger()
00037 {
00038     delete alarm;
00039     delete serialOut;
00040 }
00041     
00042 void SerialLogger::Printf(const char* line)
00043 {
00044     serialOut->printf("%s\n\r", line);
00045 }
00046     
00047 void SerialLogger::AlarmFull()
00048 {
00049     *alarm = !*alarm;
00050 }
00051 
00052 uint32_t SerialLogger::StartAction()
00053 {
00054     *rec_indicator = 0;
00055     return 0;
00056 }
00057 
00058 uint32_t SerialLogger::StopAction()
00059 {
00060     *rec_indicator = 1;
00061     return 0;
00062 }