Rev 361 | Rev 368 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 361 | Rev 362 | ||
---|---|---|---|
Line 135... | Line 135... | ||
135 | // clear pending bits |
135 | // clear pending bits |
136 | SSP_ClearITPendingBit(SSP0, SSP_IT_RxTimeOut); |
136 | SSP_ClearITPendingBit(SSP0, SSP_IT_RxTimeOut); |
137 | SSP_ClearITPendingBit(SSP0, SSP_IT_RxFifo); |
137 | SSP_ClearITPendingBit(SSP0, SSP_IT_RxFifo); |
Line 138... | Line 138... | ||
138 | 138 | ||
139 | // while RxFIFO not empty |
139 | // while RxFIFO not empty |
140 | while (SSP_GetFlagStatus(SSP0, SSP_FLAG_RxFifoNotEmpty) == SET) |
140 | while (SSP_GetFlagStatus(SSP0, SSP_FLAG_RxFifoNotEmpty) == SET && (SD_WatchDog)) |
141 | { |
141 | { |
142 | rxdata = SSP0->DR; // catch the received byte |
142 | rxdata = SSP0->DR; // catch the received byte |
143 | // Fill TxFIFO while its not full or end of packet is reached |
143 | // Fill TxFIFO while its not full or end of packet is reached |
144 | while (SSP_GetFlagStatus(SSP0, SSP_FLAG_TxFifoNotFull) == SET) |
144 | while (SSP_GetFlagStatus(SSP0, SSP_FLAG_TxFifoNotFull) == SET && (SD_WatchDog)) |
145 | { |
145 | { |
146 | if (SPI_TxBufferIndex < SPI_TXBUFFER_LEN) // still data to send ? |
146 | if (SPI_TxBufferIndex < SPI_TXBUFFER_LEN) // still data to send ? |
147 | { |
147 | { |
148 | SSP0->DR = SPI_TxBuffer[SPI_TxBufferIndex]; // send a byte |
148 | SSP0->DR = SPI_TxBuffer[SPI_TxBufferIndex]; // send a byte |
- | 149 | *Ptr_TxChksum += SPI_TxBuffer[SPI_TxBufferIndex]; // update checksum |
|
149 | *Ptr_TxChksum += SPI_TxBuffer[SPI_TxBufferIndex]; // update checksum |
150 | if(MainWatchDog == 0) *Ptr_TxChksum += 1; // disturbe this packet to stop the communication! |
150 | SPI_TxBufferIndex++; // pointer to next byte |
151 | SPI_TxBufferIndex++; // pointer to next byte |
151 | } |
152 | } |
152 | else // end of packet is reached reset and copy data to tx buffer |
153 | else // end of packet is reached reset and copy data to tx buffer |
153 | { |
154 | { |