root / branches / encoders / code / projects / libdragonfly / spi.h @ 490
History | View | Annotate | Download (625 Bytes)
1 | 490 | bpoole | #ifndef __SPI_H__
|
---|---|---|---|
2 | #define __SPI_H__
|
||
3 | |||
4 | 317 | bpoole | #define DOUBLE_SCK 1 |
5 | #define SPR0_BIT 1 |
||
6 | #define LSB 1 |
||
7 | #define MSB 0 |
||
8 | #define MASTER 1 |
||
9 | #define SLAVE 0 |
||
10 | |||
11 | 490 | bpoole | #define SPI_IDLE _BV(0) |
12 | #define SPI_SEND _BV(1) |
||
13 | #define SPI_RECV _BV(2) |
||
14 | #define SPI_BOTH _BV(3) |
||
15 | |||
16 | |||
17 | 350 | kwoo | /* Pin Defines */
|
18 | #define MOSI _BV(PB2)
|
||
19 | #define MISO _BV(PB3)
|
||
20 | #define SS _BV(PB0)
|
||
21 | #define SCLK _BV(PB1)
|
||
22 | |||
23 | 317 | bpoole | #define size_t int |
24 | typedef void (*spi_fun_recv_t)(char); |
||
25 | typedef void (*spi_fun_send_t)(char); |
||
26 | 367 | kwoo | void spi_init(char mode, spi_fun_recv_t recv_func); |
27 | 317 | bpoole | int spi_send(char *data, size_t bytes); |
28 | 367 | kwoo | void spi_master_recv_on(void); |
29 | void spi_master_recv_off(void); |
||
30 | 490 | bpoole | void spi_read_one(void); |
31 | |||
32 | #endif |