#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/pgmspace.h>
#include <avr/eeprom.h>
#include <stdlib.h>
#include "global.h"
#include "uart.h"
#include "rf12.h" 

#define F_CPU 8000000UL
#include <util/delay.h>

#define LED_PORT PORTD
#define LED_DDR	DDRD
#define LED_PIN	PIND
#define LED		6

void send(void);
void receive(void);

int main(void)
{   LED_DDR=(1<<LED);
	sbi(LED_PORT, LED);

	uart_init(UART_BAUD_SELECT(19200, F_CPU));
	rf12_init();					// Register setzen
	
	cbi(LED_PORT, LED);
	
	sei();
	uart_puts_P("Sender laeuft !\n");

	for (;;)
	{	send();
		for (unsigned char i=0; i<100; i++)
			_delay_ms(10);
		uart_puts_P("sende...\n");
	}
}

void send(void)
{	sbi(LED_PORT, LED);
	unsigned char test[]="Hallo Margritt! Super, oder?\n   ";
	rf12_txdata(test,32);
	cbi(LED_PORT, LED);
}

