Ein Roboter mit bürstenlosem Antrieb, differenzial und NRF24L01 Funk. Großflächig gebaut um ein großes Solarpanel aufzunehmen. https://gitlab.informatik.hs-fulda.de/fdai5253/roboter
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.1 KiB

  1. // ATTiny support code is from https://github.com/jscrane/RF24
  2. /**
  3. * @file spi.h
  4. * \cond HIDDEN_SYMBOLS
  5. * Class declaration for SPI helper files
  6. */
  7. #include <stdio.h>
  8. #include <Arduino.h>
  9. #include <avr/pgmspace.h>
  10. #define SPI_CLOCK_DIV4 0x00
  11. #define SPI_CLOCK_DIV16 0x01
  12. #define SPI_CLOCK_DIV64 0x02
  13. #define SPI_CLOCK_DIV128 0x03
  14. #define SPI_CLOCK_DIV2 0x04
  15. #define SPI_CLOCK_DIV8 0x05
  16. #define SPI_CLOCK_DIV32 0x06
  17. //#define SPI_CLOCK_DIV64 0x07
  18. #define SPI_MODE0 0x00
  19. #define SPI_MODE1 0x04
  20. #define SPI_MODE2 0x08
  21. #define SPI_MODE3 0x0C
  22. #define SPI_MODE_MASK 0x0C // CPOL = bit 3, CPHA = bit 2 on SPCR
  23. #define SPI_CLOCK_MASK 0x03 // SPR1 = bit 1, SPR0 = bit 0 on SPCR
  24. #define SPI_2XCLOCK_MASK 0x01 // SPI2X = bit 0 on SPSR
  25. class SPIClass {
  26. public:
  27. static byte transfer(byte _data);
  28. // SPI Configuration methods
  29. inline static void attachInterrupt();
  30. inline static void detachInterrupt(); // Default
  31. static void begin(); // Default
  32. static void end();
  33. static void setBitOrder(uint8_t);
  34. static void setDataMode(uint8_t);
  35. static void setClockDivider(uint8_t);
  36. };
  37. extern SPIClass SPI;
  38. /**
  39. * \endcond
  40. */