SPI.h 843 B

123456789101112131415161718192021222324252627282930313233
  1. #pragma once
  2. // Minimal standalone SPI.h stand-in - see Arduino.h in this same directory
  3. // for why this exists. Every byte transfer is logged with the DC pin's
  4. // current logical level (tracked by trace.h from digitalWrite() calls),
  5. // which is what lets the harness tell a command byte from a data byte
  6. // without any driver-specific knowledge.
  7. #include <cstdint>
  8. #include "../trace.h"
  9. class SPISettings {
  10. public:
  11. SPISettings() = default;
  12. SPISettings(uint32_t clock, uint8_t bit_order, uint8_t data_mode) {
  13. Trace::spi_settings(clock, bit_order, data_mode);
  14. }
  15. };
  16. #define MSBFIRST 0
  17. #define SPI_MODE0 0
  18. class SPIClass {
  19. public:
  20. void begin() {}
  21. void end() {}
  22. void beginTransaction(SPISettings) {}
  23. void endTransaction() {}
  24. uint8_t transfer(uint8_t data) { return Trace::spi_transfer(data); }
  25. };
  26. inline SPIClass SPI;