Skip to main content
mostafa fathi
Visitor II
May 4, 2017
Question

library problem

  • May 4, 2017
  • 2 replies
  • 630 views
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;

    This topic has been closed for replies.

    2 replies

    Tesla DeLorean
    Guru
    May 4, 2017
    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 (See Profile) Up vote any posts that you find helpful, it shows what's working..
    ST Technical Moderator
    May 4, 2017
    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 

    In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Thanks