The X lines can be configured on different ports up to a maximum of 3 ports. Ex: NUM_X_PORTS = 3 (maximum value supported). However the possible values are NUM_X_PORTS = 1 or NUM_X_PORTS = 2 or NUM_X_PORTS = 3
The X lines can be configured on the three different ports.
The X lines can be configured on any pins of the ports selected above. Ex: X0 on PB2, X1 on PD5, X2 on PE0, X3 on PD1( when NUM_X_LINES= 4), Provided that these pins do not conflict with the other pins for touch sensing or with the host application usage.
The Y lines can be configured on the any of the pins of the ports selected. Ex: Any pins on the PORT_YA and PORT_YB selected. Suppose, PORT_YA is D, and PORT_YB is C Since, pin 5 and pin 1 PORTD are already used for X lines(X1, X3), the user can select any of the remaining pins for Y0A lines. Suppose that Y0 is on pin2 and Y1 is on pin6 Hence, Y0A - PD2, Y0B - PC2, Y1A - PD6, Y1B - PC6.
All the Qmatrix usage Pins X lines,YA lines, YB lines and SMP line can be on same port.Both YA and YB lines can share the same port. And the YA and YB need not be on same corresponding pins of the ports.The Macro SHARED_YAYB should be defined as 1 if YA and YB are on same port else should be defined as 0.
The PORT_YB is fixed for each device and should be same as the PORT on which the ADC input pins are available
The SMP pin can be configured on any of the IO PORT pins available. Ex: PORT_SMP = D SMP_PIN = 7 as this pin is not being used by touch sensing.
Take care that the touch sensing pins do not conflict with other IO pins used by host application.