sohotcall

STM32F103C8T6 SPI

Sep 8th, 2018
143
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SPI1
  2. NSS PA4
  3. SCK PA5
  4. MISO PA6
  5. MOSI PA7
  6.  
  7. SPI2
  8. NSS PB12
  9. SCK PB13
  10. MISO PB14
  11. MOSI PB15
  12.  
  13. #include <SPI.h>
  14. SPIClass SPI_2(2);
  15. SPI_2.begin();
  16. SPI_2.setBitOrder(MSBFIRST); // http://www.arduino.cc/en/Reference/SPISetBitOrder
  17. SPI_2.setDataMode(SPI_MODE0); // http://www.arduino.cc/en/Reference/SPISetDataMode
  18. SPI_2.setClockDivider(SPI_CLOCK_DIV16);     // Slow speed (72 / 16 = 4.5 MHz SPI speed)  
  19. byte data = SPI_2.transfer(0x55); //Send and get
RAW Paste Data