cancel
Showing results for 
Search instead for 
Did you mean: 

library problem

mostafa fathi
Associate
Posted on May 04, 2017 at 09:30

Hi.

I can't find  GPIO_PinAFConfig(). when i write it function, i don't find GPIO_AF parameter.

void GPIO_PinAFConfig(GPIO_TypeDef* GPIOx, uint16_t GPIO_PinSource, uint8_t GPIO_AF)

{

uint32_t temp = 0x00;

uint32_t temp_2 = 0x00;

/* Check the parameters */

assert_param(IS_GPIO_ALL_PERIPH(GPIOx));

assert_param(IS_GPIO_PIN_SOURCE(GPIO_PinSource));

assert_param(IS_GPIO_AF(GPIO_AF));

temp = ((uint32_t)(GPIO_AF) << ((uint32_t)((uint32_t)GPIO_PinSource & (uint32_t)0x07) * 4));

GPIOx->AFR[GPIO_PinSource >> 0x03] &= ~((uint32_t)0xF << ((uint32_t)((uint32_t)GPIO_PinSource & (uint32_t)0x07) * 4));

temp_2 = GPIOx->AFR[GPIO_PinSource >> 0x03] | temp;

GPIOx->AFR[GPIO_PinSource >> 0x03] = temp_2;

2 REPLIES 2
Posted on May 04, 2017 at 14:24

I'm not sure what you are actually asking. You don't mention a specific part, pin or peripheral you are looking to configure.

The Data Sheet provides pin tables indicating the selections/options for each.

It takes the form

GPIO_PinAFConfig(GPIOB, GPIO_PinSource4, GPIO_AF_6);
GPIO_PinAFConfig(GPIOA, GPIO_PinSource2, GPIO_AF_USART2);

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Imen.D
ST Employee
Posted on May 04, 2017 at 14:41

Hi,

It seems you are missing pin configuration !! you should have the syntax form as mentioned by Clive 

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen