FRDM-K64F Code Share / Mbed 2 deprecated frdm_K64F_Controller

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers MbedConsole.cpp Source File

MbedConsole.cpp

00001 /*
00002  * This program is free software; you can redistribute it and/or modify
00003  * it under the terms of the GNU General Public License as published by
00004  * the Free Software Foundation; either version 2 of the License, or
00005  * (at your option) any later version.
00006  *
00007  * This program is distributed in the hope that it will be useful,
00008  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00009  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010  * GNU General Public License for more details.
00011  *
00012  * You should have received a copy of the GNU General Public License
00013  * along with this program; if not, write to the Free Software
00014  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
00015  * MA 02110-1301, USA.
00016  *
00017  */
00018 
00019 #include "Console.h"
00020 #include <stdarg.h>
00021 #include "MbedConsole.h"
00022 #include "mbed.h"
00023 
00024 extern Serial pc;
00025 
00026 void MbedConsole::printf(char * fmt, ...)
00027 {
00028     char tmp[64];
00029     va_list args;
00030     va_start(args, fmt);
00031     vsnprintf(tmp, 64, fmt, args);
00032     va_end(args);
00033     pc.printf("%s", tmp);
00034 }
00035 
00036 int MbedConsole::available()
00037 {
00038     return pc.readable();
00039 }
00040