Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
MbedConsole.h@1:9d3340bcd863, 2013-02-26 (annotated)
- Committer:
- Navin
- Date:
- Tue Feb 26 03:51:46 2013 +0000
- Revision:
- 1:9d3340bcd863
- Parent:
- 0:fe5850ccdb6f
Initial commit
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| Navin | 0:fe5850ccdb6f | 1 | /* |
| Navin | 0:fe5850ccdb6f | 2 | * This program is free software; you can redistribute it and/or modify |
| Navin | 0:fe5850ccdb6f | 3 | * it under the terms of the GNU General Public License as published by |
| Navin | 0:fe5850ccdb6f | 4 | * the Free Software Foundation; either version 2 of the License, or |
| Navin | 0:fe5850ccdb6f | 5 | * (at your option) any later version. |
| Navin | 0:fe5850ccdb6f | 6 | * |
| Navin | 0:fe5850ccdb6f | 7 | * This program is distributed in the hope that it will be useful, |
| Navin | 0:fe5850ccdb6f | 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| Navin | 0:fe5850ccdb6f | 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| Navin | 0:fe5850ccdb6f | 10 | * GNU General Public License for more details. |
| Navin | 0:fe5850ccdb6f | 11 | * |
| Navin | 0:fe5850ccdb6f | 12 | * You should have received a copy of the GNU General Public License |
| Navin | 0:fe5850ccdb6f | 13 | * along with this program; if not, write to the Free Software |
| Navin | 0:fe5850ccdb6f | 14 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
| Navin | 0:fe5850ccdb6f | 15 | * MA 02110-1301, USA. |
| Navin | 0:fe5850ccdb6f | 16 | * |
| Navin | 0:fe5850ccdb6f | 17 | */ |
| Navin | 0:fe5850ccdb6f | 18 | |
| Navin | 0:fe5850ccdb6f | 19 | #ifndef __MBEDCONSOLE_H |
| Navin | 0:fe5850ccdb6f | 20 | #define __MBEDCONSOLE_H |
| Navin | 0:fe5850ccdb6f | 21 | #include "Console.h" |
| Navin | 0:fe5850ccdb6f | 22 | #include "mbed.h" |
| Navin | 0:fe5850ccdb6f | 23 | #include <stdio.h> |
| Navin | 0:fe5850ccdb6f | 24 | |
| Navin | 0:fe5850ccdb6f | 25 | extern Serial pc; |
| Navin | 0:fe5850ccdb6f | 26 | |
| Navin | 0:fe5850ccdb6f | 27 | class MbedConsole : public Console |
| Navin | 0:fe5850ccdb6f | 28 | { |
| Navin | 0:fe5850ccdb6f | 29 | public: |
| Navin | 0:fe5850ccdb6f | 30 | virtual char getCh() |
| Navin | 0:fe5850ccdb6f | 31 | { |
| Navin | 0:fe5850ccdb6f | 32 | return pc.getc(); |
| Navin | 0:fe5850ccdb6f | 33 | } |
| Navin | 0:fe5850ccdb6f | 34 | virtual void putCh(char ch) |
| Navin | 0:fe5850ccdb6f | 35 | { |
| Navin | 0:fe5850ccdb6f | 36 | pc.printf("%c", ch); |
| Navin | 0:fe5850ccdb6f | 37 | } |
| Navin | 0:fe5850ccdb6f | 38 | virtual void puts(char *str) |
| Navin | 0:fe5850ccdb6f | 39 | { |
| Navin | 0:fe5850ccdb6f | 40 | pc.printf("%s", str); |
| Navin | 0:fe5850ccdb6f | 41 | } |
| Navin | 0:fe5850ccdb6f | 42 | virtual void printf(char *fmt, ...); |
| Navin | 0:fe5850ccdb6f | 43 | virtual int available(); |
| Navin | 0:fe5850ccdb6f | 44 | }; |
| Navin | 0:fe5850ccdb6f | 45 | |
| Navin | 0:fe5850ccdb6f | 46 | #endif |
| Navin | 0:fe5850ccdb6f | 47 |