#include <avr/io.h>
#include <util/delay.h>
#include "morse_pwm.h"

#define BEACON		"EA1IDZ HAB-SOM1"
#define ALARM_DDR	DDRB
#define ALARM_PINS	PINB
#define ALARM_PIN	PB1

int main(void)
{
	/* init morse subsystem */
	morse_pwm_init();

	/* Atmega88 test */
	/* DDRD |= 1<<PD6; */

	/* set up alarm pin as input */
	ALARM_DDR &= ~(1<<ALARM_PIN);

	/* We are ready */
	morse_pwm_send("OK");

	/* main loop */
	for (;;) {
		if (!(ALARM_PINS & _BV(ALARM_PIN)))	/* alarm pin is 0 */
		{
			morse_pwm_send(BEACON);
			_delay_ms(5000);
		}
	}

	return 0;
}

