Some more refactoring in audio / haptic

This commit is contained in:
bsongis
2012-05-04 10:20:59 +00:00
parent 82dbdb523b
commit 2eeedf6c55
11 changed files with 229 additions and 179 deletions
+5 -6
View File
@@ -54,19 +54,18 @@ void audioQueue::heartbeat()
if (toneTimeLeft > 0) {
if (toneChanged) {
toneChanged = 0;
set_frequency(toneFreq);
set_frequency(toneFreq * 61 / 2);
tone_start(0);
}
else if (toneFreqIncr && (toneTimeLeft&1) == 0) {
toneFreq += toneFreqIncr;
set_frequency(toneFreq);
set_frequency(toneFreq * 61 / 2);
}
toneTimeLeft--; //time gets counted down
}
else {
if (tonePause > 0) {
DACC->DACC_IDR = DACC_IDR_ENDTX ; // Disable interrupt
// SPEAKER_OFF;
tone_stop();
tonePause--; //time gets counted down
}
else if (t_queueRidx != t_queueWidx) {
@@ -83,13 +82,13 @@ void audioQueue::heartbeat()
if (tone2TimeLeft > 0) {
if (tone2Changed) {
tone2Changed = 0;
set_frequency(toneFreq);
set_frequency(toneFreq * 61 / 2);
tone_start(0);
}
tone2TimeLeft--; //time gets counted down
}
else {
DACC->DACC_IDR = DACC_IDR_ENDTX ; // Disable interrupt
tone_stop();
if (tone2Pause > 0) {
tone2Pause--; //time gets counted down
}