mirror of
git://projects.qi-hardware.com/ben-wpan.git
synced 2024-11-23 00:58:26 +02:00
atusb/fw2/: move board-specific items to board-specific file
- io.h: renamed to board.h - Makefile (OBJS): added board.o - atusb.c (reset_rf): moved to board.c - board.h (reset_rf): give reset_rf a proper declaration - atusb.c, ep.c, spi.c: include board.h instead of io.h
This commit is contained in:
parent
6969e7d689
commit
4f0af39d4d
@ -16,7 +16,7 @@ USB_OBJS = $(FreakUSB)/usb/usb.o $(FreakUSB)/usb/ctrl.o \
|
|||||||
$(FreakUSB)/usb/usb_buf.o \
|
$(FreakUSB)/usb/usb_buf.o \
|
||||||
$(FreakUSB)/hw/at90usbxx2/ep.o $(FreakUSB)/hw/at90usbxx2/hw.o \
|
$(FreakUSB)/hw/at90usbxx2/ep.o $(FreakUSB)/hw/at90usbxx2/hw.o \
|
||||||
$(FreakUSB)/hw/at90usbxx2/isr.o
|
$(FreakUSB)/hw/at90usbxx2/isr.o
|
||||||
OBJS = atusb.o spi.o descr.o ep0.o $(USB_OBJS)
|
OBJS = atusb.o board.o spi.o descr.o ep0.o $(USB_OBJS)
|
||||||
|
|
||||||
CFLAGS += -I../fw/include \
|
CFLAGS += -I../fw/include \
|
||||||
-I$(FreakUSB)/usb -I$(FreakUSB)/hw/at90usbxx2 \
|
-I$(FreakUSB)/usb -I$(FreakUSB)/hw/at90usbxx2 \
|
||||||
|
@ -8,28 +8,13 @@
|
|||||||
#include "freakusb.h"
|
#include "freakusb.h"
|
||||||
|
|
||||||
#include "at86rf230.h"
|
#include "at86rf230.h"
|
||||||
#include "io.h"
|
#include "board.h"
|
||||||
#include "spi.h"
|
#include "spi.h"
|
||||||
|
|
||||||
|
|
||||||
void reset_rf(void);
|
|
||||||
void ep0_init(void);
|
void ep0_init(void);
|
||||||
|
|
||||||
|
|
||||||
void reset_rf(void)
|
|
||||||
{
|
|
||||||
/* AT86RF231 data sheet, 12.4.13, reset pulse width: 625 ns (min) */
|
|
||||||
|
|
||||||
CLR(nRST_RF);
|
|
||||||
_delay_us(1);
|
|
||||||
SET(nRST_RF);
|
|
||||||
|
|
||||||
/* 12.4.14: SPI access latency after reset: 625 ns (min) */
|
|
||||||
|
|
||||||
_delay_us(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
/* We start with a 1 MHz/8 clock. Disable the prescaler. */
|
/* We start with a 1 MHz/8 clock. Disable the prescaler. */
|
||||||
|
20
atusb/fw2/board.c
Normal file
20
atusb/fw2/board.c
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
#include <avr/io.h>
|
||||||
|
|
||||||
|
#define F_CPU 8000000UL
|
||||||
|
#include <util/delay.h>
|
||||||
|
|
||||||
|
#include "board.h"
|
||||||
|
|
||||||
|
|
||||||
|
void reset_rf(void)
|
||||||
|
{
|
||||||
|
/* AT86RF231 data sheet, 12.4.13, reset pulse width: 625 ns (min) */
|
||||||
|
|
||||||
|
CLR(nRST_RF);
|
||||||
|
_delay_us(1);
|
||||||
|
SET(nRST_RF);
|
||||||
|
|
||||||
|
/* 12.4.14: SPI access latency after reset: 625 ns (min) */
|
||||||
|
|
||||||
|
_delay_us(1);
|
||||||
|
}
|
@ -1,5 +1,5 @@
|
|||||||
#ifndef IO_H
|
#ifndef BOARD_H
|
||||||
#define IO_H
|
#define BOARD_H
|
||||||
|
|
||||||
#define LED_PORT B
|
#define LED_PORT B
|
||||||
#define LED_BIT 6
|
#define LED_BIT 6
|
||||||
@ -36,4 +36,7 @@
|
|||||||
#define IN(n) IN_1(n##_PORT, n##_BIT)
|
#define IN(n) IN_1(n##_PORT, n##_BIT)
|
||||||
#define OUT(n) OUT_1(n##_PORT, n##_BIT)
|
#define OUT(n) OUT_1(n##_PORT, n##_BIT)
|
||||||
|
|
||||||
#endif /* !IO_H */
|
|
||||||
|
void reset_rf(void);
|
||||||
|
|
||||||
|
#endif /* !BOARD_H */
|
@ -27,7 +27,7 @@
|
|||||||
#include "at86rf230.h"
|
#include "at86rf230.h"
|
||||||
#include "atusb/ep0.h"
|
#include "atusb/ep0.h"
|
||||||
//#include "version.h"
|
//#include "version.h"
|
||||||
#include "io.h"
|
#include "board.h"
|
||||||
#include "spi.h"
|
#include "spi.h"
|
||||||
|
|
||||||
|
|
||||||
@ -35,9 +35,6 @@
|
|||||||
static const char *build_date = "today";
|
static const char *build_date = "today";
|
||||||
static unsigned build_number = 42;
|
static unsigned build_number = 42;
|
||||||
|
|
||||||
extern void reset_rf(void);
|
|
||||||
|
|
||||||
|
|
||||||
#define debug(...)
|
#define debug(...)
|
||||||
#define error(...)
|
#define error(...)
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include <avr/io.h>
|
#include <avr/io.h>
|
||||||
|
|
||||||
#include "io.h"
|
#include "board.h"
|
||||||
#include "spi.h"
|
#include "spi.h"
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user