FRDM-K64F Code Share / Mbed 2 deprecated frdm_K64F_Controller

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Console.h Source File

Console.h

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  
00020  #ifndef __CONSOLE_H
00021  #define __CONSOLE_H
00022  /**
00023   * \brief    Provides the interfaces for console IO functionality
00024   */
00025 #include "error.h"  
00026 class Console
00027 {
00028     public:
00029     virtual char getCh() = 0;
00030     virtual void putCh(char ch) = 0;
00031     virtual void puts(char *str) = 0;
00032     virtual void printf(char *fmt, ...) = 0;
00033     virtual void printErr(uint err)
00034     {
00035       char errMsgs[][20] = {
00036         "ERROR",
00037         "SUCCESS",
00038         "Invalid pin",
00039         "Invalid arguments"
00040       };
00041       if (err > 4)
00042       {
00043          err = 0;
00044       } 
00045       puts(&errMsgs[err][0]);
00046       puts("OK");
00047     }
00048     virtual int available() = 0;
00049 };
00050 
00051 #endif
00052