/* * Authors (alphabetical order) * - Andre Bernet * - Andreas Weitl * - Bertrand Songis * - Bryan J. Rentoul (Gruvin) * - Cameron Weeks * - Erez Raviv * - Gabriel Birkus * - Jean-Pierre Parisy * - Karl Szmutny * - Michael Blandford * - Michal Hlavinka * - Pat Mackenzie * - Philip Moss * - Rob Thomson * - Romolo Manfredini * - Thomas Husterer * * opentx is based on code named * gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/, * er9x by Erez Raviv: http://code.google.com/p/er9x/, * and the original (and ongoing) project by * Thomas Husterer, th9x: http://code.google.com/p/th9x/ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * */ #include "../opentx.h" struct t_voice Voice ; void pushPrompt(uint16_t value) { #ifdef SIMU printf("playFile(\"%04d.ad4\")\n", value); fflush(stdout); #endif struct t_voice *vptr; vptr = voiceaddress(); if (vptr->VoiceQueueCount < VOICE_Q_LENGTH) { vptr->VoiceQueue[vptr->VoiceQueueInIndex++] = value; vptr->VoiceQueueInIndex &= (VOICE_Q_LENGTH - 1); vptr->VoiceQueueCount += 1; } } void pushCustomPrompt(uint8_t value) { pushPrompt(PROMPT_CUSTOM_BASE + value); } void pushNumberPrompt(uint8_t value) { pushPrompt(PROMPT_I18N_BASE + value); } struct t_voice *voiceaddress() { return &Voice ; } void t_voice::voice_process(void) { if (Backlight) VoiceLatch |= BACKLIGHT_BIT; else VoiceLatch &= ~BACKLIGHT_BIT; if (VoiceState == V_IDLE) { PORTB |= (1 << OUT_B_LIGHT); // Latch clock high if (VoiceQueueCount) { VoiceSerial = VoiceQueue[VoiceQueueOutIndex++]; VoiceQueueOutIndex &= (VOICE_Q_LENGTH - 1); // TODO flash saving VoiceQueueCount -= 1; VoiceTimer = 17; if (VoiceSerial & 0x8000) { // Looking for sound volume 1F0-1F7 VoiceTimer = 40; } VoiceLatch &= ~VOICE_CLOCK_BIT & ~VOICE_DATA_BIT ; if (VoiceSerial & 0x8000) { VoiceLatch |= VOICE_DATA_BIT; } PORTA_LCD_DAT = VoiceLatch ; // Latch data set PORTB &= ~(1< 60) { // Give module 1.4 secs to initialise VoiceState = V_WAIT_START_BUSY_OFF ; } PORTB &= ~(1<