
Port of Conio.h
Diff: hw_mbed.c
- Revision:
- 0:6c1bc9b3a347
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hw_mbed.c Mon Apr 19 20:20:10 2010 +0000 @@ -0,0 +1,40 @@ +#include "mbed.h" +#include "conio.h" + +Serial pc(USBTX, USBRX); + +int get_esc_sec () { + int ch; + if (pc.scanf("\x1b\x5b%c",ch) == 0) + return 0; + else + return ch; +} + +int _kbhit (void) { + return pc.readable(); +} + + +void _putch (char ch) { + pc.putc(ch); +} + +int _getch (void) { + int ret; + + while (!_kbhit()); //wait and read new char + ret = pc.getc(); + if (ret==0) { + while (!_kbhit()); //wait and read new char + ret = pc.getc(); + ret = ret | 0x100; + } + + return ret; +} + + +void MCU_Init(void) { + pc.baud(19200); +} \ No newline at end of file