added boostc files

This commit is contained in:
Ziver Koc 2009-06-15 13:00:32 +00:00
parent 19025584c9
commit 42b5801a03
11 changed files with 647 additions and 14 deletions

17
boostc/spi.c Normal file
View file

@ -0,0 +1,17 @@
#include <system.h>
#include "spi.h"
void spi_init(){
while(!osccon.IOFS){} //wait for osc stable
sspstat = 0b00000000; //SMP(7)=0, CKE(6)=0 (clock edge idle to active)
sspcon1 = 0b00010010; //CKP(4)=1 clock polarity (idle high)
//SSPM3:SSPM0(3:0)=010 spi clock FOSC/64 (<400kHz)
sspcon1.SSPEN=1; //SSPEN(5)=1 enable SPI
}
unsigned char spi_putc(unsigned char send){
sspbuf=send;
while(!sspstat.BF){}
return sspbuf;
}