131 lines
2.9 KiB
C
131 lines
2.9 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 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
|
|
// =====================
|
|
#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_A_CS 1
|
|
//#define POT_B_CS 2
|
|
|
|
// =====================
|
|
// TRIGGER INPUT INTERRUPTS
|
|
// =====================
|
|
#define TRIG_PIN_A12P 18
|
|
#define TRIG_PIN_A12N 21
|
|
#define TRIG_PIN_A34P 1
|
|
#define TRIG_PIN_A34N 2
|
|
#define TRIG_PIN_B12P 38
|
|
#define TRIG_PIN_B12N 39
|
|
#define TRIG_PIN_B34P 40
|
|
#define TRIG_PIN_B34N 41
|
|
|
|
// =====================
|
|
// SPARK DETECT INPUTS
|
|
// =====================
|
|
#define SPARK_PIN_A12 42
|
|
#define SPARK_PIN_A34 45 // OK (strapping ma consentito) 45
|
|
#define SPARK_PIN_B12 46 // OK (strapping ma consentito) 46
|
|
#define SPARK_PIN_B34 47
|
|
|
|
// =====================
|
|
// PCA9555 (I2C EXPANDER)
|
|
// =====================
|
|
|
|
// --- RESET LINES ---
|
|
#define RST_EXT_A12P 0
|
|
#define RST_EXT_A12N 1
|
|
#define RST_EXT_A34P 2
|
|
#define RST_EXT_A34N 3
|
|
#define RST_EXT_B12P 4
|
|
#define RST_EXT_B12N 5
|
|
#define RST_EXT_B34P 6
|
|
#define RST_EXT_B34N 7
|
|
|
|
// --- RELAY ---
|
|
#define A_EXT_RELAY 8
|
|
#define B_EXT_RELAY 9
|
|
|
|
// --- STATUS / BUTTON ---
|
|
#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_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);
|
|
}
|