00001 /* 00002 Object Oriented Mobile Robot Model (OOMRM) C++ Library Copyright (C) 2006 Derek Jones 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Lesser General Public 00006 License as published by the Free Software Foundation; either 00007 version 2.1 of the License, or (at your option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Lesser General Public License for more details. 00013 00014 You should have received a copy of the GNU Lesser General Public 00015 License along with this library; if not, write to the Free Software 00016 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00017 00018 $Id: ottsemic.h,v 1.4 2007/07/18 05:41:55 derek Exp $ 00019 */ 00020 #ifndef TTSEMIC_H 00021 #define TTSEMIC_H 00022 #include <hardware/ouart.h> 00023 #include <oconsole.h> 00024 00025 // receive buffer (usually only "ERROR" or "OK") 00026 #define EMIC_BUFFSIZE 24 00027 00077 00078 class oTTSemic 00079 { 00080 public: 00081 static const char SAY[]; //= { "say=" }; 00082 // For some reason after reset, you get both an OK and an ERROR. 00083 static const char RESET[]; //= { "reset" }; // soft reset 00084 static const char VOLUME[]; //= { "volume=" }; // 0-7 (default 4) 00085 static const char SPEED[]; //= { "speed=" }; // 0-4 (default 2) 00086 static const char PITCH[]; //= { "pitch=" }; // 0-6 (default 2) 00087 static const char AUDIO[]; //= { "audio" }; 00089 00093 oTTSemic(IOLINE rx, IOLINE tx); 00095 00106 void send_command(const char* const icommand, const char* const iparm); 00108 00110 bool say(const char* const icommand); 00112 void receive_ack(void); 00114 bool error(void); 00116 void reset(void); 00117 void semaphore(void* isem); 00118 bool get_any_ack(); 00119 protected: 00120 word RXbuffer[EMIC_BUFFSIZE+1]; 00121 bool _error; 00122 oUART _tx; 00123 oUART _rx; 00124 oTTSemic(void); 00125 private: 00126 // polls for the character 'cwait' on uart rx channel. Built-in time-out counter. 00127 bool wait_char(char cwait); 00128 }; 00129 00130 00131 #endif
1.3