59 lines
1.2 KiB
C
59 lines
1.2 KiB
C
#ifndef SHARED_STATE_H
|
|
#define SHARED_STATE_H
|
|
|
|
#include <Arduino.h>
|
|
#include <I2S.h>
|
|
#include <Adafruit_GFX.h>
|
|
#include <Adafruit_SSD1306.h>
|
|
#include <MIDI.h>
|
|
|
|
// --- Pin Definitions ---
|
|
// I2S Audio
|
|
#define I2S_BCLK_PIN 9
|
|
#define I2S_LRCK_PIN 10
|
|
#define I2S_DATA_PIN 11
|
|
|
|
// I2C OLED Display
|
|
#define OLED_SDA_PIN 4
|
|
#define OLED_SCL_PIN 5
|
|
|
|
// Controls
|
|
#define ENCODER_CLK_PIN 12
|
|
#define ENCODER_DT_PIN 13
|
|
#define ENCODER_SW_PIN 14
|
|
#define VOL_POT_PIN 26 // ADC0
|
|
|
|
// MIDI Input
|
|
#define MIDI_RX_PIN 1 // UART0 RX
|
|
|
|
// --- Constants ---
|
|
#define SCREEN_WIDTH 128
|
|
#define SCREEN_HEIGHT 64
|
|
#define OLED_RESET -1
|
|
|
|
#define SAMPLE_RATE 44100
|
|
#define BITS_PER_SAMPLE 16
|
|
|
|
// --- Global Objects ---
|
|
extern I2S i2s;
|
|
extern Adafruit_SSD1306 display;
|
|
extern midi::MidiInterface<HardwareSerial> MIDI;
|
|
|
|
// --- Watchdog ---
|
|
extern volatile unsigned long lastLoop0Time;
|
|
extern volatile unsigned long lastLoop1Time;
|
|
extern volatile bool watchdogActive;
|
|
|
|
// --- Synthesizer State ---
|
|
extern volatile float g_note_frequency;
|
|
extern volatile bool g_note_on;
|
|
extern volatile float g_volume;
|
|
extern float g_phase;
|
|
|
|
// --- Control State ---
|
|
extern int g_encoder_value;
|
|
|
|
// --- Test Mode ---
|
|
// #define TEST_OUT
|
|
|
|
#endif |