-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOptoSPI.h
More file actions
61 lines (51 loc) · 1.89 KB
/
OptoSPI.h
File metadata and controls
61 lines (51 loc) · 1.89 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*
* OptoSPI.h
*
* Created: 11/19/2013 9:03:54 PM
* Author: Caroline
*/
#ifndef OPTOSPI_H_
#define OPTOSPI_H_
#include <avr32/io.h>
#include <stdint.h>
#include "avr32\uc3l064.h"
#include "avr32\spi_211.h"
/************************************************************************/
/* Initialize and configure SPI module
/*
/* Parameters:
/* volatile avr32_spi_t *spi - base address of SPI module
/************************************************************************/
void initSPI(volatile avr32_spi_t *spi);
/************************************************************************/
/* Initialize the SPI clock
/*
/* Parameters:
/* volatile avr32_spi_t *spi - base address of SPI module
/* unsigned pba_hz - peripheral bus speed (SPI on PBA)
/* unsigned baudrate - desired SPI baud rate (clock speed)
/************************************************************************/
void init_SPI_clk(volatile avr32_spi_t *spi, unsigned pba_hz, unsigned baudrate);
/************************************************************************/
/* Start SPI master transfer
/*
/* Parameters:
/* volatile avr32_spi_t *spi - base address of SPI module
/* uint16_t data - data to transfer
/************************************************************************/
void write_spi(volatile avr32_spi_t *spi, uint16_t data);
/************************************************************************/
/* Enable SPI module
/*
/* Parameters:
/* volatile avr32_spi_t *spi - base address of SPI module
/************************************************************************/
void enable_spi(volatile avr32_spi_t *spi);
/************************************************************************/
/* Disable SPI module
/*
/* Parameters:
/* volatile avr32_spi_t *spi - base address of SPI module
/************************************************************************/
void disable_spi(volatile avr32_spi_t *spi);
#endif /* OPTOSPI_H_ */