Statistics
| Revision:

root / demos / hunter_prey / lib / src / libdragonfly / spi.h @ 1828

History | View | Annotate | Download (836 Bytes)

1
/**
2
 * @file spi.h
3
 * @brief Definitions for SPI
4
 * @author Colony Project, CMU Robotics Club
5
 **/
6

    
7
/**
8
 * @addtogroup spi
9
 * @{
10
 **/
11

    
12
#ifndef __SPI_H__
13
#define __SPI_H__
14

    
15
#define DOUBLE_SCK 1
16
#define SPR0_BIT 1
17

    
18
#define MASTER 1
19
#define SLAVE 0
20

    
21
#define MOSI _BV(PB2)
22
#define MISO _BV(PB3)
23
#define SS   _BV(PB0)
24
#define SCLK _BV(PB1)
25

    
26
typedef void (*spi_fun_recv_t)(char);
27
typedef void (*spi_fun_recv_complete_t)(void);
28

    
29
/** 
30
* @brief Initialize SPI
31
* 
32
* @param spi_fun_recv_t The function that handles SPI data, byte for byte.
33
* @param spi_fun_recv_complete_t  Called on a completed transmission - typically for cleaning up.
34
*/
35
void spi_init (spi_fun_recv_t, spi_fun_recv_complete_t);
36

    
37
/** 
38
* @brief Initialize SPI transfer.
39
* 
40
* @param char The number of bytes to transfer.
41
*/
42
void spi_transfer (char);
43

    
44
/**@}**/ //end group
45

    
46
#endif