Fast SPI write, added LPC812 Target
Fork of BurstSPI by
BurstSPI_LPC_1549.cpp@15:8241b7d84ad2, 2016-12-10 (annotated)
- Committer:
- JojoS
- Date:
- Sat Dec 10 14:30:26 2016 +0000
- Revision:
- 15:8241b7d84ad2
- Parent:
- 14:83e3b8ba3f43
support for STM32F4
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
JojoS | 14:83e3b8ba3f43 | 1 | #if (defined(TARGET_LPC1549)) |
Backstrom | 11:36ac5fd058dd | 2 | #include "BurstSPI.h" |
Backstrom | 11:36ac5fd058dd | 3 | |
Backstrom | 11:36ac5fd058dd | 4 | void BurstSPI::fastWrite(int data) { |
Backstrom | 11:36ac5fd058dd | 5 | while (!(_spi.spi->STAT & (1 << 1))); |
Backstrom | 11:36ac5fd058dd | 6 | |
Backstrom | 11:36ac5fd058dd | 7 | _spi.spi->TXDAT = (data & 0xffff); |
Backstrom | 12:c99022511536 | 8 | // end of transfer and receive ignore flag |
JojoS | 14:83e3b8ba3f43 | 9 | #ifndef NO_EOT_AFTER_WRITE |
JojoS | 14:83e3b8ba3f43 | 10 | // set EOT and receive ignore flag |
Backstrom | 11:36ac5fd058dd | 11 | _spi.spi->TXCTL |= ((1 << 20) | (1 << 22)); |
JojoS | 14:83e3b8ba3f43 | 12 | #else |
JojoS | 14:83e3b8ba3f43 | 13 | // set receive ignore flag |
JojoS | 14:83e3b8ba3f43 | 14 | _spi.spi->TXCTL |= (1 << 22); |
JojoS | 14:83e3b8ba3f43 | 15 | #endif |
Backstrom | 11:36ac5fd058dd | 16 | } |
Backstrom | 11:36ac5fd058dd | 17 | |
Backstrom | 11:36ac5fd058dd | 18 | void BurstSPI::clearRX( void ) { |
Backstrom | 12:c99022511536 | 19 | //We already set receive ignore flag, so this function is never run. |
Backstrom | 11:36ac5fd058dd | 20 | } |
Backstrom | 11:36ac5fd058dd | 21 | |
Backstrom | 11:36ac5fd058dd | 22 | #endif |