Audio was completely broken on v4. Now better, we hear sounds, but ridiculous sounds...

This commit is contained in:
bsongis
2012-01-27 20:53:11 +00:00
parent 7d511b1e13
commit dea8c79811
3 changed files with 30 additions and 18 deletions
+11 -8
View File
@@ -178,14 +178,14 @@ void audioQueue::heartbeat()
case 0:
//stock beeper. simply turn port on for x time!
if (toneTimeLeft > 0) {
#if defined (PCBV4)
TCCR0A &= ~(0b01<<COM0A0);
#if defined(PCBV4)
TCCR0A |= (0b01<<COM0A0); // tone on
#else
PORTE |= (1 << OUT_E_BUZZER); // speaker output 'high'
#endif
}
else {
#if defined (PCVV4)
#if defined(PCBV4)
TCCR0A &= ~(0b01<<COM0A0);
#else
PORTE &= ~(1 << OUT_E_BUZZER); // speaker output 'low'
@@ -202,15 +202,14 @@ void audioQueue::heartbeat()
if (toneTimeLeft > 0) {
toneCounter += toneFreq;
if ((toneCounter & 0x80) == 0x80) {
#if defined (PCBV4)
TCCR0A &= ~(0b01<<COM0A0);
#if defined(PCBV4)
TCCR0A |= (0b01<<COM0A0); // tone on
#else
PORTE |= (1 << OUT_E_BUZZER); // speaker output 'high'
#endif
}
else {
#if defined (PCVV3)
#if defined(PCBV4)
TCCR0A &= ~(0b01<<COM0A0);
#else
PORTE &= ~(1 << OUT_E_BUZZER); // speaker output 'low'
@@ -218,7 +217,7 @@ void audioQueue::heartbeat()
}
}
else {
#if defined (PCVV3)
#if defined(PCBV4)
TCCR0A &= ~(0b01<<COM0A0);
#else
PORTE &= ~(1 << OUT_E_BUZZER); // speaker output 'low'
@@ -256,7 +255,11 @@ void audioQueue::heartbeat()
}
else {
#if defined(PCBV4)
TCCR0A &= ~(0b01<<COM0A0);
#else
PORTE &= ~(1 << OUT_E_BUZZER); // speaker output 'low'
#endif
HAPTIC_OFF;
}
+19 -5
View File
@@ -79,13 +79,27 @@ inline void AUDIO_HEARTBEAT()
if (beepOn) {
static bool warbleC;
warbleC = warble && !warbleC;
if (warbleC)
PORTE &= ~(1<<OUT_E_BUZZER);//buzzer off
else
PORTE |= (1<<OUT_E_BUZZER);//buzzer on
if (warbleC) {
#if defined(PCBV4)
TCCR0A &= ~(0b01<<COM0A0);
#else
PORTE &= ~(1 << OUT_E_BUZZER); // speaker output 'low'
#endif
}
else {
#if defined(PCBV4)
TCCR0A |= (0b01<<COM0A0); // tone on
#else
PORTE |= (1 << OUT_E_BUZZER); // speaker output 'high'
#endif
}
}
else {
PORTE &= ~(1<<OUT_E_BUZZER);
#if defined(PCBV4)
TCCR0A &= ~(0b01<<COM0A0);
#else
PORTE &= ~(1 << OUT_E_BUZZER); // speaker output 'low'
#endif
}
}
-5
View File
@@ -51,11 +51,6 @@ uint16_t g_timeMain;
uint16_t g_time_per10;
#endif
#if defined (PCBSTD) && defined (AUDIO)
uint8_t toneFreq = BEEP_DEFAULT_FREQ;
uint8_t toneOn = false;
#endif
#ifdef AUDIO
//new audio object
audioQueue audio;