PlatformIO package of the Teensy core framework compatible with GCC 10 & C++20
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

39 rindas
934B

  1. // ArduinoCompat/HardwareSPI.h
  2. // STM32 implementattion of Arduino compatible SPI class
  3. #ifndef _HardwareSPI_h
  4. #define _HardwareSPI_h
  5. #include <stdint.h>
  6. typedef enum SPIFrequency {
  7. SPI_21_0MHZ = 0, /**< 21 MHz */
  8. SPI_10_5MHZ = 1, /**< 10.5 MHz */
  9. SPI_5_25MHZ = 2, /**< 5.25 MHz */
  10. SPI_2_625MHZ = 3, /**< 2.625 MHz */
  11. SPI_1_3125MHZ = 4, /**< 1.3125 MHz */
  12. SPI_656_25KHZ = 5, /**< 656.25 KHz */
  13. SPI_328_125KHZ = 6, /**< 328.125 KHz */
  14. } SPIFrequency;
  15. #define SPI_MODE0 0x00
  16. #define SPI_MODE1 0x04
  17. #define SPI_MODE2 0x08
  18. #define SPI_MODE3 0x0C
  19. class HardwareSPI
  20. {
  21. public:
  22. HardwareSPI(uint32_t spiPortNumber); // Only port SPI1 is currently supported
  23. void begin(SPIFrequency frequency, uint32_t bitOrder, uint32_t mode);
  24. void end(void);
  25. uint8_t transfer(uint8_t data);
  26. private:
  27. uint32_t _spiPortNumber; // Not used yet.
  28. };
  29. extern HardwareSPI SPI;
  30. #endif