CLEON
Version 1
Cloud-Offloaded GPS Receiver
Main Page
Related Pages
Data Structures
Files
File List
Globals
hal_spi.c
Go to the documentation of this file.
1
7
#include "
cleon_conf.h
"
8
#include "
app_define.h
"
9
#include "
sys_define.h
"
10
#include "
hal_define.h
"
11
#include "
fs_define.h
"
12
13
/*----------------------------------------------------------------------------*/
21
void
HAL_SPI_Init
(
void
)
22
{
23
//Initialize UCB1 for SPI Master operation
24
UCB1CTL1 |= UCSWRST;
//Put state machine in reset
25
UCB1CTL0 = UCCKPL | UCMSB | UCMST | UCMODE_0 | UCSYNC;
//3-pin, 8-bit SPI master
26
27
UCB1CTL1 = UCSWRST | UCSSEL_2;
//Use SMCLK, keep RESET
28
UCB1BR0 = 31;
//Initial SPI clock must be <400kHz
29
UCB1BR1 = 0;
//f_UCxCLK = 12MHz/31 = 387kHz
30
UCB1CTL1 &= ~UCSWRST;
//Release USCI state machine
31
UCB1IFG &= ~UCRXIFG;
32
}
33
hal
hal_spi.c
Generated on Tue May 28 2013 15:17:19 for CLEON by
1.8.2