PlatformIO package of the Teensy core framework compatible with GCC 10 & C++20
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.

пре 3 година
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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