Pins and devices refactoring in progress

This commit is contained in:
Emanuele Trabattoni
2026-03-26 18:22:22 +01:00
parent 68ed8a2282
commit a0710f7ee7
7 changed files with 314 additions and 225 deletions

View File

@@ -1,86 +1,129 @@
#pragma once
// =====================
// SPI BUS
// USB (RISERVATA)
// =====================
#define SPI_MOSI 11
#define SPI_MISO 13
#define SPI_SCK 12
#define USB_DM 19
#define USB_DP 20
// =====================
// I2C BUS
// UART DEBUG (RISERVATA)
// =====================
#define SDA 8
#define SCL 9
#define UART_TX 43
#define UART_RX 44
// =====================
// ADC CONTROL
// RGB Led
// =====================
#define ADC_CS 10
#define ADC_DRDY 4
#define ADC_RST 5
#define ADC_SYNC 6
#define LED 48
// =====================
// STRAPPING (NON USARE)
// =====================
// 0, 3
// =====================
// SPI BUS ADC1 (VSPI)
// =====================
#define SPI_A_MOSI 11
#define SPI_A_MISO 13
#define SPI_A_SCK 12
// =====================
// SPI BUS ADC2 (HSPI)
// =====================
#define SPI_B_MOSI 35
#define SPI_B_MISO 37
#define SPI_B_SCK 36
// =====================
// I2C BUS (PCA9555)
// =====================
#define SDA 8
#define SCL 9
// =====================
// ADC CONTROL (NO CONFLICT)
// =====================
#define ADC_A_CS 4
#define ADC_A_DRDY 5
#define ADC_A_RST 6
#define ADC_A_SYNC 7
#define ADC_B_CS 14
#define ADC_B_DRDY 15
#define ADC_B_RST 16
#define ADC_B_SYNC 17
// =====================
// DIGITAL POT
// =====================
#define POT_CS 7
#define POT_DRDY 18
// =====================
// RELAY OUT
// =====================
#define PICK_RELAY 21
#define POT_A_CS 1
#define POT_B_CS 2
// =====================
// TRIGGER INPUT INTERRUPTS
// =====================
#define TRIG_A12P 1
#define TRIG_A12N 2
#define TRIG_A34P 3
#define TRIG_A34N 14
#define TRIG_B12P 15
#define TRIG_B12N 16
#define TRIG_B34P 17
#define TRIG_B34N 18
#define TRIG_A12P 21
#define TRIG_A12N 33
#define TRIG_A34P 34
#define TRIG_A34N 38
#define TRIG_B12P 39
#define TRIG_B12N 40
#define TRIG_B34P 41
#define TRIG_B34N 42
// =====================
// PEAK DETECTOR RESET OUTPUTS
// SPARK DETECT INPUTS (INPUT ONLY SAFE)
// =====================
#define RST_A12P 39
#define RST_A12N 40
#define RST_A34P 41
#define RST_A34N 42
#define RST_B12P 35
#define RST_B12N 36
#define RST_B34P 37
#define RST_B34N 38
#define SPARK_A12 45
#define SPARK_A34 46
#define SPARK_B12 47
#define SPARK_B34 18
// =====================
// SPARK DETECT INPUTS
// PCA9555 (I2C EXPANDER)
// =====================
#define SPARK_A12 45 // input only
#define SPARK_A34 46 // input only
#define SPARK_B12 47
#define SPARK_B34 48
// =====================
// STATUS & BUTTON su PCA9555 (I2C)
// =====================
#define STA_1 0
#define STA_2 1
#define STA_3 2
#define STA_4 3
#define STA_5 4
#define STA_6 5
#define STA_7 6
#define STA_8 7
// --- RESET LINES (ora su expander) ---
#define RST_A12P 0
#define RST_A12N 1
#define RST_A34P 2
#define RST_A34N 3
#define RST_B12P 4
#define RST_B12N 5
#define RST_B34P 6
#define RST_B34N 7
#define BTN_1 8
#define BTN_2 9
#define BTN_3 10
#define BTN_4 11
#define BTN_5 12
#define BTN_6 13
#define BTN_7 14
#define BTN_8 15
// --- RELAY LINES ---
#define A_RELAY 8
#define B_RELAY 9
// --- STATUS OUTPUT ---
#define BTN_3 10
#define BTN_4 11
#define STA_1 12
#define STA_2 13
#define STA_3 14
#define STA_4 15
// Init Pin Functions
inline void initTriggerPinsInputs()
{
pinMode(TRIG_A12P, INPUT);
pinMode(TRIG_A12N, INPUT);
pinMode(TRIG_A34P, INPUT);
pinMode(TRIG_A34N, INPUT);
pinMode(TRIG_B12P, INPUT);
pinMode(TRIG_B12N, INPUT);
pinMode(TRIG_B34P, INPUT);
pinMode(TRIG_B34N, INPUT);
}
inline void initSparkPinInputs()
{
pinMode(SPARK_A12, INPUT);
pinMode(SPARK_A34, INPUT);
pinMode(SPARK_B12, INPUT);
pinMode(SPARK_B34, INPUT);
}