summaryrefslogtreecommitdiff
path: root/src/ao_audio.c
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2010-10-31 22:51:48 -0700
committerKeith Packard <keithp@keithp.com>2010-10-31 22:51:48 -0700
commitc983b2d670dfe6bace2c6d776e34eaafa25db9bb (patch)
tree97c4fc61432b0a09b7a31211cbc08e6496f6ba4c /src/ao_audio.c
parent6b17b75ed5dc4e4fcc7278c715479bb921b644d5 (diff)
teleterra: audio amp is enabled by bringing audio_en (P2_4) high
The external audio amplifier is placed in 'suspend' mode most of the time to save power. When audio is being sent, turn it on. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/ao_audio.c')
-rw-r--r--src/ao_audio.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/ao_audio.c b/src/ao_audio.c
index 0d521973..5d8fdfb5 100644
--- a/src/ao_audio.c
+++ b/src/ao_audio.c
@@ -584,6 +584,12 @@ ao_audio_send(__xdata uint8_t *samples, uint16_t nsamples) __reentrant
{
ao_mutex_get(&ao_audio_mutex);
+#if AUDIO_STANDBY_ON_P2_4
+ /*
+ * Turn on the audio amp
+ */
+ P2_4 = 1;
+#endif
/*
* Turn on timer 4. Free running from 0 to 0xff, with P2_0
* 'on' interval controlled by the value in T4CC0. Run this
@@ -641,6 +647,12 @@ ao_audio_send(__xdata uint8_t *samples, uint16_t nsamples) __reentrant
P2_0 = 0;
P2SEL = (P2SEL & ~P2SEL_SELP2_0_MASK) | P2SEL_SELP2_0_GPIO;
+#if AUDIO_STANDBY_ON_P2_4
+ /*
+ * Turn off the audio amp
+ */
+ P2_4 = 0;
+#endif
ao_mutex_put(&ao_audio_mutex);
}
@@ -665,6 +677,12 @@ ao_audio_init(void)
P2SEL = (P2SEL & ~P2SEL_SELP2_0_MASK) | P2SEL_SELP2_0_GPIO;
PERCFG = (PERCFG & ~PERCFG_T4CFG_ALT_MASK) | PERCFG_T4CFG_ALT_2;
+#if AUDIO_STANDBY_ON_P2_4
+ P2_4 = 0;
+ P2SEL &= ~P2SEL_SELP2_4_PERIPHERAL;
+ P2DIR |= (1 << 4);
+#endif
+
/* Timer 3 is used to clock the DMA transfers from the audio data buffer
* to the timer 4
*/