Wojciech Rynczuk / Mbed 2 deprecated vcdMaker_Demo_DISCO_L476

Dependencies:   BSP_DISCO_L476VG COMPASS_DISCO_L476VG 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   @li [1]    wojciech.rynczuk@wp.pl    04-MAR-2016    DISCO L476 port.
00013   @endif
00014 
00015   @ingroup Logger
00016 
00017   The MIT License (MIT)
00018   Copyright (c) 2016 Wojciech Rynczuk
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(LED1);
00029     rec_indicator = new DigitalOut(LED2);
00030     
00031     serialOut->baud(115200);
00032     *alarm = 0;
00033     *rec_indicator = 0;
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 = 1;
00055     return 0;
00056 }
00057 
00058 uint32_t SerialLogger::StopAction()
00059 {
00060     *rec_indicator = 0;
00061     return 0;
00062 }