[9x stock] Issue 7 fixed.

[9x stock / gruvin9x] All prompts renumbered!
This commit is contained in:
bsongis@gmail.com
2013-03-29 21:15:14 +00:00
parent 0a49777e6d
commit 7d5543f5a7
20 changed files with 210 additions and 195 deletions
+3 -3
View File
@@ -105,14 +105,14 @@ inline void boardInit()
DDRF = 0x00; PORTF = 0x00; //anain
DDRG = 0x14; PORTG = 0xfb; //pullups + SIM_CTL=1 = phonejack = ppm_in, Haptic output and off (0)
ADMUX=ADC_VREF_TYPE;
ADCSRA=0x85; // ADC enabled, pre-scaler division=32 (no interrupt, no auto-triggering)
ADMUX = ADC_VREF_TYPE;
ADCSRA = 0x85; // ADC enabled, pre-scaler division=32 (no interrupt, no auto-triggering)
// TCNT0 10ms = 16MHz/1024/156 periodic timer (9.984ms)
// (with 1:4 duty at 157 to average 10.0ms)
// Timer overflows at about 61Hz or once every 16ms.
TCCR0 = (0b111 << CS00); // Norm mode, clk/1024
OCR0 = 156;
OCR0 = 156;
#if defined(AUDIO) || defined(VOICE)
TCCR2 = (0b010 << CS00); // Norm mode, clk/8
+2 -2
View File
@@ -67,8 +67,8 @@
#define PIN_TRIM_RV_DN (1<<INP_D_TRM_RV_DWN)
#define PIN_TRIM_RH_R (1<<INP_D_TRM_RH_UP)
#define TIMER_16KHZ_VECT TIMER0_OVF_vect
#define COUNTER_16KHZ TCNT0
#define TIMER_16KHZ_VECT TIMER0_OVF_vect
#define COUNTER_16KHZ TCNT0
#define TIMER_10MS_VECT TIMER0_COMP_vect
#define TIMER_10MS_COMPVAL OCR0
+5 -5
View File
@@ -38,7 +38,7 @@
struct t_voice Voice ;
void pushPrompt16(uint16_t value)
void pushPrompt(uint16_t value)
{
#ifdef SIMU
printf("playFile(\"%04d.ad4\")\n", value); fflush(stdout);
@@ -49,19 +49,19 @@ void pushPrompt16(uint16_t value)
if (vptr->VoiceQueueCount < VOICE_Q_LENGTH) {
vptr->VoiceQueue[vptr->VoiceQueueInIndex++] = value;
vptr->VoiceQueueInIndex &= (VOICE_Q_LENGTH - 1); // TODO flash saving?
vptr->VoiceQueueInIndex &= (VOICE_Q_LENGTH - 1);
vptr->VoiceQueueCount += 1;
}
}
void pushCustomPrompt(uint8_t value)
{
pushPrompt16(PROMPT_CUSTOM_BASE + value);
pushPrompt(PROMPT_CUSTOM_BASE + value);
}
void pushPrompt(uint8_t value)
void pushNumberPrompt(uint8_t value)
{
pushPrompt16(value);
pushPrompt(PROMPT_I18N_BASE + value);
}
struct t_voice *voiceaddress()
+17 -21
View File
@@ -56,8 +56,9 @@
#define V_WAIT_BUSY_DELAY 5
#define V_WAIT_START_BUSY_OFF 6
#define PROMPT_SYSTEM_BASE 230
#define PROMPT_CUSTOM_BASE 256
#define PROMPT_CUSTOM_BASE 0
#define PROMPT_I18N_BASE 256
#define PROMPT_SYSTEM_BASE 480
struct t_voice
{
@@ -75,15 +76,16 @@ struct t_voice
void voice_process( void ) ;
};
extern void pushCustomPrompt( uint8_t value );
extern void pushPrompt( uint8_t value );
extern void pushPrompt16(uint16_t value);
extern void pushPrompt(uint16_t value);
extern void pushCustomPrompt(uint8_t value);
extern void pushNumberPrompt(uint8_t value);
extern struct t_voice *voiceaddress( void ) ;
extern struct t_voice Voice ;
#define VOLUME_LEVEL_MAX 7
#define VOLUME_LEVEL_DEF 7
#define setVolume(v) pushPrompt16((v) | 0xFFF0)
#define setVolume(v) pushPrompt((v) | 0xFFF0)
inline bool isPlaying()
{
@@ -99,24 +101,18 @@ inline bool isPlaying()
* Check for LcdLocked (in interrupt), and voice_enabled
*/
#define VOICE_DRIVER() \
if ( LcdLock == 0 ) /* LCD not in use */ \
{ \
if ( LcdLock == 0 ) { /* LCD not in use */ \
struct t_voice *vptr; \
vptr = voiceaddress(); \
if ( vptr->VoiceState == V_CLOCKING ) \
{ \
if ( vptr->VoiceTimer ) \
{ \
if ( vptr->VoiceState == V_CLOCKING ) { \
if ( vptr->VoiceTimer ) { \
vptr->VoiceTimer -= 1; \
} \
else \
{ \
else { \
PORTB |= (1<<OUT_B_LIGHT); /* Latch clock high */ \
if ((vptr->VoiceCounter & 1) == 0) \
{ \
if ((vptr->VoiceCounter & 1) == 0) { \
vptr->VoiceLatch &= ~VOICE_DATA_BIT; \
if ( vptr->VoiceSerial & 0x4000 ) \
{ \
if ( vptr->VoiceSerial & 0x4000 ) { \
vptr->VoiceLatch |= VOICE_DATA_BIT; \
} \
vptr->VoiceSerial <<= 1; \
@@ -124,8 +120,7 @@ inline bool isPlaying()
vptr->VoiceLatch ^= VOICE_CLOCK_BIT; \
PORTA_LCD_DAT = vptr->VoiceLatch; /* Latch data set */ \
PORTB &= ~(1<<OUT_B_LIGHT); /* Latch clock low */ \
if ( --vptr->VoiceCounter == 0 ) \
{ \
if ( --vptr->VoiceCounter == 0 ) { \
vptr->VoiceState = V_WAIT_BUSY_ON; \
vptr->VoiceTimer = 5; /* 50 mS */ \
} \
@@ -134,8 +129,9 @@ inline bool isPlaying()
}
#define PLAY_FUNCTION(x, ...) void x(__VA_ARGS__)
#define PUSH_PROMPT(p) pushPrompt((p))
#define PUSH_CUSTOM_PROMPT(p, ...) pushCustomPrompt((p))
#define PUSH_NUMBER_PROMPT(p) pushNumberPrompt((p))
#define PUSH_SYSTEM_PROMPT(p) pushNumberPrompt(PROMPT_SYSTEM_BASE-PROMPT_I18N_BASE+(p))
#define PLAY_NUMBER(n, u, a) playNumber((n), (u), (a))
#define PLAY_DURATION(d) playDuration((d))
#define IS_PLAYING(id) (0) /* isPlaying() */