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.

150 line
6.9KB

  1. // Pin selections here are based on the original Adafruit Learning System
  2. // guide for the Teensy 3.x project. Some of these pin numbers don't even
  3. // exist on the smaller SAMD M0 & M4 boards, so you may need to make other
  4. // selections:
  5. // GRAPHICS SETTINGS (appearance of eye) -----------------------------------
  6. // If using a SINGLE EYE, you might want this next line enabled, which
  7. // uses a simpler "football-shaped" eye that's left/right symmetrical.
  8. // Default shape includes the caruncle, creating distinct left/right eyes.
  9. #if defined(ADAFRUIT_HALLOWING) || defined(ARDUINO_SAMD_CIRCUITPLAYGROUND_EXPRESS) // Hallowing, with one eye, does this by default
  10. #define SYMMETRICAL_EYELID
  11. #else // Otherwise your choice, standard is asymmetrical
  12. #define SYMMETRICAL_EYELID
  13. #endif
  14. // Enable ONE of these #includes -- HUGE graphics tables for various eyes:
  15. #include "graphics/defaultEye.h" // Standard human-ish hazel eye -OR-
  16. //#include "graphics/dragonEye.h" // Slit pupil fiery dragon/demon eye -OR-
  17. //#include "graphics/noScleraEye.h" // Large iris, no sclera -OR-
  18. //#include "graphics/goatEye.h" // Horizontal pupil goat/Krampus eye -OR-
  19. //#include "graphics/newtEye.h" // Eye of newt -OR-
  20. //#include "graphics/terminatorEye.h" // Git to da choppah!
  21. //#include "graphics/catEye.h" // Cartoonish cat (flat "2D" colors)
  22. //#include "graphics/owlEye.h" // Minerva the owl (DISABLE TRACKING)
  23. //#include "graphics/naugaEye.h" // Nauga googly eye (DISABLE TRACKING)
  24. //#include "graphics/doeEye.h" // Cartoon deer eye (DISABLE TRACKING)
  25. //#include "graphics/Nebula.h" //Dont work
  26. //#include "graphics/MyEyeHuman1.h"
  27. //#include "graphics/Human-HAL9000.h"
  28. //#include "graphics/NebulaBlueGreen.h"
  29. //#include "graphics/SpiralGalaxy.h"
  30. //#include "graphics/ChameleonX_Eye.h" //no work
  31. //#include "graphics/MyEye.h"
  32. // Optional: enable this line for startup logo (screen test/orient):
  33. #if !defined(ADAFRUIT_HALLOWING) // Hallowing can't always fit logo+eye
  34. #include "graphics/logo.h" // Otherwise your choice, if it fits
  35. #endif
  36. // EYE LIST ----------------------------------------------------------------
  37. // This table contains ONE LINE PER EYE. The table MUST be present with
  38. // this name and contain ONE OR MORE lines. Each line contains THREE items:
  39. // a pin number for the corresponding TFT/OLED display's SELECT line, a pin
  40. // pin number for that eye's "wink" button (or -1 if not used), and a screen
  41. // rotation value (0-3) for that eye.
  42. eyeInfo_t eyeInfo[] = {
  43. #if defined(ADAFRUIT_HALLOWING)
  44. { 10, -1, 2 }, // SINGLE EYE display-select and wink pins, rotate 180
  45. #elif defined(ARDUINO_SAMD_CIRCUITPLAYGROUND_EXPRESS)
  46. { A7, -1, 0 }, // SINGLE EYE display-select and wink pins, no rotate
  47. #else
  48. { 10, -1, 0 }, // LEFT EYE display-select and wink pins, no rotation
  49. { 6, -1, 0 }, // RIGHT EYE display-select and wink pins, no rotation
  50. #endif
  51. };
  52. // DISPLAY HARDWARE SETTINGS (screen type & connections) -------------------
  53. #if defined(ARDUINO_SAMD_CIRCUITPLAYGROUND_EXPRESS)
  54. #define TFT_SPI SPI1
  55. #define TFT_PERIPH PERIPH_SPI1
  56. #else
  57. #define TFT_SPI SPI
  58. #define TFT_PERIPH PERIPH_SPI
  59. #endif
  60. #if defined(ADAFRUIT_HALLOWING)
  61. #include <ST7735_t3.h> // TFT display library
  62. #define DISPLAY_DC 9 // Display data/command pin
  63. #define DISPLAY_RESET 8 // Display reset pin
  64. #define DISPLAY_BACKLIGHT 7
  65. #define BACKLIGHT_MAX 128
  66. //#define SYNCPIN A2 // I2C sync if set, GND this pin on receiver
  67. //#define SYNCADDR 0x08 // I2C address of receiver
  68. // (Try disabling SYMMETRICAL_EYELID then)
  69. #elif defined(ARDUINO_SAMD_CIRCUITPLAYGROUND_EXPRESS)
  70. #include <ST7735_t3.h> // TFT display library
  71. #define DISPLAY_DC A6 // Display data/command pin
  72. #define DISPLAY_RESET -1 // Display reset pin
  73. #define DISPLAY_BACKLIGHT A3
  74. #define BACKLIGHT_MAX 255
  75. #else
  76. // Enable ONE of these #includes to specify the display type being used
  77. //#include <Adafruit_SSD1351.h> // OLED display library -OR-
  78. #include <ST7735_t3.h> // TFT display library (enable one only)
  79. #define DISPLAY_DC 9 // Data/command pin for ALL displays
  80. #define DISPLAY_RESET 8 // Reset pin for ALL displays
  81. #endif
  82. #if defined(_ADAFRUIT_ST7735H_) || defined(_ADAFRUIT_ST77XXH_)
  83. #define SPI_FREQ 48000000 // TFT: use max SPI (clips to 12 MHz on M0)
  84. #else // OLED
  85. #if !defined(ARDUINO_ARCH_SAMD) && (F_CPU <= 72000000)
  86. #define SPI_FREQ 24000000 // OLED: 24 MHz on 72 MHz Teensy only
  87. #else
  88. #define SPI_FREQ 12000000 // OLED: 12 MHz in all other cases
  89. #endif
  90. #endif
  91. // INPUT SETTINGS (for controlling eye motion) -----------------------------
  92. // JOYSTICK_X_PIN and JOYSTICK_Y_PIN specify analog input pins for manually
  93. // controlling the eye with an analog joystick. If set to -1 or if not
  94. // defined, the eye will move on its own.
  95. // IRIS_PIN speficies an analog input pin for a photocell to make pupils
  96. // react to light (or potentiometer for manual control). If set to -1 or
  97. // if not defined, the pupils will change on their own.
  98. // BLINK_PIN specifies an input pin for a button (to ground) that will
  99. // make any/all eyes blink. If set to -1 or if not defined, the eyes will
  100. // only blink if AUTOBLINK is defined, or if the eyeInfo[] table above
  101. // includes wink button settings for each eye.
  102. //#define JOYSTICK_X_PIN A0 // Analog pin for eye horiz pos (else auto)
  103. //#define JOYSTICK_Y_PIN A1 // Analog pin for eye vert position (")
  104. //#define JOYSTICK_X_FLIP // If defined, reverse stick X axis
  105. //#define JOYSTICK_Y_FLIP // If defined, reverse stick Y axis
  106. #define TRACKING // If defined, eyelid tracks pupil
  107. #define AUTOBLINK // If defined, eyes also blink autonomously
  108. #if defined(ADAFRUIT_HALLOWING)
  109. #define LIGHT_PIN A1 // Hallowing light sensor pin
  110. #define LIGHT_CURVE 0.33 // Light sensor adjustment curve
  111. #define LIGHT_MIN 30 // Minimum useful reading from light sensor
  112. #define LIGHT_MAX 980 // Maximum useful reading from sensor
  113. #elif defined(ARDUINO_SAMD_CIRCUITPLAYGROUND_EXPRESS)
  114. #define LIGHT_PIN A8 // CPX light sensor pin
  115. #define LIGHT_CURVE 0.33 // Light sensor adjustment curve
  116. #define LIGHT_MIN 30 // Minimum useful reading from light sensor
  117. #define LIGHT_MAX 980 // Maximum useful reading from sensor
  118. #define BLINK_PIN 4 // Button
  119. #else
  120. #define BLINK_PIN 1 // Pin for manual blink button (BOTH eyes)
  121. #define LIGHT_PIN A2 // Photocell or potentiometer (else auto iris)
  122. #define LIGHT_PIN_FLIP // If defined, reverse reading from dial/photocell
  123. #define LIGHT_MIN 0 // Lower reading from sensor
  124. #define LIGHT_MAX 1023 // Upper reading from sensor
  125. #endif
  126. #define IRIS_SMOOTH // If enabled, filter input from IRIS_PIN
  127. #if !defined(IRIS_MIN) // Each eye might have its own MIN/MAX
  128. #define IRIS_MIN 120 // Iris size (0-1023) in brightest light
  129. #endif
  130. #if !defined(IRIS_MAX)
  131. #define IRIS_MAX 720 // Iris size (0-1023) in darkest light
  132. #endif