Mbed port of Stm32f4Cube LCD LOG for STM32F429I-DISCO

Dependents:   DISCO-F429ZI_ExportTemplate1

Usage example: DISCO-F429ZI_ExportTemplate1

/media/uploads/icis4/lcdlog1.png

LCD_LOG_DISCO.cpp

Committer:
icis4
Date:
2015-12-26
Revision:
1:b88758065c40
Parent:
0:098e992daf30

File content as of revision 1:b88758065c40:

/* Copyright (c) 2015 Ivaylo Iltchev www.iltchev.com, MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
* and associated documentation files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
* BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

#include "mbed_interface.h"
#include "LCD_LOG_DISCO.h"

extern "C" LCD_LOG_PUTCHAR;

LCDLog::LCDLog(const char* name):Stream(name)
{
}

void LCDLog::Init(FILE* fhandle, const char* header, const char* footer)
{
    char path[64];
    LCD_LOG_Init();
    if (header)
        Header(header);
    if (footer)
        Footer(footer);
    sprintf(path, "/%s", getName());
    freopen(path, "w", fhandle);
    mbed::mbed_set_unbuffered_stream(fhandle);
    LCD_LineColor = LCD_COLOR_GRAY;
}

int LCDLog::_getc()
{
    return 0;
}

int LCDLog::_putc(int c)
{
    return lcd_log_putc(c);
}