Pin Control (Pinctrl)
To configure the pin multiplexing functions, follow the steps below:
Turn off the SWD if the pin default function is SWD, and configure it to other functions.
Pinmux_Swdoff();
Configure pin multiplexing function.
Pinmux_Config(u8 PinName, u32 PinFunc);
Set pin pull type.
PAD_PullCtrl(u8 PinName, u8 PullType); //normal mode PAD_SleepPullCtrl(u8 PinName, u8 PullType); //sleep and deep-sleep mode
Set pin driving strength if needed.
PAD_DrvStrength(u8 PinName, u32 DrvStrength);
To configure the pin multiplexing function, follow the steps below:
Turn off the SWD pins if default function is SWD.
Pinmux_Swdoff();
Configure pin multiplexing function.
Pinmux_Config(u8 PinName, u32 PinFunc);
Set pin pull type.
PAD_PullCtrl(u8 PinName, u8 PullType); //normal mode PAD_SleepPullCtrl(u8 PinName, u8 PullType); //sleep and deep-sleep mode
Set pin driving strength if needed.
PAD_DrvStrength(u8 PinName, u32 DrvStrength);
Turn off the SWD pins or enable audio share pad pins if default function is SWD or audio.
For SWD pad:
Pinmux_Swdoff();
For audio share pad (PB11~PB19):
Enable audio codec analog IP active function
RCC_PeriphClockCmd(APBPeriph_AC_AIP, NULL, ENABLE);
Operation for specific pin
switch (PinName) { case _PB_11: case _PB_12: AUDIO_CODEC_SetMicBstChnMute(AMIC1, MICIN, MUTE); break; case _PB_13: case _PB_14: AUDIO_CODEC_SetMicBstChnMute(AMIC2, MICIN, MUTE); break; case _PB_18: case _PB_19: AUDIO_CODEC_SetMicBstChnMute(AMIC3, MICIN, MUTE); break;
Enable digital path input for audio share pad
APAD_InputCtrl(PinName, ENABLE);
Configure pin multiplexing function.
Pinmux_Config(u8 PinName, u32 PinFunc);
Set pin pull type.
PAD_PullCtrl(u8 PinName, u8 PullType); //normal mode PAD_SleepPullCtrl(u8 PinName, u8 PullType); //sleep and deepsleep mode
Set pin driving strength if needed.
PAD_DrvStrength(u8 PinName, u32 DrvStrength);
To configure the pin multiplexing function, follow the steps below:
Turn off SWD or enable audio pad share if the pin default function is SWD or audio.
Pinmux_Swdoff(); HAL_WRITE32(PINMUX_REG_BASE, REG_PAD_AUD_PAD_CTRL, 0x1FFFFF);
Configure pin multiplexing function.
Pinmux_Config(u8 PinName, u32 PinFunc);
Set pin pull type.
PAD_PullCtrl(u8 PinName, u8 PullType); //normal mode PAD_SleepPullCtrl(u8 PinName, u8 PullType); //sleep and deep-sleep mode
Set pin driving strength if needed.
PAD_DrvStrength(u8 PinName, u32 DrvStrength);