2011-02-09 00:32:15 +02:00
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
#include <avr/io.h>
|
|
|
|
|
|
|
|
#define F_CPU 8000000UL
|
|
|
|
#include <util/delay.h>
|
|
|
|
|
|
|
|
#include "freakusb.h"
|
|
|
|
|
2011-02-10 12:19:55 +02:00
|
|
|
#include "board.h"
|
2011-02-09 02:32:24 +02:00
|
|
|
#include "spi.h"
|
2011-02-10 12:24:37 +02:00
|
|
|
#include "atusb/ep0.h"
|
2011-02-09 00:32:15 +02:00
|
|
|
|
|
|
|
|
|
|
|
int main(void)
|
|
|
|
{
|
|
|
|
/* We start with a 1 MHz/8 clock. Disable the prescaler. */
|
|
|
|
|
|
|
|
CLKPR = 1 << CLKPCE;
|
|
|
|
CLKPR = 0;
|
|
|
|
|
|
|
|
/* set up all the outputs; default port value is 0 */
|
|
|
|
|
|
|
|
OUT(LED);
|
2011-02-09 02:32:24 +02:00
|
|
|
OUT(nRST_RF); /* resets the transceiver */
|
2011-02-09 00:32:15 +02:00
|
|
|
OUT(SLP_TR);
|
|
|
|
|
2011-02-09 02:32:24 +02:00
|
|
|
spi_init();
|
2011-02-09 00:32:15 +02:00
|
|
|
|
2011-02-09 02:32:24 +02:00
|
|
|
reset_rf();
|
2011-02-09 00:32:15 +02:00
|
|
|
|
|
|
|
/* now we should be at 8 MHz */
|
|
|
|
|
|
|
|
SET(LED);
|
|
|
|
_delay_ms(100);
|
|
|
|
CLR(LED);
|
|
|
|
|
|
|
|
usb_init();
|
2011-02-09 04:53:25 +02:00
|
|
|
ep0_init();
|
2011-02-09 00:32:15 +02:00
|
|
|
hw_init();
|
|
|
|
|
|
|
|
while (1)
|
|
|
|
usb_poll();
|
|
|
|
}
|