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.
hw_mbed.c
00001 #include "mbed.h" 00002 #include "conio.h" 00003 00004 Serial pc(USBTX, USBRX); 00005 00006 int get_esc_sec () { 00007 int ch; 00008 if (pc.scanf("\x1b\x5b%c",ch) == 0) 00009 return 0; 00010 else 00011 return ch; 00012 } 00013 00014 int _kbhit (void) { 00015 return pc.readable(); 00016 } 00017 00018 00019 void _putch (char ch) { 00020 pc.putc(ch); 00021 } 00022 00023 int _getch (void) { 00024 int ret; 00025 00026 while (!_kbhit()); //wait and read new char 00027 ret = pc.getc(); 00028 if (ret==0) { 00029 while (!_kbhit()); //wait and read new char 00030 ret = pc.getc(); 00031 ret = ret | 0x100; 00032 } 00033 00034 return ret; 00035 } 00036 00037 00038 void MCU_Init(void) { 00039 pc.baud(19200); 00040 }
Generated on Thu Jul 14 2022 01:28:10 by
1.7.2