GPIOPinTypePWM
一、概述
Configures pin(s) for use by the PWM peripheral.
配置引脚以用作PWM外设
Prototype:
void
GPIOPinTypePWM(uint32_t ui32Port,
uint8_t ui8Pins)
Parameters:
ui32Port is the base address of the GPIO port.
ui8Pins is the bit-packed representation of the pin(s).
Description:
The PWM pins must be properly configured for the PWM peripheral to function correctly. This function provides a typical configuration for those pin(s); other configurations may work as well depending upon the board setup (for example, using the on-chip pull-ups).
为了使PWM外设正常工作,一定要正确配置PWM引脚,这个函数为这些引脚提供了典型的配置,其他的配置也可能正确配置。
The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on.
Note:
This function cannot be used to turn any pin into a PWM pin; it only configures a PWM pin
for proper operation. Note that a GPIOPinConfigure() function call is also required to properly
configure a pin for the PWM function.
要配置一个引脚发挥PWM功能,还需调用GPIOPinConfigure()函数
A subset of GPIO pins on Tiva devices, notably those used by the JTAG/SWD interface and
any pin capable of acting as an NMI input, are locked against inadvertent reconfiguration.
These pins must be unlocked using direct register writes to the relevant GPIO_O_LOCK and
GPIO_O_CR registers before this function can be called. Please see the “gpio_jtag” example
application for the mechanism required and consult your part datasheet for information on
affected pins.
Returns:
None.
二、例程
1 | //配置PWM预分频,这里不分频 |