9 #if defined(__CDT_PARSER__)
15 #define INTERRUPT_PRIORITY_GROUP 2
16 #define ISR_URX() ISR(URX0, 0)
22 #define spiNMasterInit spi0MasterInit
23 #define spiNMasterSetFrequency spi0MasterSetFrequency
24 #define spiNMasterSetClockPolarity spi0MasterSetClockPolarity
25 #define spiNMasterSetClockPhase spi0MasterSetClockPhase
26 #define spiNMasterSetBitOrder spi0MasterSetBitOrder
27 #define spiNMasterBusy spi0MasterBusy
28 #define spiNMasterBytesLeft spi0MasterBytesLeft
29 #define spiNMasterTransfer spi0MasterTransfer
30 #define spiNMasterSendByte spi0MasterSendByte
31 #define spiNMasterReceiveByte spi0MasterReceiveByte
35 #define INTERRUPT_PRIORITY_GROUP 3
36 #define ISR_URX() ISR(URX1, 0)
42 #define spiNMasterInit spi1MasterInit
43 #define spiNMasterSetFrequency spi1MasterSetFrequency
44 #define spiNMasterSetClockPolarity spi1MasterSetClockPolarity
45 #define spiNMasterSetClockPhase spi1MasterSetClockPhase
46 #define spiNMasterSetBitOrder spi1MasterSetBitOrder
47 #define spiNMasterBusy spi1MasterBusy
48 #define spiNMasterBytesLeft spi1MasterBytesLeft
49 #define spiNMasterTransfer spi1MasterTransfer
50 #define spiNMasterSendByte spi1MasterSendByte
51 #define spiNMasterReceiveByte spi1MasterReceiveByte
63 void spiNMasterInit(
void)
102 P0SEL |= ((1<<5) | (1<<3));
104 P1SEL |= ((1<<5) | (1<<6));
111 IP0 |= (1<<INTERRUPT_PRIORITY_GROUP);
112 IP1 &= ~(1<<INTERRUPT_PRIORITY_GROUP);
118 void spiNMasterSetFrequency(
uint32 freq)
124 if (freq < 23 || freq > 3000000)
128 while (freq > 495782)
136 baudMPlus256 = (freq * 11) + (freq * 8663 / 46875);
139 while (baudMPlus256 > 0x1ff)
146 UNBAUD = baudMPlus256;
149 void spiNMasterSetClockPolarity(
BIT polarity)
161 void spiNMasterSetClockPhase(
BIT phase)
173 void spiNMasterSetBitOrder(
BIT bitOrder)
185 BIT spiNMasterBusy(
void)
190 uint16 spiNMasterBytesLeft(
void)
197 if (bytes) URXNIE = 1;
206 txPointer = txBuffer;
207 rxPointer = rxBuffer;
229 uint8 spiNMasterReceiveByte(
void)
231 return spiNMasterSendByte(0xFF);
#define SPI_PHASE_EDGE_LEADING
#define SPI_POLARITY_IDLE_LOW
#define SPI_BIT_ORDER_LSB_FIRST