This commit is contained in:
Neale Pickett 2020-11-15 14:49:05 -07:00
parent d1214e803b
commit a12e5f6276
2 changed files with 40 additions and 18 deletions

View File

@ -1,5 +1,6 @@
FQBN = adafruit:samd:adafruit_trellis_m4 FQBN = adafruit:samd:adafruit_trellis_m4
UF2_MOUNT = /mnt/chromeos/removable/TRELM4BOOT UF2_MOUNT = /media/neale/TRELM4BOOT
ARDUINO_DIR = /opt/arduino-1.8.13
default: build/uilleann.ino.uf2 default: build/uilleann.ino.uf2
install: build/uilleann.ino.uf2 install: build/uilleann.ino.uf2
@ -21,11 +22,11 @@ build/%.bin: % *.cpp *.h
-core-api-version 10813 \ -core-api-version 10813 \
-fqbn $(FQBN) \ -fqbn $(FQBN) \
-hardware ~/.arduino15/packages \ -hardware ~/.arduino15/packages \
-tools /app/Arduino/tools-builder \ -tools $(ARDUINO_DIR)/tools-builder \
-tools ~/.arduino15/packages \ -tools ~/.arduino15/packages \
-hardware /app/Arduino/hardware \ -hardware $(ARDUINO_DIR)/hardware \
-hardware ~/.arduino15/packages \ -hardware ~/.arduino15/packages \
-built-in-libraries /app/Arduino/libraries \ -built-in-libraries $(ARDUINO_DIR)/libraries \
-libraries ~/Arduino/libraries \ -libraries ~/Arduino/libraries \
-compile \ -compile \
$< $<

View File

@ -10,8 +10,13 @@
#include "notes.h" #include "notes.h"
#include "pipe.h" #include "pipe.h"
#if defined(ADAFRUIT_TRELLIS_M4_EXPRESS)
#include <Adafruit_NeoTrellisM4.h>
Adafruit_NeoTrellisM4 trellis = Adafruit_NeoTrellisM4();
#endif
#define DRONES #define DRONES
#define DEBUG #define DEBUG false
Pipe pipe; Pipe pipe;
Adafruit_SSD1306 display(128, 32, &Wire, -1); Adafruit_SSD1306 display(128, 32, &Wire, -1);
@ -26,13 +31,18 @@ AudioMixer4 mixDrones;
AudioMixer4 mixRegulators; AudioMixer4 mixRegulators;
AudioMixer4 mixL; AudioMixer4 mixL;
AudioMixer4 mixR; AudioMixer4 mixR;
AudioOutputI2S out1;
AudioSynthNoiseWhite noise; AudioSynthNoiseWhite noise;
#if defined(ADAFRUIT_TRELLIS_M4_EXPRESS)
AudioOutputAnalogStereo out1;
#else
AudioOutputI2S out1;
#endif
AudioConnection FMVoicePatchCords[] = { AudioConnection FMVoicePatchCords[] = {
//{0, 0, 0, 0}, // For some reason, the first one is ignored //{0, 0, 0, 0}, // For some reason, the first one is ignored
{noise, 0, mixDrones, 3}, // {noise, 0, mixDrones, 3},
{noise, 0, mixL, 3}, {noise, 0, mixL, 3},
{noise, 0, mixR, 3}, {noise, 0, mixR, 3},
@ -75,15 +85,15 @@ void blink(bool forever) {
} }
void setup() { void setup() {
pinMode(LED_BUILTIN, OUTPUT); // Wire.begin needs a moment, so let's do some math.
digitalWrite(LED_BUILTIN, true);
setupJustPitches(NOTE_D4, PITCH_D4); setupJustPitches(NOTE_D4, PITCH_D4);
// Wire.begin needs a moment
delay(100);
Wire.begin(); Wire.begin();
// PREPARE TO BLINK
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, true);
// Initialize display // Initialize display
if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3c)) { if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3c)) {
blink(true); blink(true);
@ -94,6 +104,10 @@ void setup() {
display.print("Starting"); display.print("Starting");
display.display(); display.display();
#if defined(ADAFRUIT_TRELLIS_M4_EXPRESS)
trellis.begin();
#endif
while (!pipe.Init()) { while (!pipe.Init()) {
display.clearDisplay(); display.clearDisplay();
display.setCursor(0, 0); display.setCursor(0, 0);
@ -204,21 +218,28 @@ void loop() {
pipe.Update(); pipe.Update();
#if 0 #if defined(ADAFRUIT_TRELLIS_M4_EXPRESS)
trellis.tick();
trellis.setPixelColor(0, trellis.ColorHSV(120*pipe.kneeClosedness));
#endif
static uint16_t loopno = 0;
if (false) {
display.clearDisplay(); display.clearDisplay();
display.setTextSize(1);
display.setCursor(0, 0); display.setCursor(0, 0);
display.print("mem: "); display.print("mem: ");
display.print(AudioMemoryUsageMax()); display.print(AudioMemoryUsageMax());
display.print(" prx: "); display.print(" prx: ");
display.print(paj_knee); display.print(pipe.kneeClosedness);
display.setCursor(0, 24); display.setCursor(0, 24);
display.print("Note: "); display.print("Note: ");
display.print(note); display.print(pipe.note);
display.print(" n: "); display.print(" n: ");
display.print(loopno); display.print(loopno++);
display.display(); display.display();
return; }
#endif
// If we're infinitely (for the sensor) off the knee, // If we're infinitely (for the sensor) off the knee,
// go into setup mode! // go into setup mode!