Debug LEDs and Buzzer on start.

master
q3k 2013-09-15 13:24:54 +02:00
parent b373d816c2
commit ed90fe1244
3 changed files with 20 additions and 11 deletions

View File

@ -8,7 +8,7 @@ OPTIMIZE = -Os
DEFS = DEFS =
LIBS = LIBS =
HZ = 20000000 HZ = 2000000
# You should not have to change anything below here. # You should not have to change anything below here.

View File

@ -1,7 +1,9 @@
#include <avr/io.h> #include <avr/io.h>
#include <avr/interrupt.h> #include <avr/interrupt.h>
#include <util/delay.h>
#include "io.h" #include "io.h"
#include "buzzer.h"
IMPORT_IO(BUZZER); IMPORT_IO(BUZZER);
@ -36,3 +38,14 @@ ISR(TIMER1_COMPA_vect)
{ {
IO_TOGGLE(BUZZER); IO_TOGGLE(BUZZER);
} }
void buzzer_signal_boot(void)
{
buzzer_start(TONE_LOW);
_delay_ms(100);
buzzer_start(TONE_MID);
_delay_ms(100);
buzzer_start(TONE_HIGH);
_delay_ms(100);
buzzer_stop();
}

View File

@ -35,19 +35,15 @@ int main (void)
IO_SET_OUTPUT(LED_RED); IO_SET_OUTPUT(LED_RED);
IO_SET_OUTPUT(LED_GREEN); IO_SET_OUTPUT(LED_GREEN);
IO_OUT(LED_GREEN, 1);
IO_OUT(LED_RED, 1);
buzzer_init(); buzzer_init();
sei(); sei();
buzzer_start(TONE_LOW); // Flash LEDs and buzz buzzer for debug
_delay_ms(10); IO_OUT(LED_GREEN, 1);
buzzer_start(TONE_MID); IO_OUT(LED_RED, 1);
_delay_ms(10); buzzer_signal_boot();
buzzer_start(TONE_HIGH); IO_OUT(LED_GREEN, 0);
_delay_ms(10); IO_OUT(LED_RED, 0);
buzzer_stop();
for (;;) {} for (;;) {}
return 0; return 0;