Pin mapping of CTs for Photon

I was wondering how pin assignments were made for reading the CTs, especially in something like the Particle Photon? I understand there is an EmonLib.h library ported to Photon, but how does that library know pin 2 is for voltage, and pin 1 is for current?

emon1.voltage(2, 234.26, 1.7); // Voltage: input pin, calibration, phase_shift
emon1.current(1, 111.1); // Current: input pin, calibration.

Assuming that the inclusion of application.h and the EmonLib.h port does this remapping behind the scenes, would it be safe to say that these are A0-A8, and just a matter of adding more of the same line above for current, only changing the pin and calibration to match the physcial inputs? I apologize in advance, I just wish to make sure I understand and also not blow up my Photon.

It doesn’t. You are telling it exactly that with

The allocation of pins to logical channels for the emonTx V2 is done in emonLib.cpp, in

EnergyMonitor::voltageTX(double _VCAL, double _PHASECAL)
EnergyMonitor::currentTX(unsigned int _channel, double _ICAL)

if you use

EnergyMonitor::voltage(unsigned int _inPinV, double _VCAL, double _PHASECAL)
EnergyMonitor::current(unsigned int _inPinI, double _ICAL)

then you define the analogue input to use - not the physical pin number, but the Analogue input number (the name inPin is somewhat misleading).

You won’t blow up your ADC/input if your are reading - it’s only when you write to a pin that’s being fed a voltage that you will risk damaging the input, and possibly the whole device.

The use of inPin was what got me. I saw the second example you provided in the emonLib.cpp ported to Photon, but was expecting to see A0, A1, A3, etc… for mapping to a pin. Thank you.