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.

Teensy_KinetisK20.h 3.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. #ifndef TLC_Teensy_xxU4_h
  2. #define TLC_Teensy_xxU4_h
  3. // bitbang I/O is pretty fast on Teensy 3.1
  4. // and avoids SPI sharing problems
  5. #ifdef DATA_TRANSFER_MODE
  6. #undef DATA_TRANSFER_MODE
  7. #endif
  8. #define DATA_TRANSFER_MODE TLC_BITBANG
  9. // Teensy pin 6 -> SIN (TLC pin 26)
  10. #define DEFAULT_BB_SIN_PIN 6
  11. #define DEFAULT_BB_SIN_PORT 6
  12. #define DEFAULT_BB_SIN_DDR 6
  13. // Teensy pin 7 -> SCLK (TLC pin 25)
  14. #define DEFAULT_BB_SCLK_PIN 7
  15. #define DEFAULT_BB_SCLK_PORT 7
  16. #define DEFAULT_BB_SCLK_DDR 7
  17. // FTM1_CH0 (Teensy pin 3) -> XLAT (TLC pin 24)
  18. #define XLAT_PIN 3
  19. #define XLAT_PORT 3
  20. #define XLAT_DDR 3
  21. // FTM1_CH1 (Teensy pin 4) -> BLANK (TLC pin 23)
  22. #define BLANK_PIN 4
  23. #define BLANK_PORT 4
  24. #define BLANK_DDR 4
  25. // CMTOUT (Teensy pin 5) -> GSCLK (TLC pin 18)
  26. #define GSCLK_PIN 5
  27. #define GSCLK_PORT 5
  28. #define GSCLK_DDR 5
  29. // Timer settings...
  30. #if F_BUS == 60000000
  31. #define TLC_TIMER_TEENSY3_NORMAL_CGH1 4
  32. #define TLC_TIMER_TEENSY3_NORMAL_CGL1 11
  33. #define TLC_TIMER_TEENSY3_NORMAL_MOD 30720
  34. #define TLC_TIMER_TEENSY3_NORMAL_CV 4
  35. #define TLC_TIMER_TEENSY3_SERVO_CGH1 58
  36. #define TLC_TIMER_TEENSY3_SERVO_CGL1 235
  37. #define TLC_TIMER_TEENSY3_SERVO_PS 4
  38. #define TLC_TIMER_TEENSY3_SERVO_MOD 37500
  39. #define TLC_TIMER_TEENSY3_SERVO_CV 1
  40. #elif F_BUS == 56000000
  41. #define TLC_TIMER_TEENSY3_NORMAL_CGH1 3
  42. #define TLC_TIMER_TEENSY3_NORMAL_CGL1 11
  43. #define TLC_TIMER_TEENSY3_NORMAL_MOD 28672
  44. #define TLC_TIMER_TEENSY3_NORMAL_CV 3
  45. #define TLC_TIMER_TEENSY3_SERVO_CGH1 54
  46. #define TLC_TIMER_TEENSY3_SERVO_CGL1 219
  47. #define TLC_TIMER_TEENSY3_SERVO_PS 4
  48. #define TLC_TIMER_TEENSY3_SERVO_MOD 35000
  49. #define TLC_TIMER_TEENSY3_SERVO_CV 1
  50. #elif F_BUS == 48000000
  51. #define TLC_TIMER_TEENSY3_NORMAL_CGH1 3
  52. #define TLC_TIMER_TEENSY3_NORMAL_CGL1 9
  53. #define TLC_TIMER_TEENSY3_NORMAL_MOD 24576
  54. #define TLC_TIMER_TEENSY3_NORMAL_CV 3
  55. #define TLC_TIMER_TEENSY3_SERVO_CGH1 47
  56. #define TLC_TIMER_TEENSY3_SERVO_CGL1 187
  57. #define TLC_TIMER_TEENSY3_SERVO_PS 3
  58. #define TLC_TIMER_TEENSY3_SERVO_MOD 60000
  59. #define TLC_TIMER_TEENSY3_SERVO_CV 1
  60. #elif F_BUS == 36000000
  61. #define TLC_TIMER_TEENSY3_NORMAL_CGH1 2
  62. #define TLC_TIMER_TEENSY3_NORMAL_CGL1 7
  63. #define TLC_TIMER_TEENSY3_NORMAL_MOD 18432
  64. #define TLC_TIMER_TEENSY3_NORMAL_CV 2
  65. #define TLC_TIMER_TEENSY3_SERVO_CGH1 35
  66. #define TLC_TIMER_TEENSY3_SERVO_CGL1 141
  67. #define TLC_TIMER_TEENSY3_SERVO_PS 3
  68. #define TLC_TIMER_TEENSY3_SERVO_MOD 45000
  69. #define TLC_TIMER_TEENSY3_SERVO_CV 1
  70. #elif F_BUS == 24000000
  71. #define TLC_TIMER_TEENSY3_NORMAL_CGH1 2
  72. #define TLC_TIMER_TEENSY3_NORMAL_CGL1 4
  73. #define TLC_TIMER_TEENSY3_NORMAL_MOD 12288
  74. #define TLC_TIMER_TEENSY3_NORMAL_CV 2
  75. #define TLC_TIMER_TEENSY3_SERVO_CGH1 23
  76. #define TLC_TIMER_TEENSY3_SERVO_CGL1 94
  77. #define TLC_TIMER_TEENSY3_SERVO_PS 2
  78. #define TLC_TIMER_TEENSY3_SERVO_MOD 60000
  79. #define TLC_TIMER_TEENSY3_SERVO_CV 1
  80. #elif F_BUS == 16000000
  81. #define TLC_TIMER_TEENSY3_NORMAL_CGH1 1
  82. #define TLC_TIMER_TEENSY3_NORMAL_CGL1 3
  83. #define TLC_TIMER_TEENSY3_NORMAL_MOD 8192
  84. #define TLC_TIMER_TEENSY3_NORMAL_CV 1
  85. #define TLC_TIMER_TEENSY3_SERVO_CGH1 16
  86. #define TLC_TIMER_TEENSY3_SERVO_CGL1 62
  87. #define TLC_TIMER_TEENSY3_SERVO_PS 2
  88. #define TLC_TIMER_TEENSY3_SERVO_MOD 40000
  89. #define TLC_TIMER_TEENSY3_SERVO_CV 1
  90. #elif F_BUS == 8000000
  91. #define TLC_TIMER_TEENSY3_NORMAL_CGH1 1
  92. #define TLC_TIMER_TEENSY3_NORMAL_CGL1 1
  93. #define TLC_TIMER_TEENSY3_NORMAL_MOD 4096
  94. #define TLC_TIMER_TEENSY3_NORMAL_CV 1
  95. #define TLC_TIMER_TEENSY3_SERVO_CGH1 8
  96. #define TLC_TIMER_TEENSY3_SERVO_CGL1 31
  97. #define TLC_TIMER_TEENSY3_SERVO_PS 1
  98. #define TLC_TIMER_TEENSY3_SERVO_MOD 40000
  99. #define TLC_TIMER_TEENSY3_SERVO_CV 1
  100. #else
  101. #error "F_BUS must be 60, 56, 48, 36, 24, 16, 8 MHz"
  102. #endif
  103. #endif