Advertisement
Guest User

Untitled

a guest
Feb 3rd, 2016
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.63 KB | None | 0 0
  1. uint8_t dummy = 0x00, dataReg, dataReg1, dataReg2;
  2.  
  3. GPIOE->BSRRH |= LT2433_CS; // set (CS) low
  4. for (uint32_t i = 0; i < 5000; i++ ) //bit of delay
  5. SPI2->DR = dummy; //start sending
  6. while( SPI2->SR & SPI_I2S_FLAG_BSY ); // wait until SPI is not busy anymore
  7. dataReg = SPI2->DR; //read data
  8. SPI2->DR = dummy; //start sending
  9. while( SPI2->SR & SPI_I2S_FLAG_BSY ); // wait until SPI is not busy anymore
  10. dataReg1 = SPI2->DR; //read data
  11. SPI2->DR = dummy; //start sending
  12. while( SPI2->SR & SPI_I2S_FLAG_BSY ); // wait until SPI is not busy anymore
  13. dataReg2 = SPI2->DR; //read data
  14. GPIOE->BSRRL |= LT2433_CS; // set (CS) high
  15. return dataReg;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement