Files
2026-04-10 12:12:28 +02:00

128 lines
2.6 KiB
C

#pragma once
#include <Arduino.h>
// =====================
// USB (RISERVATA)
// =====================
#define USB_DM 19
#define USB_DP 20
// =====================
// UART DEBUG (RISERVATA)
// =====================
#define UART_TX 43
#define UART_RX 44
// =====================
// RGB Led
// =====================
#define LED 48
// =====================
// STRAPPING CRITICI (NON USARE)
// =====================
// 0, 3
// =====================
// SPI BUS ADC1 (VSPI)
// =====================
#define SPI_A_MOSI 10
#define SPI_A_SCK 11
#define SPI_A_MISO 12
// =====================
// SPI BUS ADC2 (HSPI)
// =====================
#define SPI_B_MOSI 36
#define SPI_B_SCK 37
#define SPI_B_MISO 38
// =====================
// I2C BUS (PCA9555)
// =====================
#define SDA 8
#define SCL 9
#define I2C_INT 17
// =====================
// ADC CONTROL
// =====================
#define ADC_A_CS 14
#define ADC_A_DRDY 13
#define ADC_B_CS 21
#define ADC_B_DRDY 47
// =====================
// DIGITAL POT
// =====================
#define POT_A_CS 18
#define POT_B_CS 35
// =====================
// TRIGGER INPUT INTERRUPTS
// =====================
#define TRIG_PIN_A12P 6
#define TRIG_PIN_A12N 7
#define TRIG_PIN_A34P 15
#define TRIG_PIN_A34N 16
#define TRIG_PIN_B12P 42
#define TRIG_PIN_B12N 41
#define TRIG_PIN_B34P 40
#define TRIG_PIN_B34N 39
// =====================
// SPARK DETECT INPUTS
// =====================
#define SPARK_PIN_A12 4
#define SPARK_PIN_A34 5
#define SPARK_PIN_B12 1
#define SPARK_PIN_B34 2
// =====================
// PCA9555 (I2C EXPANDER)
// =====================
// --- RESET LINES ---
#define RST_EXT_PEAK_DETECT_A 0
#define RST_EXT_SAMPLE_HOLD_A 1
#define RST_EXT_PEAK_DETECT_B 2
#define RST_EXT_SAMPLE_HOLD_B 3
#define BTN_3 4
#define BTN_4 5
#define BTN_5 6
#define BTN_6 7
// --- RELAY ---
#define EXT_RELAY_A 8
#define EXT_RELAY_B 9
// --- STATUS / BUTTON ---
#define BTN_7 10
#define BTN_8 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_PIN_A12P, INPUT_PULLDOWN);
pinMode(TRIG_PIN_A12N, INPUT_PULLDOWN);
pinMode(TRIG_PIN_A34P, INPUT_PULLDOWN);
pinMode(TRIG_PIN_A34N, INPUT_PULLDOWN);
pinMode(TRIG_PIN_B12P, INPUT_PULLDOWN);
pinMode(TRIG_PIN_B12N, INPUT_PULLDOWN);
pinMode(TRIG_PIN_B34P, INPUT_PULLDOWN);
pinMode(TRIG_PIN_B34N, INPUT_PULLDOWN);
}
inline void initSparkPinInputs()
{
pinMode(SPARK_PIN_A12, INPUT_PULLDOWN);
pinMode(SPARK_PIN_A34, INPUT_PULLDOWN);
pinMode(SPARK_PIN_B12, INPUT_PULLDOWN);
pinMode(SPARK_PIN_B34, INPUT_PULLDOWN);
}