Skip to content

Commit

Permalink
changed to match common Griduino file
Browse files Browse the repository at this point in the history
  • Loading branch information
barry-ha committed Jan 18, 2024
1 parent 68b8ab6 commit 2584935
Showing 1 changed file with 58 additions and 30 deletions.
88 changes: 58 additions & 30 deletions examples/DAC_timer_v4/hardware.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ On-board lights:

// TFT display and SD card share the hardware SPI interface, and have
// separate 'select' pins to identify the active device on the bus.

#if defined(SAMD_SERIES)
// Adafruit Feather M4 Express pin definitions
// To compile for Feather M0/M4, install "additional boards manager"
Expand All @@ -67,53 +68,80 @@ On-board lights:
#define SD_CD 10 // SD card detect pin - Feather
#define SD_CCS 11 // SD card select pin - Feather

#elif defined(ARDUINO_AVR_MEGA2560)
#define TFT_BL 6 // TFT backlight
#define SD_CCS 7 // SD card select pin - Mega
#define SD_CD 8 // SD card detect pin - Mega
#define TFT_DC 9 // TFT display/command pin
#define TFT_CS 10 // TFT chip select pin
#elif defined(ARDUINO_ADAFRUIT_FEATHER_RP2040)
// Ref: https://arduino-pico.readthedocs.io/en/latest/index.html
// Adafruit Feather_RP2040 pin definitions
// To compile for Feather_RP2040, install "additional boards manager"
// https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json

#define TFT_BL 4 // TFT backlight
#define TFT_CS 5 // TFT chip select pin
#define TFT_DC 12 // TFT display/command pin
#define BMP_CS 13 // BMP388 sensor, chip select

#define SD_CD 10 // SD card detect pin - Feather
#define SD_CCS 11 // SD card select pin - Feather

#else
#warning You need to define pins for your SPI bus hardware
#endif

// ------- TFT 4-Wire Resistive Touch Screen configuration parameters
// For touch point precision, we need to know the resistance
// between X+ and X- Use any multimeter to read it
#define XP_XM_OHMS 295 // Resistance in ohms between X+ and X- to calibrate touch pressure
// measure this with an ohmmeter while Griduino turned off

#define TOUCHPRESSURE 200 // Minimum pressure threshhold considered an actual "press"

#define X_MIN_OHMS 150 // Expected range on touchscreen's X-axis readings
#define X_MAX_OHMS 880
#define Y_MIN_OHMS 110 // Expected range on touchscreen's Y-axis readings
#define Y_MAX_OHMS 860
#define XP_XM_OHMS 0 // Set to zero to receive raw pressure measurements

#define START_TOUCH_PRESSURE 200 // Minimum pressure threshold considered start of "press"
#define END_TOUCH_PRESSURE 50 // Maximum pressure threshold required before end of "press"

#define X_MIN_OHMS 100 // Expected range on touchscreen's X-axis readings
#define X_MAX_OHMS 900
#define Y_MIN_OHMS 100 // Expected range on touchscreen's Y-axis readings
#define Y_MAX_OHMS 900

#if defined(ARDUINO_ADAFRUIT_FEATHER_RP2040)
// ---------- Touch Screen pins - Adafruit Feather RP2040
#define PIN_XM A2 // Touchscreen X- must be an analog pin, use "An" notation
#define PIN_YP A3 // Touchscreen Y+ must be an analog pin, use "An" notation
#define PIN_XP 24 // Touchscreen X+ can be a digital pin
#define PIN_YM 25 // Touchscreen Y- can be a digital pin

// ---------- Audio output pins
// #define DAC_PIN 0 // do not use - RP2040 has no DAC
// #define PIN_SPEAKER 0 // do not use - RP2040 has no DAC
#else
// ---------- Touch Screen pins - Feather M4
#define PIN_XP A3 // Touchscreen X+ can be a digital pin
#define PIN_XM A4 // Touchscreen X- must be an analog pin, use "An" notation
#define PIN_YP A5 // Touchscreen Y+ must be an analog pin, use "An" notation
#define PIN_YM 9 // Touchscreen Y- can be a digital pin
// ---------- Audio output pins
#define DAC_PIN DAC0 // onboard DAC0 == pin A0
#define PIN_SPEAKER DAC0 // uses DAC
#endif

// ---------- Touch Screen
#define PIN_XP A3 // Touchscreen X+ can be a digital pin
#define PIN_XM A4 // Touchscreen X- must be an analog pin, use "An" notation
#define PIN_YP A5 // Touchscreen Y+ must be an analog pin, use "An" notation
#define PIN_YM 9 // Touchscreen Y- can be a digital pin
// ---------- Battery voltage sensor
#if defined(ARDUINO_ADAFRUIT_FEATHER_RP2040)
#define BATTERY_ADC A1
#endif

// ---------- Feather's onboard lights
// ---------- Feather RP2040 onboard led
#if defined(ARDUINO_ADAFRUIT_FEATHER_RP2040)
#define RED_LED 25 // diagnostics RED LED
#else
#define RED_LED 13 // diagnostics RED LED
// define PIN_LED 13 // already defined in Feather's board variant.h
#endif

// ---------- neopixel
#define NUMPIXELS 1 // Feather M4 has one NeoPixel on board
// efine PIN_NEOPIXEL 8 // already defined in Feather's board variant.h

// ---------- Audio output
#define DAC_PIN DAC0 // onboard DAC0 == pin A0
#define PIN_SPEAKER DAC0 // uses DAC
// define PIN_NEOPIXEL 8 // already defined in Feather's board variant.h

// ---------- Digital potentiometer
// Adafruit Feather M4 Express pin definitions
#if defined(ARDUINO_ADAFRUIT_FEATHER_RP2040)
// todo - Griduino PCB v7 uses volume control on I2C
#else
// Griduino PCB v7 uses volume control DS1804 on SPI
#define PIN_VCS A1 // volume chip select
#define PIN_VUD A2 // volume up/down
#endif

// Adafruit ItsyBitsy M4 Express potentiometer wiring
#if defined(ADAFRUIT_ITSYBITSY_M4_EXPRESS)
Expand Down

0 comments on commit 2584935

Please sign in to comment.