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