-
Notifications
You must be signed in to change notification settings - Fork 0
/
SPI.h
executable file
·35 lines (27 loc) · 630 Bytes
/
SPI.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// spi.h
#ifndef SPI_H
#define SPI_H
#include <avr/io.h>
#include <util/atomic.h>
#define SCK PB5
#define MISO PB4
#define MOSI PB3
#define SS PB1
#define DDR_MOSI DDRB
#define PORT_MOSI PORTB
#define PIN_MOSI PINB
#define DDR_MISO DDRB
#define PORT_MISO PORTB
#define PIN_MISO PINB
#define DDR_SCK DDRB
#define PORT_SCK PORTB
#define PIN_SCK PINB
#define DDR_SS DDRB
#define PORT_SS PORTB
#define PIN_SS PINB
void spi_init(void);
void spi_write_byte(uint8_t data);
uint8_t spi_read_byte(void);
uint8_t spi_read_write_byte(uint8_t data);
void spi_write_read_buf(uint8_t *write_buf, uint8_t *read_buf, uint8_t len);
#endif