Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
#include "LPC21xx.h"
void SPI_Init(void)
{
PINSEL0|=(1<<8)|(1<<10)|(1<<12); //enable alternative functions for SPI
IO0DIR|=CS_PIN; //CS PIN for OUTPUT
S0SPCR=(1<<4)|(1<<5)|(1<<11); //configure SPI
S0SPCCR=0x10; //clock devider
IO0SET=CS_PIN; //CS_PIN HIGH
}
unsigned char SPI_Read (unsigned char Data)
{
S0SPDR=Data;
while((S0SPSR&(1<<7))==0);
S0SPSR&=(~(1<<7));
return S0SPDR;
}