AnsweredAssumed Answered

Simple C Question

Question asked by Arman Ilmak on May 10, 2018
Latest reply on May 10, 2018 by KIC8462852 EPIC204278916


I was trying to write a code to use my keypad, but I face a problem. Because I'm new in using standard libraries I didn't face a similar problem when I was using registers(in LPC series).



#define COLUMN_PIN_1    GPIO_PIN_4
#define COLUMN_PIN_2    GPIO_PIN_5
#define COLUMN_PIN_3    GPIO_PIN_4
#define COLUMN_PIN_4    GPIO_PIN_2

#define COLUMN_PORT_1    GPIOB
#define COLUMN_PORT_2    GPIOB
#define COLUMN_PORT_3    GPIOF
#define COLUMN_PORT_4    GPIOA



if(GPIO_ReadInputPin(COLUMN_PORT_j,COLUMN_PIN_j))return (4*(i-1)+j-1);  


In this code, I thought that the amount of the j will be replaced and for example when j is 1 COLUMN_PORT_j is COLUMN_PORT_1.


What should I do to achieve this purpose?