Skip to content

Commit

Permalink
Clifford Wolf:
Browse files Browse the repository at this point in the history
	Fixed musicplayer/firmware.cc



git-svn-id: http://svn.clifford.at/embedvm/trunk@37 9d21f824-f436-4d2e-9c88-bb158a3a422f
  • Loading branch information
clifford committed Apr 5, 2011
1 parent a65f386 commit 5f27216
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions examples/musicplayer/firmware.cc
Expand Up @@ -10,8 +10,7 @@ struct embedvm_s vm = { };
uint8_t vm_mem[256] = { EMBEDVM_SECT_SRAM_DATA };

struct tone_s {
uint16_t freq;
uint8_t on, off;
uint16_t freq, on, off;
};

struct tone_s tone_buf[4];
Expand Down Expand Up @@ -104,27 +103,14 @@ void setup()
break;
} else {
uint16_t time_delta = millis() - last_time;
// Serial.print(tone_buf_out, DEC);
// Serial.print(" ");
// Serial.print(tone_buf_fill, DEC);
// Serial.print(" ");
// Serial.print(time_delta, DEC);
// Serial.print(" ");
// Serial.print(tone_buf[tone_buf_out].freq, DEC);
// Serial.print(" ");
// Serial.print(tone_buf[tone_buf_out].on, DEC);
// Serial.print(" ");
// Serial.print(tone_buf[tone_buf_out].off, DEC);
// Serial.println("");
if (time_delta < tone_buf[tone_buf_out].on) {
buzzer(tone_buf[tone_buf_out].freq);
}
else if (time_delta-tone_buf[tone_buf_out].on < tone_buf[tone_buf_out].off) {
buzzer(0);
}
else {
// last_time += time_delta;
last_time = millis();
last_time += time_delta;
tone_buf_out = (tone_buf_out + 1) % 4;
tone_buf_fill--;
}
Expand Down

0 comments on commit 5f27216

Please sign in to comment.