Header files and Init data so you can use the Text To Speech Click Board with a Hexiware and mBed OS5
Dependents: Talking_breathalyzer FindTheColor mbed_Projet
text_to_speech.h@0:b33a6418e125, 2016-10-07 (annotated)
- Committer:
- daveyclk
- Date:
- Fri Oct 07 20:09:00 2016 +0000
- Revision:
- 0:b33a6418e125
First version of iBreathalyzer with its own voice! (Text to speech click)
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
daveyclk | 0:b33a6418e125 | 1 | /****************************************************************************** |
daveyclk | 0:b33a6418e125 | 2 | * Title : Text To Speech |
daveyclk | 0:b33a6418e125 | 3 | * Filename : text_to_speech.h |
daveyclk | 0:b33a6418e125 | 4 | * Author : MSV |
daveyclk | 0:b33a6418e125 | 5 | * Origin Date : 30/01/2016 |
daveyclk | 0:b33a6418e125 | 6 | * Notes : |
daveyclk | 0:b33a6418e125 | 7 | *******************************************************************************/ |
daveyclk | 0:b33a6418e125 | 8 | /**************************CHANGE LIST **************************************** |
daveyclk | 0:b33a6418e125 | 9 | * |
daveyclk | 0:b33a6418e125 | 10 | * Date Software Version Initials Description |
daveyclk | 0:b33a6418e125 | 11 | * 30/01/16 .1 MSV Interface Created. |
daveyclk | 0:b33a6418e125 | 12 | * |
daveyclk | 0:b33a6418e125 | 13 | *******************************************************************************/ |
daveyclk | 0:b33a6418e125 | 14 | /** |
daveyclk | 0:b33a6418e125 | 15 | * @file text_to_speech.h |
daveyclk | 0:b33a6418e125 | 16 | * @brief <h3> Text to Speech </h3> |
daveyclk | 0:b33a6418e125 | 17 | * |
daveyclk | 0:b33a6418e125 | 18 | * @par |
daveyclk | 0:b33a6418e125 | 19 | * The device operates as a companion device. It is connected to a host using |
daveyclk | 0:b33a6418e125 | 20 | * the SPI. When connected to a host, the operation of the device is completely |
daveyclk | 0:b33a6418e125 | 21 | * determined by control and data information provided by the host. Control and |
daveyclk | 0:b33a6418e125 | 22 | * data information is transferred to and from device using a defined |
daveyclk | 0:b33a6418e125 | 23 | * message protocol. |
daveyclk | 0:b33a6418e125 | 24 | * |
daveyclk | 0:b33a6418e125 | 25 | * @par |
daveyclk | 0:b33a6418e125 | 26 | * The features of the messaging protocol are presented below : |
daveyclk | 0:b33a6418e125 | 27 | * - The device is completely driven by the reception of messages from the |
daveyclk | 0:b33a6418e125 | 28 | * host. |
daveyclk | 0:b33a6418e125 | 29 | * - The message set is byte oriented, with a fixed length header part, |
daveyclk | 0:b33a6418e125 | 30 | * and variable length payload |
daveyclk | 0:b33a6418e125 | 31 | * - The messages follow a request –> response flow. All request messages are |
daveyclk | 0:b33a6418e125 | 32 | * sent by the host processor. All response messages are generated by the |
daveyclk | 0:b33a6418e125 | 33 | * device in response to a request message. |
daveyclk | 0:b33a6418e125 | 34 | * - The host processor is required to wait for a response to a request |
daveyclk | 0:b33a6418e125 | 35 | * message, before issuing any subsequent request. Any request message sent |
daveyclk | 0:b33a6418e125 | 36 | * before receiving the previous response will trigger an error state within |
daveyclk | 0:b33a6418e125 | 37 | * the device. |
daveyclk | 0:b33a6418e125 | 38 | * - Some messages are termed indication messages. Such messages require no |
daveyclk | 0:b33a6418e125 | 39 | * confirmation from the recipient. Indication messages can only be sent by |
daveyclk | 0:b33a6418e125 | 40 | * the device. |
daveyclk | 0:b33a6418e125 | 41 | * |
daveyclk | 0:b33a6418e125 | 42 | * @par |
daveyclk | 0:b33a6418e125 | 43 | * In general, a response message is sent immediately on receiving its |
daveyclk | 0:b33a6418e125 | 44 | * corresponding request message. The sending of a response informs the host |
daveyclk | 0:b33a6418e125 | 45 | * that the request has been received but not that it has been actioned. |
daveyclk | 0:b33a6418e125 | 46 | * However for some messages, the interval between the sending of a request and |
daveyclk | 0:b33a6418e125 | 47 | * receipt of a response can be considerable. In corner cases, the delay |
daveyclk | 0:b33a6418e125 | 48 | * between the sending of a request message by a host and the receipt of the |
daveyclk | 0:b33a6418e125 | 49 | * corresponding response message can be several hundred milliseconds. |
daveyclk | 0:b33a6418e125 | 50 | * Delay between request and response is guaranteed not to exceed |
daveyclk | 0:b33a6418e125 | 51 | * MAX_RESPONSE_TIME. |
daveyclk | 0:b33a6418e125 | 52 | * |
daveyclk | 0:b33a6418e125 | 53 | * @par |
daveyclk | 0:b33a6418e125 | 54 | * The device have two working modes - boot and main mode. The device boot mode |
daveyclk | 0:b33a6418e125 | 55 | * is entered on hardware reset. The device requires the download of |
daveyclk | 0:b33a6418e125 | 56 | * initialisation data in boot mode before it is run in main mode. |
daveyclk | 0:b33a6418e125 | 57 | * This initialisation data is contained in the device binary file included |
daveyclk | 0:b33a6418e125 | 58 | * with this documentation. |
daveyclk | 0:b33a6418e125 | 59 | * @link text_to_speech_img.h @endlink |
daveyclk | 0:b33a6418e125 | 60 | * In order to enter the main work mode user should call execution of the loaded |
daveyclk | 0:b33a6418e125 | 61 | * image |
daveyclk | 0:b33a6418e125 | 62 | * @link tts_image_exec @endlink |
daveyclk | 0:b33a6418e125 | 63 | * and registration of the host with the device with |
daveyclk | 0:b33a6418e125 | 64 | * @link tts_interface_test @endlink. |
daveyclk | 0:b33a6418e125 | 65 | * After this steps device enters the main working mode. |
daveyclk | 0:b33a6418e125 | 66 | * |
daveyclk | 0:b33a6418e125 | 67 | * @par |
daveyclk | 0:b33a6418e125 | 68 | * Any request message can be sent at any time after the last response message |
daveyclk | 0:b33a6418e125 | 69 | * has been received. If it is inappropriate to send a request message at a |
daveyclk | 0:b33a6418e125 | 70 | * certain point, then the device will indicate this with a non-fatal error |
daveyclk | 0:b33a6418e125 | 71 | * code in the response message. |
daveyclk | 0:b33a6418e125 | 72 | * |
daveyclk | 0:b33a6418e125 | 73 | * @par |
daveyclk | 0:b33a6418e125 | 74 | * In the normal course of operation, the host should not receive a reserved |
daveyclk | 0:b33a6418e125 | 75 | * error from device. Non-fatal errors can be viewed as warnings, from which |
daveyclk | 0:b33a6418e125 | 76 | * the system recovers, and have no adverse effect on system behaviour. |
daveyclk | 0:b33a6418e125 | 77 | * Non-fatal errors are communicated to the host processor via the appropriate |
daveyclk | 0:b33a6418e125 | 78 | * response message, or, in an application specific error indication. |
daveyclk | 0:b33a6418e125 | 79 | * A response message that includes an error code indicates that the requested |
daveyclk | 0:b33a6418e125 | 80 | * action could not be completed. Fatal errors cannot be recovered by software. |
daveyclk | 0:b33a6418e125 | 81 | * The only recovery mechanism is to reset the device. Fore more informations |
daveyclk | 0:b33a6418e125 | 82 | * about error codes |
daveyclk | 0:b33a6418e125 | 83 | * @link TTS_ERROR_t @endlink. |
daveyclk | 0:b33a6418e125 | 84 | * |
daveyclk | 0:b33a6418e125 | 85 | * @par |
daveyclk | 0:b33a6418e125 | 86 | * All functions inside this module returns recevied response from device so |
daveyclk | 0:b33a6418e125 | 87 | * sucessfull execution will return 0 and all other returned values means |
daveyclk | 0:b33a6418e125 | 88 | * that function is not executed properly. |
daveyclk | 0:b33a6418e125 | 89 | */ |
daveyclk | 0:b33a6418e125 | 90 | |
daveyclk | 0:b33a6418e125 | 91 | /****************************************************************************** |
daveyclk | 0:b33a6418e125 | 92 | * Includes |
daveyclk | 0:b33a6418e125 | 93 | *******************************************************************************/ |
daveyclk | 0:b33a6418e125 | 94 | #include "text_to_speech_hw.h" |
daveyclk | 0:b33a6418e125 | 95 | #include <string.h> |
daveyclk | 0:b33a6418e125 | 96 | |
daveyclk | 0:b33a6418e125 | 97 | /****************************************************************************** |
daveyclk | 0:b33a6418e125 | 98 | * Preprocessor Constants |
daveyclk | 0:b33a6418e125 | 99 | *******************************************************************************/ |
daveyclk | 0:b33a6418e125 | 100 | #define ISC_VERSION_REQ_BOOT 0x0005 |
daveyclk | 0:b33a6418e125 | 101 | #define ISC_VERSION_RESP_BOOT 0x0006 |
daveyclk | 0:b33a6418e125 | 102 | #define ISC_BOOT_LOAD_REQ 0x1000 |
daveyclk | 0:b33a6418e125 | 103 | #define ISC_BOOT_LOAD_RESP 0x1001 |
daveyclk | 0:b33a6418e125 | 104 | #define ISC_BOOT_RUN_REQ 0x1002 |
daveyclk | 0:b33a6418e125 | 105 | #define ISC_BOOT_RUN_RESP 0x1003 |
daveyclk | 0:b33a6418e125 | 106 | |
daveyclk | 0:b33a6418e125 | 107 | #define ISC_TEST_REQ 0x0003 |
daveyclk | 0:b33a6418e125 | 108 | #define ISC_TEST_RESP 0x0004 |
daveyclk | 0:b33a6418e125 | 109 | #define ISC_VERSION_REQ_MAIN 0x0005 |
daveyclk | 0:b33a6418e125 | 110 | #define ISC_VERSION_RESP_MAIN 0x0006 |
daveyclk | 0:b33a6418e125 | 111 | #define ISC_ERROR_IND 0x0000 |
daveyclk | 0:b33a6418e125 | 112 | #define ISC_MSG_BLOCKED_RESP 0x0007 |
daveyclk | 0:b33a6418e125 | 113 | |
daveyclk | 0:b33a6418e125 | 114 | #define ISC_PMAN_CONFIG_REQ 0x0062 |
daveyclk | 0:b33a6418e125 | 115 | #define ISC_PMAN_CONFIG_RESP 0x0063 |
daveyclk | 0:b33a6418e125 | 116 | #define ISC_PMAN_STANDBY_ENTRY_REQ 0x0064 |
daveyclk | 0:b33a6418e125 | 117 | #define ISC_PMAN_STANDBY_ENTRY_RESP 0x0065 |
daveyclk | 0:b33a6418e125 | 118 | #define ISC_PMAN_STANDBY_EXIT_IND 0x0066 |
daveyclk | 0:b33a6418e125 | 119 | |
daveyclk | 0:b33a6418e125 | 120 | #define ISC_AUDIO_CONFIG_REQ 0x0008 |
daveyclk | 0:b33a6418e125 | 121 | #define ISC_AUDIO_CONFIG_RESP 0x0009 |
daveyclk | 0:b33a6418e125 | 122 | #define ISC_AUDIO_VOULME_REQ 0x000A |
daveyclk | 0:b33a6418e125 | 123 | #define ISC_AUDIO_VOLUME_RESP 0x000B |
daveyclk | 0:b33a6418e125 | 124 | #define ISC_AUDIO_MUTE_REQ 0x000C |
daveyclk | 0:b33a6418e125 | 125 | #define ISC_AUDIO_MUTE_RESP 0x000D |
daveyclk | 0:b33a6418e125 | 126 | |
daveyclk | 0:b33a6418e125 | 127 | #define ISC_SPCODEC_CONFIG_REQ 0x0056 |
daveyclk | 0:b33a6418e125 | 128 | #define ISC_SPCODEC_CONFIG_RESP 0x0057 |
daveyclk | 0:b33a6418e125 | 129 | #define ISC_SPCODEC_START_REQ 0x0058 |
daveyclk | 0:b33a6418e125 | 130 | #define ISC_SPCODEC_START_RESP 0x0059 |
daveyclk | 0:b33a6418e125 | 131 | #define ISC_SPCODEC_PAUSE_REQ 0x005C |
daveyclk | 0:b33a6418e125 | 132 | #define ISC_SPCODEC_PAUSE_RESP 0x005D |
daveyclk | 0:b33a6418e125 | 133 | #define ISC_SPCODEC_STOP_REQ 0x005A |
daveyclk | 0:b33a6418e125 | 134 | #define ISC_SPCODEC_STOP_RESP 0x005B |
daveyclk | 0:b33a6418e125 | 135 | #define ISC_SPCODEC_READY_IND 0x0060 |
daveyclk | 0:b33a6418e125 | 136 | #define ISC_SPCODEC_FINISHED_IND 0x0061 |
daveyclk | 0:b33a6418e125 | 137 | |
daveyclk | 0:b33a6418e125 | 138 | #define ISC_TTS_CONFIG_REQ 0x0012 |
daveyclk | 0:b33a6418e125 | 139 | #define ISC_TTS_CONFIG_RESP 0x0013 |
daveyclk | 0:b33a6418e125 | 140 | #define ISC_TTS_SPEAK_REQ 0x0014 |
daveyclk | 0:b33a6418e125 | 141 | #define ISC_TTS_SPEAK_RESP 0x0015 |
daveyclk | 0:b33a6418e125 | 142 | #define ISC_TTS_READY_IND 0x0020 |
daveyclk | 0:b33a6418e125 | 143 | #define ISC_TTS_FINISHED_IND 0x0021 |
daveyclk | 0:b33a6418e125 | 144 | #define ISC_TTS_PAUSE_REQ 0x0016 |
daveyclk | 0:b33a6418e125 | 145 | #define ISC_TTS_PAUSE_RESP 0x0017 |
daveyclk | 0:b33a6418e125 | 146 | #define ISC_TTS_STOP_REQ 0x0018 |
daveyclk | 0:b33a6418e125 | 147 | #define ISC_TTS_STOP_RESP 0x0019 |
daveyclk | 0:b33a6418e125 | 148 | #define ISC_TTS_UDICT_DATA_REQ 0x00CE |
daveyclk | 0:b33a6418e125 | 149 | #define ISC_TTS_UDICT_DATA_RESP 0x00D0 |
daveyclk | 0:b33a6418e125 | 150 | /****************************************************************************** |
daveyclk | 0:b33a6418e125 | 151 | * Configuration Constants |
daveyclk | 0:b33a6418e125 | 152 | *******************************************************************************/ |
daveyclk | 0:b33a6418e125 | 153 | |
daveyclk | 0:b33a6418e125 | 154 | /****************************************************************************** |
daveyclk | 0:b33a6418e125 | 155 | * Macros |
daveyclk | 0:b33a6418e125 | 156 | *******************************************************************************/ |
daveyclk | 0:b33a6418e125 | 157 | |
daveyclk | 0:b33a6418e125 | 158 | /****************************************************************************** |
daveyclk | 0:b33a6418e125 | 159 | * Typedefs |
daveyclk | 0:b33a6418e125 | 160 | *******************************************************************************/ |
daveyclk | 0:b33a6418e125 | 161 | /** |
daveyclk | 0:b33a6418e125 | 162 | * @enum TTS_ERROR_t |
daveyclk | 0:b33a6418e125 | 163 | * @brief <h3> Text to speech errors </h3> |
daveyclk | 0:b33a6418e125 | 164 | */ |
daveyclk | 0:b33a6418e125 | 165 | typedef enum |
daveyclk | 0:b33a6418e125 | 166 | { |
daveyclk | 0:b33a6418e125 | 167 | /** |
daveyclk | 0:b33a6418e125 | 168 | * No Error */ |
daveyclk | 0:b33a6418e125 | 169 | NO_ERROR = 0x0000, |
daveyclk | 0:b33a6418e125 | 170 | /** |
daveyclk | 0:b33a6418e125 | 171 | * Insufficient system resource to perform request */ |
daveyclk | 0:b33a6418e125 | 172 | GEN_INSUFF_RESOURCES = 0x4002, |
daveyclk | 0:b33a6418e125 | 173 | /** |
daveyclk | 0:b33a6418e125 | 174 | * Unrecognised message ID */ |
daveyclk | 0:b33a6418e125 | 175 | GEN_UNKNOWN_MSG = 0x4003, |
daveyclk | 0:b33a6418e125 | 176 | /** |
daveyclk | 0:b33a6418e125 | 177 | * Application is not supported by device */ |
daveyclk | 0:b33a6418e125 | 178 | GEN_APP_NO_SUPPORT = 0x4005, |
daveyclk | 0:b33a6418e125 | 179 | /** |
daveyclk | 0:b33a6418e125 | 180 | * Invalid audio configuration */ |
daveyclk | 0:b33a6418e125 | 181 | AUDIO_INVALID_CONF = 0x4020, |
daveyclk | 0:b33a6418e125 | 182 | /** |
daveyclk | 0:b33a6418e125 | 183 | * Out of range configuration value */ |
daveyclk | 0:b33a6418e125 | 184 | AUDIO_OUT_OF_RANGE = 0x4021, |
daveyclk | 0:b33a6418e125 | 185 | /** |
daveyclk | 0:b33a6418e125 | 186 | * Audio message out of sequence */ |
daveyclk | 0:b33a6418e125 | 187 | AUDIO_OUT_OF_SEQUENCE = 0x4026, |
daveyclk | 0:b33a6418e125 | 188 | /** |
daveyclk | 0:b33a6418e125 | 189 | * Incompatible routing configuration */ |
daveyclk | 0:b33a6418e125 | 190 | AUDIO_INVALID_ROUTING_CONF = 0x4028, |
daveyclk | 0:b33a6418e125 | 191 | /** |
daveyclk | 0:b33a6418e125 | 192 | * Incompatible frequency configuration */ |
daveyclk | 0:b33a6418e125 | 193 | AUDIO_INVALID_FREQUENCY_CONF = 0x4029, |
daveyclk | 0:b33a6418e125 | 194 | /** |
daveyclk | 0:b33a6418e125 | 195 | * Power nabager invalid configuration */ |
daveyclk | 0:b33a6418e125 | 196 | PMAN_INVALID_CONF = 0x40C0, |
daveyclk | 0:b33a6418e125 | 197 | /** |
daveyclk | 0:b33a6418e125 | 198 | * Device is not ready to enter standby mode */ |
daveyclk | 0:b33a6418e125 | 199 | PMAN_NOT_READY = 0x40C1, |
daveyclk | 0:b33a6418e125 | 200 | /** |
daveyclk | 0:b33a6418e125 | 201 | * Invalid language */ |
daveyclk | 0:b33a6418e125 | 202 | TTS_INVALID_LANGUAGE = 0x4040, |
daveyclk | 0:b33a6418e125 | 203 | /** |
daveyclk | 0:b33a6418e125 | 204 | * Invalid sample rate */ |
daveyclk | 0:b33a6418e125 | 205 | TTS_INVALID_SAMPLE_RATE = 0x4041, |
daveyclk | 0:b33a6418e125 | 206 | /** |
daveyclk | 0:b33a6418e125 | 207 | * Invalid voice selection */ |
daveyclk | 0:b33a6418e125 | 208 | TTS_INVALID_VOICE = 0x4042, |
daveyclk | 0:b33a6418e125 | 209 | /** |
daveyclk | 0:b33a6418e125 | 210 | * Invalid data source */ |
daveyclk | 0:b33a6418e125 | 211 | TTS_INVALID_DATA_SRC = 0x4043, |
daveyclk | 0:b33a6418e125 | 212 | /** |
daveyclk | 0:b33a6418e125 | 213 | * TTS not configured */ |
daveyclk | 0:b33a6418e125 | 214 | TTS_NOT_CONFIGURED = 0x4044, |
daveyclk | 0:b33a6418e125 | 215 | /** |
daveyclk | 0:b33a6418e125 | 216 | * TTS not ready */ |
daveyclk | 0:b33a6418e125 | 217 | TTS_NOT_READY = 0x4045, |
daveyclk | 0:b33a6418e125 | 218 | /** |
daveyclk | 0:b33a6418e125 | 219 | * Audio output channel open failed */ |
daveyclk | 0:b33a6418e125 | 220 | TTS_AUDIO_OPEN_FAIL = 0x4046, |
daveyclk | 0:b33a6418e125 | 221 | /** |
daveyclk | 0:b33a6418e125 | 222 | * Audio output channel close failed */ |
daveyclk | 0:b33a6418e125 | 223 | TTS_AUDIO_CLOSE_FAIL = 0x4047, |
daveyclk | 0:b33a6418e125 | 224 | /** |
daveyclk | 0:b33a6418e125 | 225 | * TTS already stopped */ |
daveyclk | 0:b33a6418e125 | 226 | TTS_STOP_ERR = 0x4048, |
daveyclk | 0:b33a6418e125 | 227 | /** |
daveyclk | 0:b33a6418e125 | 228 | * Unexpected config request */ |
daveyclk | 0:b33a6418e125 | 229 | TTS_CONF_REQUEST_ERR = 0x4049, |
daveyclk | 0:b33a6418e125 | 230 | /** |
daveyclk | 0:b33a6418e125 | 231 | * File already open */ |
daveyclk | 0:b33a6418e125 | 232 | TTS_OPEN_ERR = 0x404A, |
daveyclk | 0:b33a6418e125 | 233 | /** |
daveyclk | 0:b33a6418e125 | 234 | * File open failed */ |
daveyclk | 0:b33a6418e125 | 235 | TTS_OPEN_FAIL = 0x404B, |
daveyclk | 0:b33a6418e125 | 236 | /** |
daveyclk | 0:b33a6418e125 | 237 | * File close failed */ |
daveyclk | 0:b33a6418e125 | 238 | TTS_CLOSE_FAIL = 0x404C, |
daveyclk | 0:b33a6418e125 | 239 | /** |
daveyclk | 0:b33a6418e125 | 240 | * Cannot pause */ |
daveyclk | 0:b33a6418e125 | 241 | TTS_PAUSE_ERR = 0x404F, |
daveyclk | 0:b33a6418e125 | 242 | /** |
daveyclk | 0:b33a6418e125 | 243 | * Invalid user dictionary file */ |
daveyclk | 0:b33a6418e125 | 244 | TTS_DICT_ERR = 0x4052, |
daveyclk | 0:b33a6418e125 | 245 | /** |
daveyclk | 0:b33a6418e125 | 246 | * Invalid whilst paused */ |
daveyclk | 0:b33a6418e125 | 247 | TTS_WHIILS_ERR = 0x4053, |
daveyclk | 0:b33a6418e125 | 248 | /** |
daveyclk | 0:b33a6418e125 | 249 | * Speech codec not configured before starting */ |
daveyclk | 0:b33a6418e125 | 250 | SPCODEC_START_ERR = 0x4101, |
daveyclk | 0:b33a6418e125 | 251 | /** |
daveyclk | 0:b33a6418e125 | 252 | * Pause attempted when speech codec is inactive */ |
daveyclk | 0:b33a6418e125 | 253 | SPCODEC_PAUSE_ERR = 0x4102, |
daveyclk | 0:b33a6418e125 | 254 | /** |
daveyclk | 0:b33a6418e125 | 255 | * Config attempted when speech codec is active */ |
daveyclk | 0:b33a6418e125 | 256 | SPCODEC_CONFIG_ERR = 0x4103, |
daveyclk | 0:b33a6418e125 | 257 | /** |
daveyclk | 0:b33a6418e125 | 258 | * Invalid data source */ |
daveyclk | 0:b33a6418e125 | 259 | SPCODEC_DATA_SRC_ERR = 0x4104, |
daveyclk | 0:b33a6418e125 | 260 | /** |
daveyclk | 0:b33a6418e125 | 261 | * Speech codec already paused */ |
daveyclk | 0:b33a6418e125 | 262 | SPCODEC_ALREADY_PAUSED = 0x4106, |
daveyclk | 0:b33a6418e125 | 263 | /** |
daveyclk | 0:b33a6418e125 | 264 | * Speech codec already active (not paused) */ |
daveyclk | 0:b33a6418e125 | 265 | SPCODEC_PAUSE_FAIL = 0x4107, |
daveyclk | 0:b33a6418e125 | 266 | /** |
daveyclk | 0:b33a6418e125 | 267 | * Invalid codec configuration */ |
daveyclk | 0:b33a6418e125 | 268 | SPCODEC_INVALID_CONF = 0x4108, |
daveyclk | 0:b33a6418e125 | 269 | /** |
daveyclk | 0:b33a6418e125 | 270 | * Too much input data*/ |
daveyclk | 0:b33a6418e125 | 271 | SPCODEC_INPUT_DATA_ERR = 0x4109, |
daveyclk | 0:b33a6418e125 | 272 | /** |
daveyclk | 0:b33a6418e125 | 273 | * Cannot open audio channel */ |
daveyclk | 0:b33a6418e125 | 274 | SPCODEC_AUDIO_OPEN_ERR = 0x410B, |
daveyclk | 0:b33a6418e125 | 275 | /** |
daveyclk | 0:b33a6418e125 | 276 | * Cannot close audio channel */ |
daveyclk | 0:b33a6418e125 | 277 | SPCODEC_AUDIO_CLOSE_ERR = 0x410C, |
daveyclk | 0:b33a6418e125 | 278 | /** |
daveyclk | 0:b33a6418e125 | 279 | * Unexpected message */ |
daveyclk | 0:b33a6418e125 | 280 | FATAL_ERR_UNEXPECTED_MSG = 0x80E0, |
daveyclk | 0:b33a6418e125 | 281 | /** |
daveyclk | 0:b33a6418e125 | 282 | * Invalid SPCODEC file / CODEC error */ |
daveyclk | 0:b33a6418e125 | 283 | FATAL_CODEC_ERR_1 = 0x8104, |
daveyclk | 0:b33a6418e125 | 284 | /** |
daveyclk | 0:b33a6418e125 | 285 | * Invalid SPCODEC file / CODEC error */ |
daveyclk | 0:b33a6418e125 | 286 | FATAL_CODEC_ERR_2 = 0x8105, |
daveyclk | 0:b33a6418e125 | 287 | /** |
daveyclk | 0:b33a6418e125 | 288 | * Invalid SPCODEC file / CODEC error */ |
daveyclk | 0:b33a6418e125 | 289 | FATAL_CODEC_ERR_3 = 0x8106 |
daveyclk | 0:b33a6418e125 | 290 | |
daveyclk | 0:b33a6418e125 | 291 | }TTS_ERROR_t; |
daveyclk | 0:b33a6418e125 | 292 | |
daveyclk | 0:b33a6418e125 | 293 | /** |
daveyclk | 0:b33a6418e125 | 294 | * @enum FF_t |
daveyclk | 0:b33a6418e125 | 295 | * @brief <h3> Firmware Features </h3> |
daveyclk | 0:b33a6418e125 | 296 | */ |
daveyclk | 0:b33a6418e125 | 297 | typedef enum |
daveyclk | 0:b33a6418e125 | 298 | { |
daveyclk | 0:b33a6418e125 | 299 | /** |
daveyclk | 0:b33a6418e125 | 300 | * Text to Speech */ |
daveyclk | 0:b33a6418e125 | 301 | FF_TTS = 0x0001, |
daveyclk | 0:b33a6418e125 | 302 | /** |
daveyclk | 0:b33a6418e125 | 303 | * ADPCM */ |
daveyclk | 0:b33a6418e125 | 304 | FF_ADPCM = 0x0010, |
daveyclk | 0:b33a6418e125 | 305 | /** |
daveyclk | 0:b33a6418e125 | 306 | * GPIO */ |
daveyclk | 0:b33a6418e125 | 307 | FF_GPIO = 0x0100 |
daveyclk | 0:b33a6418e125 | 308 | |
daveyclk | 0:b33a6418e125 | 309 | }FF_t; |
daveyclk | 0:b33a6418e125 | 310 | |
daveyclk | 0:b33a6418e125 | 311 | /** |
daveyclk | 0:b33a6418e125 | 312 | * @enum EFF_t |
daveyclk | 0:b33a6418e125 | 313 | * @brief <h3> Extended Firmware Features </h3> |
daveyclk | 0:b33a6418e125 | 314 | * |
daveyclk | 0:b33a6418e125 | 315 | * @par |
daveyclk | 0:b33a6418e125 | 316 | * TTS language support. |
daveyclk | 0:b33a6418e125 | 317 | */ |
daveyclk | 0:b33a6418e125 | 318 | typedef enum |
daveyclk | 0:b33a6418e125 | 319 | { |
daveyclk | 0:b33a6418e125 | 320 | /** |
daveyclk | 0:b33a6418e125 | 321 | * US English */ |
daveyclk | 0:b33a6418e125 | 322 | EFF_US = 0x01, |
daveyclk | 0:b33a6418e125 | 323 | /** |
daveyclk | 0:b33a6418e125 | 324 | * German */ |
daveyclk | 0:b33a6418e125 | 325 | EFF_D = 0x02, |
daveyclk | 0:b33a6418e125 | 326 | /** |
daveyclk | 0:b33a6418e125 | 327 | * Castilian Spanish */ |
daveyclk | 0:b33a6418e125 | 328 | EFF_CS = 0x04, |
daveyclk | 0:b33a6418e125 | 329 | /** |
daveyclk | 0:b33a6418e125 | 330 | * French */ |
daveyclk | 0:b33a6418e125 | 331 | EFF_F = 0x08, |
daveyclk | 0:b33a6418e125 | 332 | /** |
daveyclk | 0:b33a6418e125 | 333 | * UK English */ |
daveyclk | 0:b33a6418e125 | 334 | EFF_UK = 0x10, |
daveyclk | 0:b33a6418e125 | 335 | /** |
daveyclk | 0:b33a6418e125 | 336 | * Latin Spanish */ |
daveyclk | 0:b33a6418e125 | 337 | EFF_LS = 0x20 |
daveyclk | 0:b33a6418e125 | 338 | |
daveyclk | 0:b33a6418e125 | 339 | }EFF_t; |
daveyclk | 0:b33a6418e125 | 340 | |
daveyclk | 0:b33a6418e125 | 341 | /** |
daveyclk | 0:b33a6418e125 | 342 | * @enum ASR_t |
daveyclk | 0:b33a6418e125 | 343 | * @brief <h3> Audio Sample Rate </h3> |
daveyclk | 0:b33a6418e125 | 344 | * |
daveyclk | 0:b33a6418e125 | 345 | * @par |
daveyclk | 0:b33a6418e125 | 346 | * Audio sample rate configuration.Used in audio configuration. |
daveyclk | 0:b33a6418e125 | 347 | * |
daveyclk | 0:b33a6418e125 | 348 | * @note |
daveyclk | 0:b33a6418e125 | 349 | * If desired, the ASR_AUTO setting may be used for ADPCM file playback. In |
daveyclk | 0:b33a6418e125 | 350 | * this case the sample rate used is the sample rate that was specified by the |
daveyclk | 0:b33a6418e125 | 351 | * encoder and stored in the encoded ADPCM file header. |
daveyclk | 0:b33a6418e125 | 352 | * |
daveyclk | 0:b33a6418e125 | 353 | * @note |
daveyclk | 0:b33a6418e125 | 354 | * ASR_11KHZ is reserved for use with TTS synthesis. All other sample rates |
daveyclk | 0:b33a6418e125 | 355 | * are reserved for use with ADPCM. |
daveyclk | 0:b33a6418e125 | 356 | */ |
daveyclk | 0:b33a6418e125 | 357 | typedef enum |
daveyclk | 0:b33a6418e125 | 358 | { |
daveyclk | 0:b33a6418e125 | 359 | /** |
daveyclk | 0:b33a6418e125 | 360 | * 8 kHz ( usable ) */ |
daveyclk | 0:b33a6418e125 | 361 | ASR_8KHZ = 0x00, |
daveyclk | 0:b33a6418e125 | 362 | /** |
daveyclk | 0:b33a6418e125 | 363 | * 11.025 kHz ( usable ) */ |
daveyclk | 0:b33a6418e125 | 364 | ASR_11KHZ = 0x01, |
daveyclk | 0:b33a6418e125 | 365 | /** |
daveyclk | 0:b33a6418e125 | 366 | * 12 kHz ( reserved ) */ |
daveyclk | 0:b33a6418e125 | 367 | ASR_12KHZ = 0x02, |
daveyclk | 0:b33a6418e125 | 368 | /** |
daveyclk | 0:b33a6418e125 | 369 | * 16 kHz ( usable ) */ |
daveyclk | 0:b33a6418e125 | 370 | ASR_16KHZ = 0x03, |
daveyclk | 0:b33a6418e125 | 371 | /** |
daveyclk | 0:b33a6418e125 | 372 | * 22.05 kHz ( reserved ) */ |
daveyclk | 0:b33a6418e125 | 373 | ASR_22KHZ = 0x04, |
daveyclk | 0:b33a6418e125 | 374 | /** |
daveyclk | 0:b33a6418e125 | 375 | * 24 kHz ( reserved ) */ |
daveyclk | 0:b33a6418e125 | 376 | ASR_24KHZ = 0x05, |
daveyclk | 0:b33a6418e125 | 377 | /** |
daveyclk | 0:b33a6418e125 | 378 | * 32 kHz ( reserved ) */ |
daveyclk | 0:b33a6418e125 | 379 | ASR_32KHZ = 0x06, |
daveyclk | 0:b33a6418e125 | 380 | /** |
daveyclk | 0:b33a6418e125 | 381 | * 44.1 kHz ( reserved ) */ |
daveyclk | 0:b33a6418e125 | 382 | ASR_44KHZ = 0x07, |
daveyclk | 0:b33a6418e125 | 383 | /** |
daveyclk | 0:b33a6418e125 | 384 | * 48 kHz ( reserved ) */ |
daveyclk | 0:b33a6418e125 | 385 | ASR_48KHZ = 0x08, |
daveyclk | 0:b33a6418e125 | 386 | /** |
daveyclk | 0:b33a6418e125 | 387 | * Set by application */ |
daveyclk | 0:b33a6418e125 | 388 | ASR_AUTO = 0x09 |
daveyclk | 0:b33a6418e125 | 389 | |
daveyclk | 0:b33a6418e125 | 390 | }ASR_t; |
daveyclk | 0:b33a6418e125 | 391 | |
daveyclk | 0:b33a6418e125 | 392 | /** |
daveyclk | 0:b33a6418e125 | 393 | * @enum TTS_VOICE_t |
daveyclk | 0:b33a6418e125 | 394 | * @brief <h3> Voice Configuration </h3> |
daveyclk | 0:b33a6418e125 | 395 | */ |
daveyclk | 0:b33a6418e125 | 396 | typedef enum |
daveyclk | 0:b33a6418e125 | 397 | { |
daveyclk | 0:b33a6418e125 | 398 | /** |
daveyclk | 0:b33a6418e125 | 399 | * UK English */ |
daveyclk | 0:b33a6418e125 | 400 | TTSV_US = 0x00, |
daveyclk | 0:b33a6418e125 | 401 | /** |
daveyclk | 0:b33a6418e125 | 402 | * Castilian Spanish */ |
daveyclk | 0:b33a6418e125 | 403 | TTSV_CS = 0x01, |
daveyclk | 0:b33a6418e125 | 404 | /** |
daveyclk | 0:b33a6418e125 | 405 | * Latin Spanish */ |
daveyclk | 0:b33a6418e125 | 406 | TTSV_LS = 0x04 |
daveyclk | 0:b33a6418e125 | 407 | |
daveyclk | 0:b33a6418e125 | 408 | }TTSV_t; |
daveyclk | 0:b33a6418e125 | 409 | |
daveyclk | 0:b33a6418e125 | 410 | /** |
daveyclk | 0:b33a6418e125 | 411 | * @struct VER_t |
daveyclk | 0:b33a6418e125 | 412 | * @brief <h3> Device version </h3> |
daveyclk | 0:b33a6418e125 | 413 | * |
daveyclk | 0:b33a6418e125 | 414 | * @note |
daveyclk | 0:b33a6418e125 | 415 | * For the hardware version, the first number refers to the hardware platform, |
daveyclk | 0:b33a6418e125 | 416 | * and the second number refers to the ROM revision number. |
daveyclk | 0:b33a6418e125 | 417 | * |
daveyclk | 0:b33a6418e125 | 418 | * @note |
daveyclk | 0:b33a6418e125 | 419 | * The firmware versions are defined as version X.Y.Z. where X is the major |
daveyclk | 0:b33a6418e125 | 420 | * release number, Y is the minor release number ( typically associated with a |
daveyclk | 0:b33a6418e125 | 421 | * functionality enhancement ), and Z is an incremental ( bug fix ) release. |
daveyclk | 0:b33a6418e125 | 422 | */ |
daveyclk | 0:b33a6418e125 | 423 | typedef struct |
daveyclk | 0:b33a6418e125 | 424 | { |
daveyclk | 0:b33a6418e125 | 425 | /** |
daveyclk | 0:b33a6418e125 | 426 | * Hardware version*/ |
daveyclk | 0:b33a6418e125 | 427 | char hwver[ 5 ]; |
daveyclk | 0:b33a6418e125 | 428 | /** |
daveyclk | 0:b33a6418e125 | 429 | * Firmware version*/ |
daveyclk | 0:b33a6418e125 | 430 | char fwver[ 8 ]; |
daveyclk | 0:b33a6418e125 | 431 | /** |
daveyclk | 0:b33a6418e125 | 432 | * Firmware features*/ |
daveyclk | 0:b33a6418e125 | 433 | FF_t fwf; |
daveyclk | 0:b33a6418e125 | 434 | /** |
daveyclk | 0:b33a6418e125 | 435 | * Firmware extended features*/ |
daveyclk | 0:b33a6418e125 | 436 | EFF_t fwef; |
daveyclk | 0:b33a6418e125 | 437 | |
daveyclk | 0:b33a6418e125 | 438 | }VER_t; |
daveyclk | 0:b33a6418e125 | 439 | |
daveyclk | 0:b33a6418e125 | 440 | /** |
daveyclk | 0:b33a6418e125 | 441 | * @struct ACONF_t |
daveyclk | 0:b33a6418e125 | 442 | * @brief <h3> Audio Configuration </h3> |
daveyclk | 0:b33a6418e125 | 443 | * |
daveyclk | 0:b33a6418e125 | 444 | * @note |
daveyclk | 0:b33a6418e125 | 445 | * If DAC permanently on is set and minimum delay time is required before |
daveyclk | 0:b33a6418e125 | 446 | * audio output after receiving a data bearing message, an asr must be |
daveyclk | 0:b33a6418e125 | 447 | * selected. It must not be set to ASR_AUTO. |
daveyclk | 0:b33a6418e125 | 448 | * |
daveyclk | 0:b33a6418e125 | 449 | */ |
daveyclk | 0:b33a6418e125 | 450 | typedef struct |
daveyclk | 0:b33a6418e125 | 451 | { |
daveyclk | 0:b33a6418e125 | 452 | /** |
daveyclk | 0:b33a6418e125 | 453 | * Audio stereo ( 0x00 ) */ |
daveyclk | 0:b33a6418e125 | 454 | bool as; |
daveyclk | 0:b33a6418e125 | 455 | /** |
daveyclk | 0:b33a6418e125 | 456 | * Audio gain value ( 0x00 ~ 0x43 ) */ |
daveyclk | 0:b33a6418e125 | 457 | uint8_t ag; |
daveyclk | 0:b33a6418e125 | 458 | /** |
daveyclk | 0:b33a6418e125 | 459 | * Audio amplefier ( 0x00 ) */ |
daveyclk | 0:b33a6418e125 | 460 | bool amp; |
daveyclk | 0:b33a6418e125 | 461 | /** |
daveyclk | 0:b33a6418e125 | 462 | * Audio sample rate ( 0x00 / 0x01 / 0x03 / 0x09 ) */ |
daveyclk | 0:b33a6418e125 | 463 | ASR_t asr; |
daveyclk | 0:b33a6418e125 | 464 | /** |
daveyclk | 0:b33a6418e125 | 465 | * Audio routing ( 0x00 ) */ |
daveyclk | 0:b33a6418e125 | 466 | uint8_t ar; |
daveyclk | 0:b33a6418e125 | 467 | /** |
daveyclk | 0:b33a6418e125 | 468 | * Audio tone control ( 0x00 ) */ |
daveyclk | 0:b33a6418e125 | 469 | uint8_t atc; |
daveyclk | 0:b33a6418e125 | 470 | /** |
daveyclk | 0:b33a6418e125 | 471 | * Audio clock source ( 0x00 ) */ |
daveyclk | 0:b33a6418e125 | 472 | bool acs; |
daveyclk | 0:b33a6418e125 | 473 | /** |
daveyclk | 0:b33a6418e125 | 474 | * DAC control ( 0x00 / 0x01 ) */ |
daveyclk | 0:b33a6418e125 | 475 | bool dc; |
daveyclk | 0:b33a6418e125 | 476 | |
daveyclk | 0:b33a6418e125 | 477 | }ACONF_t; |
daveyclk | 0:b33a6418e125 | 478 | |
daveyclk | 0:b33a6418e125 | 479 | /** |
daveyclk | 0:b33a6418e125 | 480 | * @struct TTS_CONFIG_t |
daveyclk | 0:b33a6418e125 | 481 | * @brief <h3> Text To Speech Configuration </h3> |
daveyclk | 0:b33a6418e125 | 482 | * |
daveyclk | 0:b33a6418e125 | 483 | * @par |
daveyclk | 0:b33a6418e125 | 484 | * TTS configuration can only be used when the TTS system is inactive. |
daveyclk | 0:b33a6418e125 | 485 | * |
daveyclk | 0:b33a6418e125 | 486 | * @note |
daveyclk | 0:b33a6418e125 | 487 | * The valid range for speaking rate is 0x004B to 0x0258. A suitable default |
daveyclk | 0:b33a6418e125 | 488 | * value is 200 words/min ( 0x00C8 ). |
daveyclk | 0:b33a6418e125 | 489 | */ |
daveyclk | 0:b33a6418e125 | 490 | typedef struct |
daveyclk | 0:b33a6418e125 | 491 | { |
daveyclk | 0:b33a6418e125 | 492 | /** |
daveyclk | 0:b33a6418e125 | 493 | * Sample rate ( 0x01 ) */ |
daveyclk | 0:b33a6418e125 | 494 | uint8_t sr; |
daveyclk | 0:b33a6418e125 | 495 | /** |
daveyclk | 0:b33a6418e125 | 496 | * Voice selection ( 0x01 ~ 0x09 ) */ |
daveyclk | 0:b33a6418e125 | 497 | uint8_t voice; |
daveyclk | 0:b33a6418e125 | 498 | /** |
daveyclk | 0:b33a6418e125 | 499 | * Epson parse ( true / false ) */ |
daveyclk | 0:b33a6418e125 | 500 | bool ep; |
daveyclk | 0:b33a6418e125 | 501 | /** |
daveyclk | 0:b33a6418e125 | 502 | * TTS language ( 0x01 / 0x01 / 0x04 ) */ |
daveyclk | 0:b33a6418e125 | 503 | TTSV_t lang; |
daveyclk | 0:b33a6418e125 | 504 | /** |
daveyclk | 0:b33a6418e125 | 505 | * Speaking rate in words per minute */ |
daveyclk | 0:b33a6418e125 | 506 | uint8_t sr_wpm_lsb; |
daveyclk | 0:b33a6418e125 | 507 | uint8_t sr_wpm_msb; |
daveyclk | 0:b33a6418e125 | 508 | /** |
daveyclk | 0:b33a6418e125 | 509 | * Data Source ( 0x00 ) */ |
daveyclk | 0:b33a6418e125 | 510 | uint8_t ds; |
daveyclk | 0:b33a6418e125 | 511 | /** |
daveyclk | 0:b33a6418e125 | 512 | * Reserved ( 0x00 ) */ |
daveyclk | 0:b33a6418e125 | 513 | uint8_t res; |
daveyclk | 0:b33a6418e125 | 514 | |
daveyclk | 0:b33a6418e125 | 515 | }TTSCONF_t; |
daveyclk | 0:b33a6418e125 | 516 | |
daveyclk | 0:b33a6418e125 | 517 | /** |
daveyclk | 0:b33a6418e125 | 518 | * @struct PMANCONF_t |
daveyclk | 0:b33a6418e125 | 519 | * @brief <h3> Power Manager Configuration </h3> |
daveyclk | 0:b33a6418e125 | 520 | */ |
daveyclk | 0:b33a6418e125 | 521 | typedef struct |
daveyclk | 0:b33a6418e125 | 522 | { |
daveyclk | 0:b33a6418e125 | 523 | /** |
daveyclk | 0:b33a6418e125 | 524 | * Audio mode ( 0x01 ) */ |
daveyclk | 0:b33a6418e125 | 525 | uint8_t am_lsb; |
daveyclk | 0:b33a6418e125 | 526 | uint8_t am_msb; |
daveyclk | 0:b33a6418e125 | 527 | /** |
daveyclk | 0:b33a6418e125 | 528 | * SPI bit clock frequency ( 0x01 ) */ |
daveyclk | 0:b33a6418e125 | 529 | uint8_t spi_clk; |
daveyclk | 0:b33a6418e125 | 530 | /** |
daveyclk | 0:b33a6418e125 | 531 | * Padding byte */ |
daveyclk | 0:b33a6418e125 | 532 | uint8_t pad; |
daveyclk | 0:b33a6418e125 | 533 | |
daveyclk | 0:b33a6418e125 | 534 | }PMANCONF_t; |
daveyclk | 0:b33a6418e125 | 535 | |
daveyclk | 0:b33a6418e125 | 536 | /****************************************************************************** |
daveyclk | 0:b33a6418e125 | 537 | * Variables |
daveyclk | 0:b33a6418e125 | 538 | *******************************************************************************/ |
daveyclk | 0:b33a6418e125 | 539 | |
daveyclk | 0:b33a6418e125 | 540 | /****************************************************************************** |
daveyclk | 0:b33a6418e125 | 541 | * Function Prototypes |
daveyclk | 0:b33a6418e125 | 542 | *******************************************************************************/ |
daveyclk | 0:b33a6418e125 | 543 | |
daveyclk | 0:b33a6418e125 | 544 | |
daveyclk | 0:b33a6418e125 | 545 | /** |
daveyclk | 0:b33a6418e125 | 546 | * @brief <h3> Text to Speech Initialization </h3> |
daveyclk | 0:b33a6418e125 | 547 | * |
daveyclk | 0:b33a6418e125 | 548 | * @par |
daveyclk | 0:b33a6418e125 | 549 | * Sets all needed internal parameters to default. This function must be called |
daveyclk | 0:b33a6418e125 | 550 | * before any other function. |
daveyclk | 0:b33a6418e125 | 551 | */ |
daveyclk | 0:b33a6418e125 | 552 | void tts_init( void ); |
daveyclk | 0:b33a6418e125 | 553 | |
daveyclk | 0:b33a6418e125 | 554 | /** |
daveyclk | 0:b33a6418e125 | 555 | * @brief <h3> Message Block Callback </h3> |
daveyclk | 0:b33a6418e125 | 556 | * |
daveyclk | 0:b33a6418e125 | 557 | * @par |
daveyclk | 0:b33a6418e125 | 558 | * Callback function must be made by user and will be called |
daveyclk | 0:b33a6418e125 | 559 | * every time when message block response is received. |
daveyclk | 0:b33a6418e125 | 560 | * Message block is sent in response to a request that has been blocked by |
daveyclk | 0:b33a6418e125 | 561 | * the device system controller. Request messages are blocked usually when |
daveyclk | 0:b33a6418e125 | 562 | * the system controller identifies that there is insufficient system |
daveyclk | 0:b33a6418e125 | 563 | * resource to service the request. |
daveyclk | 0:b33a6418e125 | 564 | * |
daveyclk | 0:b33a6418e125 | 565 | * @note |
daveyclk | 0:b33a6418e125 | 566 | * All request messages are blocked if the interface has not been |
daveyclk | 0:b33a6418e125 | 567 | * registered. |
daveyclk | 0:b33a6418e125 | 568 | * |
daveyclk | 0:b33a6418e125 | 569 | * @par |
daveyclk | 0:b33a6418e125 | 570 | * <h4> Example :</h4> |
daveyclk | 0:b33a6418e125 | 571 | * |
daveyclk | 0:b33a6418e125 | 572 | * @code |
daveyclk | 0:b33a6418e125 | 573 | * // Declaration of callback for blocked messages |
daveyclk | 0:b33a6418e125 | 574 | * void msg_blk( uint16_t *req, uint16_t *err ) |
daveyclk | 0:b33a6418e125 | 575 | * { |
daveyclk | 0:b33a6418e125 | 576 | * char txt[ 15 ]; |
daveyclk | 0:b33a6418e125 | 577 | * |
daveyclk | 0:b33a6418e125 | 578 | * UART_Write_Text( " Message blocked : " ); |
daveyclk | 0:b33a6418e125 | 579 | * sprinti( txt, "%x\r\n", *req ); |
daveyclk | 0:b33a6418e125 | 580 | * UART_Write_Text( txt ); |
daveyclk | 0:b33a6418e125 | 581 | * sprinti( txt, "%x\r\n", *err ); |
daveyclk | 0:b33a6418e125 | 582 | * UART_Write_Text( txt ); |
daveyclk | 0:b33a6418e125 | 583 | * } |
daveyclk | 0:b33a6418e125 | 584 | * |
daveyclk | 0:b33a6418e125 | 585 | * // Setting up |
daveyclk | 0:b33a6418e125 | 586 | * tts_msg_block_callback( msg_blk ); |
daveyclk | 0:b33a6418e125 | 587 | * @endcode |
daveyclk | 0:b33a6418e125 | 588 | * |
daveyclk | 0:b33a6418e125 | 589 | */ |
daveyclk | 0:b33a6418e125 | 590 | void tts_msg_block_callback( void( *msg_blk_ptr )( uint16_t *req_ptr, |
daveyclk | 0:b33a6418e125 | 591 | uint16_t *err_ptr ) ); |
daveyclk | 0:b33a6418e125 | 592 | /** |
daveyclk | 0:b33a6418e125 | 593 | * @brief <h3> Fatal Error Callback </h3> |
daveyclk | 0:b33a6418e125 | 594 | * |
daveyclk | 0:b33a6418e125 | 595 | * @par |
daveyclk | 0:b33a6418e125 | 596 | * This function adds the callback function made by user that will be called |
daveyclk | 0:b33a6418e125 | 597 | * every time when fatal error indication is received so user can handle |
daveyclk | 0:b33a6418e125 | 598 | * fatal error exception. Once fatal error is received user should |
daveyclk | 0:b33a6418e125 | 599 | * restart the module. |
daveyclk | 0:b33a6418e125 | 600 | * |
daveyclk | 0:b33a6418e125 | 601 | * @par |
daveyclk | 0:b33a6418e125 | 602 | * <h4> Example :</h4> |
daveyclk | 0:b33a6418e125 | 603 | * |
daveyclk | 0:b33a6418e125 | 604 | * @code |
daveyclk | 0:b33a6418e125 | 605 | * // Declaration of callback for fatal errors |
daveyclk | 0:b33a6418e125 | 606 | * void fatal_err( uint16_t *err ) |
daveyclk | 0:b33a6418e125 | 607 | * { |
daveyclk | 0:b33a6418e125 | 608 | * UART_Write_Text( "Fatal Error Occured - TTS restart..." ); |
daveyclk | 0:b33a6418e125 | 609 | * // Reinitialization of TTS |
daveyclk | 0:b33a6418e125 | 610 | * tts_init(); |
daveyclk | 0:b33a6418e125 | 611 | * // Reset the callback |
daveyclk | 0:b33a6418e125 | 612 | * tts_fatal_err_callback( fatal_err ); |
daveyclk | 0:b33a6418e125 | 613 | * } |
daveyclk | 0:b33a6418e125 | 614 | * |
daveyclk | 0:b33a6418e125 | 615 | * // Setting up |
daveyclk | 0:b33a6418e125 | 616 | * tts_fatal_err_callback( fatal_err ); |
daveyclk | 0:b33a6418e125 | 617 | * @endcode |
daveyclk | 0:b33a6418e125 | 618 | */ |
daveyclk | 0:b33a6418e125 | 619 | void tts_fatal_err_callback( void( *fatal_err_ptr )( uint16_t *err_ptr ) ); |
daveyclk | 0:b33a6418e125 | 620 | |
daveyclk | 0:b33a6418e125 | 621 | /** |
daveyclk | 0:b33a6418e125 | 622 | * @brief <h3> Non Fatal Error </h3> |
daveyclk | 0:b33a6418e125 | 623 | * |
daveyclk | 0:b33a6418e125 | 624 | * @par |
daveyclk | 0:b33a6418e125 | 625 | * This function adds the callback function made by user that will be called |
daveyclk | 0:b33a6418e125 | 626 | * every time when non fatal error inidication is received. |
daveyclk | 0:b33a6418e125 | 627 | * |
daveyclk | 0:b33a6418e125 | 628 | * @par |
daveyclk | 0:b33a6418e125 | 629 | * <h4> Example :</h4> |
daveyclk | 0:b33a6418e125 | 630 | * |
daveyclk | 0:b33a6418e125 | 631 | * @code |
daveyclk | 0:b33a6418e125 | 632 | * // Declaration of callback for error occurence |
daveyclk | 0:b33a6418e125 | 633 | * void err_detected( uint16_t *err ) |
daveyclk | 0:b33a6418e125 | 634 | * { |
daveyclk | 0:b33a6418e125 | 635 | * char txt[ 15 ]; |
daveyclk | 0:b33a6418e125 | 636 | * |
daveyclk | 0:b33a6418e125 | 637 | * UART_Write_Text( " Error occured : " ); |
daveyclk | 0:b33a6418e125 | 638 | * sprinti( txt, "%x\r\n", *err ); |
daveyclk | 0:b33a6418e125 | 639 | * UART_Write_Text( txt ); |
daveyclk | 0:b33a6418e125 | 640 | * } |
daveyclk | 0:b33a6418e125 | 641 | * |
daveyclk | 0:b33a6418e125 | 642 | * // Setting up |
daveyclk | 0:b33a6418e125 | 643 | * tts_err_callback( err_detected ); |
daveyclk | 0:b33a6418e125 | 644 | * @endcode |
daveyclk | 0:b33a6418e125 | 645 | */ |
daveyclk | 0:b33a6418e125 | 646 | void tts_err_callback( void( *error_ptr )( uint16_t *err_ptr ) ); |
daveyclk | 0:b33a6418e125 | 647 | |
daveyclk | 0:b33a6418e125 | 648 | /** |
daveyclk | 0:b33a6418e125 | 649 | * @brief <h3> TTS Hardware Mute </h3> |
daveyclk | 0:b33a6418e125 | 650 | * |
daveyclk | 0:b33a6418e125 | 651 | * @par |
daveyclk | 0:b33a6418e125 | 652 | * Mute using MUT pin |
daveyclk | 0:b33a6418e125 | 653 | */ |
daveyclk | 0:b33a6418e125 | 654 | void tts_mute( void ); |
daveyclk | 0:b33a6418e125 | 655 | |
daveyclk | 0:b33a6418e125 | 656 | /** |
daveyclk | 0:b33a6418e125 | 657 | * @brief <h3> TTS Hardware Unmute </h3> |
daveyclk | 0:b33a6418e125 | 658 | * |
daveyclk | 0:b33a6418e125 | 659 | * @par |
daveyclk | 0:b33a6418e125 | 660 | * Unmute using MUT pin |
daveyclk | 0:b33a6418e125 | 661 | */ |
daveyclk | 0:b33a6418e125 | 662 | void tts_unmute( void ); |
daveyclk | 0:b33a6418e125 | 663 | |
daveyclk | 0:b33a6418e125 | 664 | /** |
daveyclk | 0:b33a6418e125 | 665 | * @brief <h3> Default setup </h3> |
daveyclk | 0:b33a6418e125 | 666 | * |
daveyclk | 0:b33a6418e125 | 667 | * @par |
daveyclk | 0:b33a6418e125 | 668 | * Should be used after the @link tts_init @endlink to upload the init data |
daveyclk | 0:b33a6418e125 | 669 | * and configure the click board in the most common manner. |
daveyclk | 0:b33a6418e125 | 670 | */ |
daveyclk | 0:b33a6418e125 | 671 | void tts_setup( void ); |
daveyclk | 0:b33a6418e125 | 672 | |
daveyclk | 0:b33a6418e125 | 673 | /** |
daveyclk | 0:b33a6418e125 | 674 | * @brief <h3> Requests Version in Boot Mode </h3> |
daveyclk | 0:b33a6418e125 | 675 | * |
daveyclk | 0:b33a6418e125 | 676 | * @par |
daveyclk | 0:b33a6418e125 | 677 | * Used to request information about the chip hardware version. |
daveyclk | 0:b33a6418e125 | 678 | * This request should be performed after the power on or restart |
daveyclk | 0:b33a6418e125 | 679 | * routine. The functionality to wait |
daveyclk | 0:b33a6418e125 | 680 | * @link RESET_TO_BOOT_TIME @endlink |
daveyclk | 0:b33a6418e125 | 681 | * is already implemented into the restart function and don't care |
daveyclk | 0:b33a6418e125 | 682 | * about that timing. This is the simpliest way to check does device is |
daveyclk | 0:b33a6418e125 | 683 | * powered on and to check the basic functionality of the device itself. |
daveyclk | 0:b33a6418e125 | 684 | * For detailed information about version of the device you should use |
daveyclk | 0:b33a6418e125 | 685 | * @link tts_version_main @endlink . For more information |
daveyclk | 0:b33a6418e125 | 686 | * @link VER_t @endlink . |
daveyclk | 0:b33a6418e125 | 687 | * |
daveyclk | 0:b33a6418e125 | 688 | * @par |
daveyclk | 0:b33a6418e125 | 689 | * <h4> Example : </h4> |
daveyclk | 0:b33a6418e125 | 690 | * |
daveyclk | 0:b33a6418e125 | 691 | * @code |
daveyclk | 0:b33a6418e125 | 692 | * VER_t boot_ver; |
daveyclk | 0:b33a6418e125 | 693 | * |
daveyclk | 0:b33a6418e125 | 694 | * if( !tts_version_boot( boot_ver ) ) |
daveyclk | 0:b33a6418e125 | 695 | * { |
daveyclk | 0:b33a6418e125 | 696 | * UART_Write_Text( boot_ver.hwver ); |
daveyclk | 0:b33a6418e125 | 697 | * } |
daveyclk | 0:b33a6418e125 | 698 | * @endcode |
daveyclk | 0:b33a6418e125 | 699 | */ |
daveyclk | 0:b33a6418e125 | 700 | void tts_version_boot( void ); |
daveyclk | 0:b33a6418e125 | 701 | //uint16_t tts_version_boot( VER_t *version ); |
daveyclk | 0:b33a6418e125 | 702 | |
daveyclk | 0:b33a6418e125 | 703 | /** |
daveyclk | 0:b33a6418e125 | 704 | * @brief <h3> Loads Code Image into the SRAM </h3> |
daveyclk | 0:b33a6418e125 | 705 | * |
daveyclk | 0:b33a6418e125 | 706 | * @par |
daveyclk | 0:b33a6418e125 | 707 | * This request must be pefrormed after the power on or restart |
daveyclk | 0:b33a6418e125 | 708 | * routine and before the entering to main mode. |
daveyclk | 0:b33a6418e125 | 709 | * |
daveyclk | 0:b33a6418e125 | 710 | * @param[in] image - valid image |
daveyclk | 0:b33a6418e125 | 711 | * @param[in] count - image length in bytes |
daveyclk | 0:b33a6418e125 | 712 | * |
daveyclk | 0:b33a6418e125 | 713 | * @note Keep on mind that because of large image size this loadnig can take |
daveyclk | 0:b33a6418e125 | 714 | * few seconds, depends on SPI bus speed. |
daveyclk | 0:b33a6418e125 | 715 | * |
daveyclk | 0:b33a6418e125 | 716 | * @par |
daveyclk | 0:b33a6418e125 | 717 | * <h4> Example : </h4> |
daveyclk | 0:b33a6418e125 | 718 | * |
daveyclk | 0:b33a6418e125 | 719 | * @code |
daveyclk | 0:b33a6418e125 | 720 | * if( !tts_image_load( TTS_INIT_DATA, sizeof( TTS_INIT_DATA ) ) ) |
daveyclk | 0:b33a6418e125 | 721 | * UART_Write_Text( "Image loading done successfully"); |
daveyclk | 0:b33a6418e125 | 722 | * else |
daveyclk | 0:b33a6418e125 | 723 | * UART_Write_Text( "Image loading error"); |
daveyclk | 0:b33a6418e125 | 724 | * @endcode |
daveyclk | 0:b33a6418e125 | 725 | */ |
daveyclk | 0:b33a6418e125 | 726 | uint16_t tts_image_load( const uint8_t *image, |
daveyclk | 0:b33a6418e125 | 727 | uint16_t count ); |
daveyclk | 0:b33a6418e125 | 728 | |
daveyclk | 0:b33a6418e125 | 729 | /** |
daveyclk | 0:b33a6418e125 | 730 | * @brief <h3> Starts Executing Image and Enters the Main Mode </h3> |
daveyclk | 0:b33a6418e125 | 731 | * |
daveyclk | 0:b33a6418e125 | 732 | * @par |
daveyclk | 0:b33a6418e125 | 733 | * This request enters from boot to main mode after completion of loading the |
daveyclk | 0:b33a6418e125 | 734 | * initialisation data. This function is used to switch to running in main |
daveyclk | 0:b33a6418e125 | 735 | * mode. The functionality to wait |
daveyclk | 0:b33a6418e125 | 736 | * @link |
daveyclk | 0:b33a6418e125 | 737 | * BOOT_TO_MAIN_MODE |
daveyclk | 0:b33a6418e125 | 738 | * @endlink |
daveyclk | 0:b33a6418e125 | 739 | * is already implemented inside the restart function so don't care |
daveyclk | 0:b33a6418e125 | 740 | * about that timing. |
daveyclk | 0:b33a6418e125 | 741 | * |
daveyclk | 0:b33a6418e125 | 742 | * @par |
daveyclk | 0:b33a6418e125 | 743 | * <h4> Example : </h4> |
daveyclk | 0:b33a6418e125 | 744 | * |
daveyclk | 0:b33a6418e125 | 745 | * @code |
daveyclk | 0:b33a6418e125 | 746 | * if( !tts_image_exec() ) |
daveyclk | 0:b33a6418e125 | 747 | UART_Write_Text( "Main mode entered successfully" ); |
daveyclk | 0:b33a6418e125 | 748 | * @endcode |
daveyclk | 0:b33a6418e125 | 749 | */ |
daveyclk | 0:b33a6418e125 | 750 | uint16_t tts_image_exec( void ); |
daveyclk | 0:b33a6418e125 | 751 | |
daveyclk | 0:b33a6418e125 | 752 | /** |
daveyclk | 0:b33a6418e125 | 753 | * @brief <h3> Test & Register Host Hardware Interface </h3> |
daveyclk | 0:b33a6418e125 | 754 | * |
daveyclk | 0:b33a6418e125 | 755 | * @par |
daveyclk | 0:b33a6418e125 | 756 | * This request must be called after the entering the main mode because it |
daveyclk | 0:b33a6418e125 | 757 | * register the host with the device ( S1V30120 ). If request is performed |
daveyclk | 0:b33a6418e125 | 758 | * without errors that indicates the device is operating correctly and host |
daveyclk | 0:b33a6418e125 | 759 | * registration was successful. |
daveyclk | 0:b33a6418e125 | 760 | * |
daveyclk | 0:b33a6418e125 | 761 | * @par |
daveyclk | 0:b33a6418e125 | 762 | * <h4> Example : </h4> |
daveyclk | 0:b33a6418e125 | 763 | * |
daveyclk | 0:b33a6418e125 | 764 | * @code |
daveyclk | 0:b33a6418e125 | 765 | * if( !tts_interface_test() ) |
daveyclk | 0:b33a6418e125 | 766 | * UART_Write_Text( "Interface test - success" ); |
daveyclk | 0:b33a6418e125 | 767 | * @endcode |
daveyclk | 0:b33a6418e125 | 768 | */ |
daveyclk | 0:b33a6418e125 | 769 | uint16_t tts_interface_test( void ); |
daveyclk | 0:b33a6418e125 | 770 | |
daveyclk | 0:b33a6418e125 | 771 | /** |
daveyclk | 0:b33a6418e125 | 772 | * @brief <h3> Version & Support Info in Main Mode </h3> |
daveyclk | 0:b33a6418e125 | 773 | * |
daveyclk | 0:b33a6418e125 | 774 | * @par |
daveyclk | 0:b33a6418e125 | 775 | * Used to request information about the hardware version, firmware |
daveyclk | 0:b33a6418e125 | 776 | * version and supported firmware functionality. Returns informations |
daveyclk | 0:b33a6418e125 | 777 | * about current system version, more info |
daveyclk | 0:b33a6418e125 | 778 | * @link VER_t @endlink |
daveyclk | 0:b33a6418e125 | 779 | * |
daveyclk | 0:b33a6418e125 | 780 | * @par |
daveyclk | 0:b33a6418e125 | 781 | * <h4> Example : </h4> |
daveyclk | 0:b33a6418e125 | 782 | * |
daveyclk | 0:b33a6418e125 | 783 | * @code |
daveyclk | 0:b33a6418e125 | 784 | * VER_t current_version; |
daveyclk | 0:b33a6418e125 | 785 | * |
daveyclk | 0:b33a6418e125 | 786 | * if ( !tts_version_main( ¤t_version ) ) |
daveyclk | 0:b33a6418e125 | 787 | * { |
daveyclk | 0:b33a6418e125 | 788 | * UART_Write_Text( current_version.hwver ); |
daveyclk | 0:b33a6418e125 | 789 | * UART_Write_Text( current_version.fwver ); |
daveyclk | 0:b33a6418e125 | 790 | * } |
daveyclk | 0:b33a6418e125 | 791 | * @endcode |
daveyclk | 0:b33a6418e125 | 792 | */ |
daveyclk | 0:b33a6418e125 | 793 | uint16_t tts_version_main( VER_t *buffer ); |
daveyclk | 0:b33a6418e125 | 794 | |
daveyclk | 0:b33a6418e125 | 795 | /** |
daveyclk | 0:b33a6418e125 | 796 | * @brief <h3> Power Manager Configuration </h3> |
daveyclk | 0:b33a6418e125 | 797 | * |
daveyclk | 0:b33a6418e125 | 798 | * @par |
daveyclk | 0:b33a6418e125 | 799 | * Request to configure power manager with default parameters. |
daveyclk | 0:b33a6418e125 | 800 | * |
daveyclk | 0:b33a6418e125 | 801 | * @note All of parameters are configured automaticly by device |
daveyclk | 0:b33a6418e125 | 802 | * and this request also doesnt have any parameters yet. |
daveyclk | 0:b33a6418e125 | 803 | * |
daveyclk | 0:b33a6418e125 | 804 | * @par |
daveyclk | 0:b33a6418e125 | 805 | * <h4> Example : </h4> |
daveyclk | 0:b33a6418e125 | 806 | * |
daveyclk | 0:b33a6418e125 | 807 | * @code |
daveyclk | 0:b33a6418e125 | 808 | * if( !tts_power_default_config() ) |
daveyclk | 0:b33a6418e125 | 809 | * UART_Write_Text( "Power configuration done !" ); |
daveyclk | 0:b33a6418e125 | 810 | * @endcode |
daveyclk | 0:b33a6418e125 | 811 | */ |
daveyclk | 0:b33a6418e125 | 812 | uint16_t tts_power_default_config( void ); |
daveyclk | 0:b33a6418e125 | 813 | |
daveyclk | 0:b33a6418e125 | 814 | /** |
daveyclk | 0:b33a6418e125 | 815 | * @brief <h3> Entry to standby mode </h3> |
daveyclk | 0:b33a6418e125 | 816 | * |
daveyclk | 0:b33a6418e125 | 817 | * @par |
daveyclk | 0:b33a6418e125 | 818 | * Request can be used to reach the lowest power mode. |
daveyclk | 0:b33a6418e125 | 819 | * Most power management on the device is performed automatically by the |
daveyclk | 0:b33a6418e125 | 820 | * device without intervention from the host. |
daveyclk | 0:b33a6418e125 | 821 | * However, to reach the lowest power mode, Standby Mode, the host has to |
daveyclk | 0:b33a6418e125 | 822 | * request entry to this mode. Device can leave this mode only with |
daveyclk | 0:b33a6418e125 | 823 | * @link tts_standby_exit @endlink. |
daveyclk | 0:b33a6418e125 | 824 | * Time needed to enter the standby mode |
daveyclk | 0:b33a6418e125 | 825 | * @link STBY_MODE_ENTERY @endlink |
daveyclk | 0:b33a6418e125 | 826 | * is already implemented and you don't have to care about that. |
daveyclk | 0:b33a6418e125 | 827 | * |
daveyclk | 0:b33a6418e125 | 828 | * @par |
daveyclk | 0:b33a6418e125 | 829 | * <h4> Example : </h4> |
daveyclk | 0:b33a6418e125 | 830 | * |
daveyclk | 0:b33a6418e125 | 831 | * @code |
daveyclk | 0:b33a6418e125 | 832 | * if( !tts_standby_enter() ) |
daveyclk | 0:b33a6418e125 | 833 | * UART_Write_Text( "Standby mode entered !" ); |
daveyclk | 0:b33a6418e125 | 834 | * @endcode |
daveyclk | 0:b33a6418e125 | 835 | */ |
daveyclk | 0:b33a6418e125 | 836 | uint16_t tts_standby_enter( void ); |
daveyclk | 0:b33a6418e125 | 837 | |
daveyclk | 0:b33a6418e125 | 838 | /** |
daveyclk | 0:b33a6418e125 | 839 | * @brief <h3> Standby Mode Exit </h3> |
daveyclk | 0:b33a6418e125 | 840 | * |
daveyclk | 0:b33a6418e125 | 841 | * @par |
daveyclk | 0:b33a6418e125 | 842 | * Request wakes up the device from standby mode. This is only request |
daveyclk | 0:b33a6418e125 | 843 | * that device can performe whhile it is in standby mode. |
daveyclk | 0:b33a6418e125 | 844 | * |
daveyclk | 0:b33a6418e125 | 845 | * @par |
daveyclk | 0:b33a6418e125 | 846 | * <h4> Example : </h4> |
daveyclk | 0:b33a6418e125 | 847 | * |
daveyclk | 0:b33a6418e125 | 848 | * @code |
daveyclk | 0:b33a6418e125 | 849 | * if( !tts_standby_exit() ) |
daveyclk | 0:b33a6418e125 | 850 | * UART_Write_Text( "Standby mode exited !" ); |
daveyclk | 0:b33a6418e125 | 851 | * @endcode |
daveyclk | 0:b33a6418e125 | 852 | */ |
daveyclk | 0:b33a6418e125 | 853 | uint16_t tts_standby_exit( void ); |
daveyclk | 0:b33a6418e125 | 854 | |
daveyclk | 0:b33a6418e125 | 855 | /** |
daveyclk | 0:b33a6418e125 | 856 | * @brief <h3> Configure Audio Output </h3> |
daveyclk | 0:b33a6418e125 | 857 | * |
daveyclk | 0:b33a6418e125 | 858 | * @par |
daveyclk | 0:b33a6418e125 | 859 | * Audio configuration is required before starting speech/audio playback. |
daveyclk | 0:b33a6418e125 | 860 | * Request sends default audio configuration to device. |
daveyclk | 0:b33a6418e125 | 861 | * |
daveyclk | 0:b33a6418e125 | 862 | * @par |
daveyclk | 0:b33a6418e125 | 863 | * <h4> Example : </h4> |
daveyclk | 0:b33a6418e125 | 864 | * |
daveyclk | 0:b33a6418e125 | 865 | * @code |
daveyclk | 0:b33a6418e125 | 866 | * if( !tts_audio_default_config() ) |
daveyclk | 0:b33a6418e125 | 867 | * UART_Write_Text( "Audio configuration done !" ); |
daveyclk | 0:b33a6418e125 | 868 | * @endcode |
daveyclk | 0:b33a6418e125 | 869 | */ |
daveyclk | 0:b33a6418e125 | 870 | uint16_t tts_audio_default_config( void ); |
daveyclk | 0:b33a6418e125 | 871 | |
daveyclk | 0:b33a6418e125 | 872 | /** |
daveyclk | 0:b33a6418e125 | 873 | * @brief <h3> Sets the audio output configuration. </h3> |
daveyclk | 0:b33a6418e125 | 874 | * |
daveyclk | 0:b33a6418e125 | 875 | * @par |
daveyclk | 0:b33a6418e125 | 876 | * Audio configuration is required before starting speech/audio playback. |
daveyclk | 0:b33a6418e125 | 877 | * |
daveyclk | 0:b33a6418e125 | 878 | * @param[in] audio_gain ( -49 ~ 19 ) |
daveyclk | 0:b33a6418e125 | 879 | * @param[in] sample_rate |
daveyclk | 0:b33a6418e125 | 880 | * @param[in] dac_control ( true / false ) |
daveyclk | 0:b33a6418e125 | 881 | * |
daveyclk | 0:b33a6418e125 | 882 | * @par |
daveyclk | 0:b33a6418e125 | 883 | * <h4> Example : </h4> |
daveyclk | 0:b33a6418e125 | 884 | * |
daveyclk | 0:b33a6418e125 | 885 | * @code |
daveyclk | 0:b33a6418e125 | 886 | * if( !tts_audio_config( 10, ASR_11KHZ, true ) ) |
daveyclk | 0:b33a6418e125 | 887 | * UART_Write_Text( "Advanced audio configuration done !" ); |
daveyclk | 0:b33a6418e125 | 888 | * @endcode |
daveyclk | 0:b33a6418e125 | 889 | */ |
daveyclk | 0:b33a6418e125 | 890 | uint16_t tts_audio_config( int8_t audio_gain, |
daveyclk | 0:b33a6418e125 | 891 | ASR_t sample_rate, |
daveyclk | 0:b33a6418e125 | 892 | bool dac_control ); |
daveyclk | 0:b33a6418e125 | 893 | |
daveyclk | 0:b33a6418e125 | 894 | /** |
daveyclk | 0:b33a6418e125 | 895 | * @brief <h3> Set volume ( Analogue Gain ) </h3> |
daveyclk | 0:b33a6418e125 | 896 | * |
daveyclk | 0:b33a6418e125 | 897 | * @par |
daveyclk | 0:b33a6418e125 | 898 | * Request changes the output audio volume and sends it to the device. |
daveyclk | 0:b33a6418e125 | 899 | * Value is gain increment / decrement in dB. |
daveyclk | 0:b33a6418e125 | 900 | * |
daveyclk | 0:b33a6418e125 | 901 | * @param[in] audio_gain |
daveyclk | 0:b33a6418e125 | 902 | * |
daveyclk | 0:b33a6418e125 | 903 | * @par |
daveyclk | 0:b33a6418e125 | 904 | * <h4> Example : </h4> |
daveyclk | 0:b33a6418e125 | 905 | * |
daveyclk | 0:b33a6418e125 | 906 | * @code |
daveyclk | 0:b33a6418e125 | 907 | * if( !tts_volume_set( 0 ) ) |
daveyclk | 0:b33a6418e125 | 908 | * UART1_Write_Text( "Volume setting done !" ); |
daveyclk | 0:b33a6418e125 | 909 | * @endcode |
daveyclk | 0:b33a6418e125 | 910 | */ |
daveyclk | 0:b33a6418e125 | 911 | uint16_t tts_volume_set( int16_t gain ); |
daveyclk | 0:b33a6418e125 | 912 | |
daveyclk | 0:b33a6418e125 | 913 | /** |
daveyclk | 0:b33a6418e125 | 914 | * @brief <h3> Mute Audio Output </h3> |
daveyclk | 0:b33a6418e125 | 915 | * |
daveyclk | 0:b33a6418e125 | 916 | * @par |
daveyclk | 0:b33a6418e125 | 917 | * Request mutes the audio output immediately. |
daveyclk | 0:b33a6418e125 | 918 | * |
daveyclk | 0:b33a6418e125 | 919 | * @par |
daveyclk | 0:b33a6418e125 | 920 | * <h4> Example : </h4> |
daveyclk | 0:b33a6418e125 | 921 | * |
daveyclk | 0:b33a6418e125 | 922 | * @code |
daveyclk | 0:b33a6418e125 | 923 | * if( !tts_audio_mute() ) |
daveyclk | 0:b33a6418e125 | 924 | * UART1_Write_Text( "Audio muted !" ); |
daveyclk | 0:b33a6418e125 | 925 | * @endcode |
daveyclk | 0:b33a6418e125 | 926 | */ |
daveyclk | 0:b33a6418e125 | 927 | uint16_t tts_audio_mute( void ); |
daveyclk | 0:b33a6418e125 | 928 | |
daveyclk | 0:b33a6418e125 | 929 | /** |
daveyclk | 0:b33a6418e125 | 930 | * @brief <h3> Unmute Audio Output </h3> |
daveyclk | 0:b33a6418e125 | 931 | * |
daveyclk | 0:b33a6418e125 | 932 | * @par |
daveyclk | 0:b33a6418e125 | 933 | * Request mutes the audio output immediately. |
daveyclk | 0:b33a6418e125 | 934 | * |
daveyclk | 0:b33a6418e125 | 935 | * @par |
daveyclk | 0:b33a6418e125 | 936 | * <h4> Example : </h4> |
daveyclk | 0:b33a6418e125 | 937 | * |
daveyclk | 0:b33a6418e125 | 938 | * @code |
daveyclk | 0:b33a6418e125 | 939 | * if( !tts_audio_unmute() ) |
daveyclk | 0:b33a6418e125 | 940 | * UART1_Write_Text( "Audio unmuted !" ); |
daveyclk | 0:b33a6418e125 | 941 | * @endcode |
daveyclk | 0:b33a6418e125 | 942 | */ |
daveyclk | 0:b33a6418e125 | 943 | uint16_t tts_audio_unmute( void ); |
daveyclk | 0:b33a6418e125 | 944 | |
daveyclk | 0:b33a6418e125 | 945 | /** |
daveyclk | 0:b33a6418e125 | 946 | * @brief <h3> Configure Speech Codec </h3> |
daveyclk | 0:b33a6418e125 | 947 | * |
daveyclk | 0:b33a6418e125 | 948 | * @par |
daveyclk | 0:b33a6418e125 | 949 | * The Speech Codec application supports Voice Playback (Decode) using an |
daveyclk | 0:b33a6418e125 | 950 | * ADPCM codec. This is request to configure the codec and can only be used |
daveyclk | 0:b33a6418e125 | 951 | * when the SPCODEC is inactive. Currently all parameters are default so there |
daveyclk | 0:b33a6418e125 | 952 | * is no setable parameters in this request. |
daveyclk | 0:b33a6418e125 | 953 | */ |
daveyclk | 0:b33a6418e125 | 954 | uint16_t tts_codec_configure( void ); |
daveyclk | 0:b33a6418e125 | 955 | |
daveyclk | 0:b33a6418e125 | 956 | /** |
daveyclk | 0:b33a6418e125 | 957 | * @brief <h3> Start Speech Codec </h3> |
daveyclk | 0:b33a6418e125 | 958 | * |
daveyclk | 0:b33a6418e125 | 959 | * @par |
daveyclk | 0:b33a6418e125 | 960 | * Request is used to transfer data to the speech decoder. |
daveyclk | 0:b33a6418e125 | 961 | */ |
daveyclk | 0:b33a6418e125 | 962 | uint16_t tts_codec_start( uint8_t *codec_data, |
daveyclk | 0:b33a6418e125 | 963 | uint16_t count ); |
daveyclk | 0:b33a6418e125 | 964 | |
daveyclk | 0:b33a6418e125 | 965 | /** |
daveyclk | 0:b33a6418e125 | 966 | * @brief <h3> Pause Speech Codec Audio Input / Output </h3> |
daveyclk | 0:b33a6418e125 | 967 | * |
daveyclk | 0:b33a6418e125 | 968 | * @par |
daveyclk | 0:b33a6418e125 | 969 | * Request to pause the speech decoders to processing speech data. |
daveyclk | 0:b33a6418e125 | 970 | */ |
daveyclk | 0:b33a6418e125 | 971 | uint16_t tts_codec_pause( void ); |
daveyclk | 0:b33a6418e125 | 972 | |
daveyclk | 0:b33a6418e125 | 973 | /** |
daveyclk | 0:b33a6418e125 | 974 | * @brief <h3> Unpause Speech Codec Audio Input / Output </h3> |
daveyclk | 0:b33a6418e125 | 975 | * |
daveyclk | 0:b33a6418e125 | 976 | * @par |
daveyclk | 0:b33a6418e125 | 977 | * Request to unpause the speech decoders to processing speech data. |
daveyclk | 0:b33a6418e125 | 978 | */ |
daveyclk | 0:b33a6418e125 | 979 | uint16_t tts_codec_unpause( void ); |
daveyclk | 0:b33a6418e125 | 980 | |
daveyclk | 0:b33a6418e125 | 981 | /** |
daveyclk | 0:b33a6418e125 | 982 | * @brief <h3> Stop Speech Codec Immediately </h3> |
daveyclk | 0:b33a6418e125 | 983 | * |
daveyclk | 0:b33a6418e125 | 984 | * @par |
daveyclk | 0:b33a6418e125 | 985 | * Request to terminate the decode of speech data immediately. Audio data |
daveyclk | 0:b33a6418e125 | 986 | * already decoded will be processed before termination. If the SPCODEC is |
daveyclk | 0:b33a6418e125 | 987 | * reset, system resources used by the SPCODEC are freed, and all configuration |
daveyclk | 0:b33a6418e125 | 988 | * data is lost ( the SPCODEC is finalised ). |
daveyclk | 0:b33a6418e125 | 989 | * |
daveyclk | 0:b33a6418e125 | 990 | * @param[in] reset |
daveyclk | 0:b33a6418e125 | 991 | */ |
daveyclk | 0:b33a6418e125 | 992 | uint16_t tts_codec_stop( bool reset ); |
daveyclk | 0:b33a6418e125 | 993 | |
daveyclk | 0:b33a6418e125 | 994 | /** |
daveyclk | 0:b33a6418e125 | 995 | * @brief <h3> Configure the TTS </h3> |
daveyclk | 0:b33a6418e125 | 996 | * |
daveyclk | 0:b33a6418e125 | 997 | * @par |
daveyclk | 0:b33a6418e125 | 998 | * Request sends the default configuration to the device and can be used when |
daveyclk | 0:b33a6418e125 | 999 | * the TTS system is inactive. |
daveyclk | 0:b33a6418e125 | 1000 | * |
daveyclk | 0:b33a6418e125 | 1001 | * @par |
daveyclk | 0:b33a6418e125 | 1002 | * <h4> Example : </h4> |
daveyclk | 0:b33a6418e125 | 1003 | * |
daveyclk | 0:b33a6418e125 | 1004 | * @code |
daveyclk | 0:b33a6418e125 | 1005 | * if( !tts_default_config() ) |
daveyclk | 0:b33a6418e125 | 1006 | * UART1_Write_Text( "TTS configured !\" ); |
daveyclk | 0:b33a6418e125 | 1007 | * @endcode |
daveyclk | 0:b33a6418e125 | 1008 | */ |
daveyclk | 0:b33a6418e125 | 1009 | uint16_t tts_default_config( void ); |
daveyclk | 0:b33a6418e125 | 1010 | |
daveyclk | 0:b33a6418e125 | 1011 | /** |
daveyclk | 0:b33a6418e125 | 1012 | * @brief <h3> Sets the text to speech configuration </h3> |
daveyclk | 0:b33a6418e125 | 1013 | * |
daveyclk | 0:b33a6418e125 | 1014 | * @par |
daveyclk | 0:b33a6418e125 | 1015 | * Request sends the user provided configuration to the device and can be used |
daveyclk | 0:b33a6418e125 | 1016 | * when the TTS system is inactive. |
daveyclk | 0:b33a6418e125 | 1017 | * |
daveyclk | 0:b33a6418e125 | 1018 | * @param[in] voice_type ( 0 ~ 9 ) |
daveyclk | 0:b33a6418e125 | 1019 | * @param[in] epson_parse ( true / false ) |
daveyclk | 0:b33a6418e125 | 1020 | * @param[in] language |
daveyclk | 0:b33a6418e125 | 1021 | * @param[in] speaking_rate ( 0x004A ~ 0x0259 ) |
daveyclk | 0:b33a6418e125 | 1022 | * |
daveyclk | 0:b33a6418e125 | 1023 | * @par |
daveyclk | 0:b33a6418e125 | 1024 | * <h4> Example : </h4> |
daveyclk | 0:b33a6418e125 | 1025 | * |
daveyclk | 0:b33a6418e125 | 1026 | * @code |
daveyclk | 0:b33a6418e125 | 1027 | * if( !tts_config( 0x01, false, TTSV_US, 0x0200 ) ) |
daveyclk | 0:b33a6418e125 | 1028 | * UART_Write_Text( "TTS advanced configuration done !" ); |
daveyclk | 0:b33a6418e125 | 1029 | * @endcode |
daveyclk | 0:b33a6418e125 | 1030 | */ |
daveyclk | 0:b33a6418e125 | 1031 | uint16_t tts_config( uint8_t voice_type, |
daveyclk | 0:b33a6418e125 | 1032 | bool epson_parse, |
daveyclk | 0:b33a6418e125 | 1033 | TTSV_t language, |
daveyclk | 0:b33a6418e125 | 1034 | uint16_t speaking_rate ); |
daveyclk | 0:b33a6418e125 | 1035 | |
daveyclk | 0:b33a6418e125 | 1036 | /** |
daveyclk | 0:b33a6418e125 | 1037 | * @brief <h3> Start the TTS ( Optionally Attach Data ) </h3> |
daveyclk | 0:b33a6418e125 | 1038 | * |
daveyclk | 0:b33a6418e125 | 1039 | * @par |
daveyclk | 0:b33a6418e125 | 1040 | * Request sends the text data to the device. User can't send more data |
daveyclk | 0:b33a6418e125 | 1041 | * while the response indication that device is ready for more data is not |
daveyclk | 0:b33a6418e125 | 1042 | * received. |
daveyclk | 0:b33a6418e125 | 1043 | * |
daveyclk | 0:b33a6418e125 | 1044 | * @par |
daveyclk | 0:b33a6418e125 | 1045 | * <h4> Example : </h4> |
daveyclk | 0:b33a6418e125 | 1046 | * |
daveyclk | 0:b33a6418e125 | 1047 | * @code |
daveyclk | 0:b33a6418e125 | 1048 | * if( !tts_speak( "Hello world" ) ) |
daveyclk | 0:b33a6418e125 | 1049 | * UART1_Write_Text( "Speak done !" ); |
daveyclk | 0:b33a6418e125 | 1050 | * @endcode |
daveyclk | 0:b33a6418e125 | 1051 | */ |
daveyclk | 0:b33a6418e125 | 1052 | uint16_t tts_speak( char *word ); |
daveyclk | 0:b33a6418e125 | 1053 | |
daveyclk | 0:b33a6418e125 | 1054 | /** |
daveyclk | 0:b33a6418e125 | 1055 | * @brief <h3> Pause the TTS </h3> |
daveyclk | 0:b33a6418e125 | 1056 | * |
daveyclk | 0:b33a6418e125 | 1057 | * @par |
daveyclk | 0:b33a6418e125 | 1058 | * Request will stop or restart the speech synthesiser text proccessing. |
daveyclk | 0:b33a6418e125 | 1059 | * Time must be allowed for the audio output buffers to drain before the pause |
daveyclk | 0:b33a6418e125 | 1060 | * can take effect. |
daveyclk | 0:b33a6418e125 | 1061 | * |
daveyclk | 0:b33a6418e125 | 1062 | * @par |
daveyclk | 0:b33a6418e125 | 1063 | * <h4> Example : </h4> |
daveyclk | 0:b33a6418e125 | 1064 | * |
daveyclk | 0:b33a6418e125 | 1065 | * @code |
daveyclk | 0:b33a6418e125 | 1066 | * if( !tts_pause() ) |
daveyclk | 0:b33a6418e125 | 1067 | * UART_Write_Text( "Paused !" ); |
daveyclk | 0:b33a6418e125 | 1068 | * @endcode |
daveyclk | 0:b33a6418e125 | 1069 | */ |
daveyclk | 0:b33a6418e125 | 1070 | uint16_t tts_pause( void ); |
daveyclk | 0:b33a6418e125 | 1071 | |
daveyclk | 0:b33a6418e125 | 1072 | /** |
daveyclk | 0:b33a6418e125 | 1073 | * @brief <h3> Unpause the TTS </h3> |
daveyclk | 0:b33a6418e125 | 1074 | * |
daveyclk | 0:b33a6418e125 | 1075 | * @par |
daveyclk | 0:b33a6418e125 | 1076 | * Request will resume the speech synthesiser. |
daveyclk | 0:b33a6418e125 | 1077 | * |
daveyclk | 0:b33a6418e125 | 1078 | * @par |
daveyclk | 0:b33a6418e125 | 1079 | * <h4> Example : </h4> |
daveyclk | 0:b33a6418e125 | 1080 | * |
daveyclk | 0:b33a6418e125 | 1081 | * @code |
daveyclk | 0:b33a6418e125 | 1082 | * if( !tts_unpause() ) |
daveyclk | 0:b33a6418e125 | 1083 | * UART_Write_Text( "Unpaused !" ); |
daveyclk | 0:b33a6418e125 | 1084 | * @endcode |
daveyclk | 0:b33a6418e125 | 1085 | */ |
daveyclk | 0:b33a6418e125 | 1086 | uint16_t tts_unpause( void ); |
daveyclk | 0:b33a6418e125 | 1087 | |
daveyclk | 0:b33a6418e125 | 1088 | /** |
daveyclk | 0:b33a6418e125 | 1089 | * @brief <h3> Stop TTS Immediately </h3> |
daveyclk | 0:b33a6418e125 | 1090 | * |
daveyclk | 0:b33a6418e125 | 1091 | * @par |
daveyclk | 0:b33a6418e125 | 1092 | * Request that should be executed to stop text sythesis in order to free |
daveyclk | 0:b33a6418e125 | 1093 | * system resources associated with TTS. Device can be reseted after the this |
daveyclk | 0:b33a6418e125 | 1094 | * request and in that case all configuration data is lost. |
daveyclk | 0:b33a6418e125 | 1095 | * |
daveyclk | 0:b33a6418e125 | 1096 | * @param[in] reset ( true / false ) |
daveyclk | 0:b33a6418e125 | 1097 | * |
daveyclk | 0:b33a6418e125 | 1098 | * @par |
daveyclk | 0:b33a6418e125 | 1099 | * <h4> Example : </h4> |
daveyclk | 0:b33a6418e125 | 1100 | * |
daveyclk | 0:b33a6418e125 | 1101 | * @code |
daveyclk | 0:b33a6418e125 | 1102 | * if( !tts_stop() ) |
daveyclk | 0:b33a6418e125 | 1103 | * UART_Write_Text( "Stoped !" ); |
daveyclk | 0:b33a6418e125 | 1104 | * @endcode |
daveyclk | 0:b33a6418e125 | 1105 | */ |
daveyclk | 0:b33a6418e125 | 1106 | uint16_t tts_stop( bool reset ); |
daveyclk | 0:b33a6418e125 | 1107 | |
daveyclk | 0:b33a6418e125 | 1108 | /** |
daveyclk | 0:b33a6418e125 | 1109 | * @brief <h3> Send User Dictionary Data to the Device </h3> |
daveyclk | 0:b33a6418e125 | 1110 | * |
daveyclk | 0:b33a6418e125 | 1111 | * @par |
daveyclk | 0:b33a6418e125 | 1112 | * Request sends user dictionary data. User dictionary data is transferred in a |
daveyclk | 0:b33a6418e125 | 1113 | * single message. Erase parameter is used to erase any previously transferred |
daveyclk | 0:b33a6418e125 | 1114 | * user dictionary data. Udict data must be valid and counter is size of data |
daveyclk | 0:b33a6418e125 | 1115 | * in bytes. |
daveyclk | 0:b33a6418e125 | 1116 | * |
daveyclk | 0:b33a6418e125 | 1117 | * @param[in] erase ( true / false ) |
daveyclk | 0:b33a6418e125 | 1118 | * @param[in] udict_data |
daveyclk | 0:b33a6418e125 | 1119 | * @param[in] count |
daveyclk | 0:b33a6418e125 | 1120 | */ |
daveyclk | 0:b33a6418e125 | 1121 | uint16_t tts_user_dict( bool erase, |
daveyclk | 0:b33a6418e125 | 1122 | uint8_t *udict_data, |
daveyclk | 0:b33a6418e125 | 1123 | uint16_t count ); |
daveyclk | 0:b33a6418e125 | 1124 | |
daveyclk | 0:b33a6418e125 | 1125 | |
daveyclk | 0:b33a6418e125 | 1126 | /*** End of File **************************************************************/ |