#ifndef _SPI_H_
#define _SPI_H_

#include <avr/io.h>

#define SPI_PORT        PORTB	/* target-specific port containing the SPI lines */
#define SPI_DDR         DDRB	/* target-specific DDR for the SPI port lines */

#define CS_DDR          DDRJ	/* target-specific DDR for chip-select */
#define CS_PORT         PORTJ	/* target-specific port used as chip-select */
#define CS_BIT          3	/* target-specific port line used as chip-select */

uint8_t spi_read();
void spi_write(uint8_t d);
void spi_select(void);
void spi_deselect(void);
unsigned char spi_xchg(unsigned char val);
void spi_init(void);

#endif
