PlatformIO package of the Teensy core framework compatible with GCC 10 & C++20
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

76 行
1.5KB

  1. // RasPi.h
  2. //
  3. // Routines for implementing RadioHead on Raspberry Pi
  4. // using BCM2835 library for GPIO
  5. // Contributed by Mike Poublon and used with permission
  6. #ifndef RASPI_h
  7. #define RASPI_h
  8. #include <bcm2835.h>
  9. #include <stdio.h>
  10. #include <string.h>
  11. #include <stdlib.h>
  12. #include <stdint.h>
  13. typedef unsigned char byte;
  14. #ifndef NULL
  15. #define NULL 0
  16. #endif
  17. #ifndef OUTPUT
  18. #define OUTPUT BCM2835_GPIO_FSEL_OUTP
  19. #endif
  20. class SPIClass
  21. {
  22. public:
  23. static byte transfer(byte _data);
  24. // SPI Configuration methods
  25. static void begin(); // Default
  26. static void begin(uint16_t, uint8_t, uint8_t);
  27. static void end();
  28. static void setBitOrder(uint8_t);
  29. static void setDataMode(uint8_t);
  30. static void setClockDivider(uint16_t);
  31. };
  32. extern SPIClass SPI;
  33. class SerialSimulator
  34. {
  35. public:
  36. #define DEC 10
  37. #define HEX 16
  38. #define OCT 8
  39. #define BIN 2
  40. // TODO: move these from being inlined
  41. static void begin(int baud);
  42. static size_t println(const char* s);
  43. static size_t print(const char* s);
  44. static size_t print(unsigned int n, int base = DEC);
  45. static size_t print(char ch);
  46. static size_t println(char ch);
  47. static size_t print(unsigned char ch, int base = DEC);
  48. static size_t println(unsigned char ch, int base = DEC);
  49. };
  50. extern SerialSimulator Serial;
  51. void RasPiSetup();
  52. void pinMode(unsigned char pin, unsigned char mode);
  53. void digitalWrite(unsigned char pin, unsigned char value);
  54. unsigned long millis();
  55. void delay (unsigned long delay);
  56. long random(long min, long max);
  57. #endif