#include "./defines.h"
#include <ArduinoUniqueID>
// Abstraction of nets to function
// Shift Register control
const int Data = DIO_E8;
const int Clock = DIO_E9;
const int OutPut_en = DIO_F0;
const int Latch = DIO_F1;
// PCB Population Levels
const int Input_Relays = DIO_B1;
const int Output_Relays = DIO_B0;
const int CTs = DIO_A5;
const int CCID = DIO_A4;
const int _264_VAC_In = DIO_A3;
const int Prometheus = DIO_A2;
const int PLC = DIO_A1;
// const int tbd = DIO_A0; // spair
// Analouge Pins
const int Interlock_uC = AIN_00;
const int _12V_Mon = AIN_01;
const int _5V_Mon = AIN_02;
const int PP_Detect = AIN_03;
const int CP_Detect = AIN_04;
const int Supply_Volts = AIN_05;
const int Supply_Relay_Weld = AIN_06;
const int DUT_Relay_Weld = AIN_07;
const int DUT_Volts = AIN_08;
const int I_L1_DUT = AIN_09;
const int I_L2_DUT = AIN_10;
const int I_L3_DUT = AIN_11;
const int _500ohm_FB = AIN_12;
const int I_Sense = AIN_13;
// Front Panel Switches
const int PP_NC_Switch = DIO_C0;
const int _20A_Switch = DIO_C2;
const int _13A_Switch = DIO_C3;
const int _64A_Switch = DIO_C4;
const int _32A_Switch = DIO_C5;
const int eStop_Switch = DIO_C6;
const int PP_GND_Switch = DIO_C7;
const int Front_Panel_1 = DIO_C8;
const int Local_Switch = DIO_C9;
const int CP_Diode_Switch = DIO_D0;
const int CP_NC_Switch = DIO_D1;
const int State_B_Switch = DIO_D2;
const int State_A_Switch = DIO_D3;
const int State_D_Switch = DIO_D4;
const int State_C_Switch = DIO_D5;
const int GFIC_Switch = DIO_D6;
const int GND_Connect_Switch = DIO_D7;
const int Front_Panel_2 = DIO_D8;
const int Load_Switch = DIO_D9;
// Shift Register attached outputs
const int Interlock_en = SR_A1;
const int RAG_Blue_en = SR_A2;
const int RAG_Green_en = SR_A3;
const int RAG_Amber_en = SR_A4;
const int RAG_RED_en = SR_A5;
const int Heart_Beat = SR_A6;
const int N_NO_Relay = SR_A7;
const int GND_Disconnect_Relay = SR_A8;
const int Mains_L1_Relay = SR_B1;
const int _264V_L1_Relay = SR_B2;
const int Mains_N_Relay = SR_B3;
const int Mains_L3_Relay = SR_B4;
const int _264V_L2_Relay = SR_B5;
const int Mains_L2_Relay = SR_B6;
const int GF_Live_1 = SR_B7;
const int Load_L1_Relay = SR_B8;
const int Load_N_Relay = SR_C1;
const int GF_Live_2 = SR_C2;
const int GF_Live_3 = SR_C3;
const int Load_L3_Relay = SR_C4;
const int Load_L2_Relay = SR_C5;
const int Load_LED = SR_D1;
const int GFIC_LED = SR_D2;
const int CP_Diode_LED = SR_D3;
const int CP_Error_LED = SR_D4;
const int State_D_LED = SR_D5;
const int State_C_LED = SR_D6;
const int State_B_LED = SR_D7;
const int State_A_LED = SR_D8;
const int PP_Error_LED = SR_E1;
const int PP_64A_LED = SR_E2;
const int PP_32A_LED = SR_E3;
const int PP_20A_LED = SR_E4;
const int PP_13A_LED = SR_E5;
const int PP_13A = SR_F1;
const int PP_20A = SR_F2;
const int PP_32A = SR_F3;
const int PP_64A = SR_F4;
const int PP_Error = SR_F5;
const int CP_Diode = SR_F6;
const int State_B = SR_F7;
const int State_C = SR_F8;
const int State_D = SR_G1;
const int CP_Error = SR_G2;
const int Value1 = SR_G3;
const int Value2 = SR_G4;
const int Value3 = SR_G5;
const int Value4 = SR_G6;
const int Value5 = SR_G7;
const int Value6 = SR_G8;
const int Value7 = SR_H1;
const int Value8 = SR_H2;
const int Value9 = SR_H3;
const int Value10 = SR_H4;
const int Value11 = SR_H5;
const int _500ohm = SR_H6;
// this is changed to be the maximum version of the hardware the code has been tested on.
const int Tested_Version = 0;
int version() {
int valA = analogRead(VerPin0); // Analog pin A1
int valB = analogRead(VerPin1); // Analog pin A0
valA = map(valA, 0, 1023, 7, 0); // Aaps the value from analouge pin to 0-7.
valB = map(valB, 0, 1023, 7, 0);
if (valB != 0) valB = valB + 7; // adds 7 to the MSB if it is not zero
int version = valA + valB; // gives us a hardware version between 0 and 21.
return version;
}
void setup() {
// put your setup code here, to run once:
Serial.begin(9600); // setup serial at 9600,
}
void loop() {
// put your main code here, to run repeatedly:
Serial.println ((String)version());
for(size_t i = 0; i < UniqueIDsize; i++)
Serial.println(UniqueID[i], HEX);
}