@Huzo wrote:
I am new to STM world.
Do you have any experience with any other microcontrollers?
Do you have any experience with programming in general? With C programming?
@Huzo wrote:
I am trying to make an array of GPIO pin in this format {{PIN1_GPIO_PORT, PIN1_PIN}.....
I would have a struct for the {port,pin} pair, and then make an array of those structs ...
As you want to use it with HAL_GPIO_WritePin, make the types compatible with what that function requires:
void HAL_GPIO_WritePin(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin, GPIO_PinState PinState)
So you'd have something like
typedef struct
{
GPIO_TypeDef* GPIOx;
uint16_t GPIO_Pin;
} port_and_pin_t;
port_and_pin_t ports_and_pins[length];
:
:
HAL_GPIO_WritePin( ports_and_pins[x].GPIOx, ports_and_pins[x].GPIO_Pin, value );
You might want to make a "wrapper" function which just takes the struct, breaks-out the 2 elements, and passes them to HAL_GPIO_WritePin ...