1
0
mirror of git://projects.qi-hardware.com/ben-wpan.git synced 2024-09-30 00:46:21 +03: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:
Werner Almesberger 2011-02-10 07:19:55 -03:00
parent 6969e7d689
commit 4f0af39d4d
6 changed files with 38 additions and 33 deletions

View File

@ -16,7 +16,7 @@ USB_OBJS = $(FreakUSB)/usb/usb.o $(FreakUSB)/usb/ctrl.o \
$(FreakUSB)/usb/usb_buf.o \
$(FreakUSB)/hw/at90usbxx2/ep.o $(FreakUSB)/hw/at90usbxx2/hw.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 \
-I$(FreakUSB)/usb -I$(FreakUSB)/hw/at90usbxx2 \

View File

@ -8,28 +8,13 @@
#include "freakusb.h"
#include "at86rf230.h"
#include "io.h"
#include "board.h"
#include "spi.h"
void reset_rf(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)
{
/* We start with a 1 MHz/8 clock. Disable the prescaler. */

20
atusb/fw2/board.c Normal file
View 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);
}

View File

@ -1,24 +1,24 @@
#ifndef IO_H
#define IO_H
#ifndef BOARD_H
#define BOARD_H
#define LED_PORT B
#define LED_BIT 6
#define LED_BIT 6
#define nRST_RF_PORT C
#define nRST_RF_BIT 7
#define nRST_RF_BIT 7
#define SLP_TR_PORT B
#define SLP_TR_BIT 4
#define SLP_TR_BIT 4
#define SCLK_PORT D
#define SCLK_BIT 5
#define SCLK_BIT 5
#define MOSI_PORT D
#define MOSI_BIT 3
#define MOSI_BIT 3
#define MISO_PORT D
#define MISO_BIT 2
#define MISO_BIT 2
#define nSS_PORT D
#define nSS_BIT 1
#define nSS_BIT 1
#define IRQ_RF_PORT D
#define IRQ_RF_BIT 0
#define IRQ_RF_BIT 0
#define SET_2(p, b) PORT##p |= 1 << (b)
@ -36,4 +36,7 @@
#define IN(n) IN_1(n##_PORT, n##_BIT)
#define OUT(n) OUT_1(n##_PORT, n##_BIT)
#endif /* !IO_H */
void reset_rf(void);
#endif /* !BOARD_H */

View File

@ -27,7 +27,7 @@
#include "at86rf230.h"
#include "atusb/ep0.h"
//#include "version.h"
#include "io.h"
#include "board.h"
#include "spi.h"
@ -35,9 +35,6 @@
static const char *build_date = "today";
static unsigned build_number = 42;
extern void reset_rf(void);
#define debug(...)
#define error(...)

View File

@ -2,7 +2,7 @@
#include <avr/io.h>
#include "io.h"
#include "board.h"
#include "spi.h"