I want to use Read function of HAL Library for several pins. Can i define pins in header file like #define signalx GPIO_Pin_PA5 ?
Sure you could do that.
But, are you using STM32CubeMX to generate your project? If so, you can label any pins you like within the tool. Just right click the pin and select "Enter User Label".
Then when you generate the project, main.h will contain the #defines for all the named pins. Here's what it would look like:
/* Private defines -----------------------------------------------------------*/
#define LED0_GREEN_Pin GPIO_PIN_6
#define LED0_GREEN_GPIO_Port GPIOI
#define LED0_RED_Pin GPIO_PIN_5
#define LED0_RED_GPIO_Port GPIOI
#define DBG_UART_TX_Pin GPIO_PIN_1
#define DBG_UART_TX_GPIO_Port GPIOE
#define DBG_UART_RX_Pin GPIO_PIN_0
#define DBG_UART_RX_GPIO_Port GPIOE
#define PWR_HOLD_Pin GPIO_PIN_13
#define PWR_HOLD_GPIO_Port GPIOG
#define ANALOG_ON_Pin GPIO_PIN_12
#define ANALOG_ON_GPIO_Port GPIOG
#define LED0_BLUE_Pin GPIO_PIN_7
#define LED0_BLUE_GPIO_Port GPIOI
#define I2C_IO_SDA_Pin GPIO_PIN_7
#define I2C_IO_SDA_GPIO_Port GPIOB
If you're not using STM32CubeMX, you could certainly create your own header file with #defines for you all you port/pins.