From f4c1f296ae5ba31ede8a6fff6d1f7b9848d8e10d Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Tue, 8 May 2012 20:45:07 +0000 Subject: added simple spi test git-svn-id: https://svn.spreadspace.org/mur.sat@404 7de4ea59-55d0-425e-a1af-a3118ea81d4c --- software/hhd70dongle/hhd70dongle.c | 3 +++ software/hhd70dongle/spi.c | 27 +++++++++++++++++++++++++-- 2 files changed, 28 insertions(+), 2 deletions(-) (limited to 'software') diff --git a/software/hhd70dongle/hhd70dongle.c b/software/hhd70dongle/hhd70dongle.c index 09205d1..3d72b57 100644 --- a/software/hhd70dongle/hhd70dongle.c +++ b/software/hhd70dongle/hhd70dongle.c @@ -46,5 +46,8 @@ int main(void) for(;;) { _delay_ms(250); led_toggle(); + char buf[10]; + int len=sizeof(buf); + spi_read(0,buf,&len); } } diff --git a/software/hhd70dongle/spi.c b/software/hhd70dongle/spi.c index 0732716..0ffa1b9 100644 --- a/software/hhd70dongle/spi.c +++ b/software/hhd70dongle/spi.c @@ -29,19 +29,42 @@ * along with mur.sat. If not, see . * */ +#include "avr/io.h" + #include "spi.h" +#define SPI_DDR DDRB +#define SPI_PORT PORTB +#define SPI_PIN PINB +#define CS 0 +#define SCK 1 +#define MOSI 2 +#define MISO 3 +#define GDO2 4 +#define GDO0 5 +#define RE 6 +#define TE 7 + void spi_init(void) { - + SPI_PORT = 0; + SPI_DDR = (1<