[TrueStudio] What type is "XX_GPIO_Port" ?
To minimalize migration from a current working atmel design to a new stm32 design, i desire to create a abstraction function in atollic true studio. Currently, it seems that when generating the project via cube, the MX_GPIO_Init function uses each code block for each output, which is not very efficient to me. The next problem is, that the function needs at least two arguments for a pin, which are pin_name and pin_port.
Here is an example of the current function
/*Configure GPIO pin : LD2_Pin */
GPIO_InitStruct.Pin = LD2_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(LD2_GPIO_Port, &GPIO_InitStruct);So what i'm planing to do is call a init by only a pin name
#define SENSOR 1
#define LED 2
const gpioPinDesctipion hwPinDescription[]={
***Pin no - pin port - pin mode - pin pullup - pin speed***
{GPIO_PIN_5, GPIOA,GPIO_MODE_OUTPUT_PP,GPIO_NOPULL,GPIO_SPEED_FREQ_LOW}
{GPIO_PIN_6, GPIOA,GPIO_MODE_IT_FALLING,GPIO_NOPULL,GPIO_SPEED_FREQ_LOW}
}followed by the functon:
void pinInide(ID){
GPIO_InitTypeDef GPIO_InitStruct;
GPIO_InitStruct.Pin = hwPinDescription[ID].pin;
GPIO_InitStruct.Mode =hwPinDescription[ID].io;
GPIO_InitStruct.Pull = hwPinDescription[ID].pull;
HAL_GPIO_Init( hwPinDescription[ID].port, &GPIO_InitStruct);
}But currently i'm struggling to find out what the data type is of "GPIO_PORT" when opening declaration in atollic i get
#define GPIOA ((GPIO_TypeDef *) GPIOA_BASE)How can i assign this to a variable to use in a struct array?
I hope i have desicribed precise enough what i want to do, any help welcome! :)