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.
Dependencies: 4DGL-uLCD-SE mbed-rtos mbed
Fork of StadiumHelper by
emic2.h
00001 #define speakf printf 00002 class emic2 : public Stream 00003 { 00004 public : 00005 emic2(PinName tx, PinName rx): _cmd(tx,rx) { 00006 _cmd.baud(9600); 00007 _cmd.putc('X'); //stop talking if reset and not a power on 00008 _cmd.putc('\r'); // Send a CR in case the system is already up 00009 wait(1); //delay for emic power on boot or reset respone 00010 while (_cmd.getc() != ':'); // When the Emic 2 has initialized and is ready, it will send a single ':' 00011 while (_cmd.readable()) _cmd.getc();//flush out buffer just in case 00012 }; 00013 void ready() { 00014 while (_cmd.getc() != ':'); 00015 while (_cmd.readable()) _cmd.getc();//flush out recieve buffer just in case 00016 }; 00017 int readable() { 00018 return _cmd.readable(); 00019 }; 00020 int getc() { 00021 return _cmd.getc(); 00022 } 00023 void volume(int x) { 00024 speakf("V%D\r",x); 00025 ready(); 00026 } 00027 void voice(int x) { 00028 speakf("N%D\r",x); 00029 ready(); 00030 } 00031 protected : 00032 Serial _cmd; 00033 //used by printf - supply it and printf works! 00034 virtual int _putc(int c) { 00035 _cmd.putc(c); 00036 return 0; 00037 }; 00038 virtual int _getc() { 00039 return -1; 00040 }; 00041 };
Generated on Wed Jul 20 2022 02:32:35 by
1.7.2
