Fork for fixing STM32
Fork of BurstSPI by
Embed:
(wiki syntax)
Show/hide line numbers
BurstSPI_KL25Z.cpp
00001 #ifdef TARGET_KL25Z 00002 #include "BurstSPI.h" 00003 00004 void BurstSPI::fastWrite(int data) { 00005 //Wait until FIFO has space 00006 while(((_spi.spi->S) & SPI_S_SPTEF_MASK) == 0); 00007 //transmit data 00008 _spi.spi->D = data; 00009 } 00010 00011 void BurstSPI::clearRX( void ) { 00012 //We put in a delay here, this function shouldn't be called very often, so not a huge problem 00013 //Without delay you will rise the CS line before it is finished (been there, done that) 00014 //We use time required to transmit 20 bits (8 bits being transmitted, 8 bits in FIFO, 4 bits safety margin 00015 00016 float bytetime = 20.0/_hz; 00017 wait(bytetime); 00018 00019 //Wait until status is flagged that we can read, read: 00020 while (_spi.spi->S & SPI_S_SPRF_MASK == 0); 00021 int dummy = _spi.spi->D; 00022 00023 } 00024 #endif
Generated on Wed Jul 13 2022 02:27:36 by 1.7.2