MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / pin_set_purpose

Function pin_set_purpose

bsp/loongson/ls1cdev/libraries/ls1c_pin.c:25–41  ·  view source on GitHub ↗

* 把指定pin设置为指定用途(普通gpio,非gpio) * @gpio gpio引脚编号 * @purpose 用途 */

Source from the content-addressed store, hash-verified

23 * @purpose 用途
24 */
25void pin_set_purpose(unsigned int gpio, pin_purpose_t purpose)
26{
27 volatile unsigned int *gpio_cfgx; // GPIO_CFGx寄存器
28 unsigned int pin = GPIO_GET_PIN(gpio);
29
30 gpio_cfgx = gpio_get_cfg_reg(gpio);
31 if (PIN_PURPOSE_GPIO == purpose) // 引脚用作普通gpio
32 {
33 reg_set_one_bit(gpio_cfgx, pin);
34 }
35 else // 引脚用作其它功能(非gpio)
36 {
37 reg_clr_one_bit(gpio_cfgx, pin);
38 }
39
40 return ;
41}
42
43
44

Callers 9

gpio_initFunction · 0.70
pwm_initFunction · 0.70
bxcan0_hw_initFunction · 0.50
bxcan1_hw_initFunction · 0.50
rtgui_lcd_initFunction · 0.50
ls1c_hw_i2c_initFunction · 0.50
rt_hw_uart_initFunction · 0.50
ls1c_hw_spi_initFunction · 0.50
rt_hw_eth_initFunction · 0.50

Calls 3

gpio_get_cfg_regFunction · 0.70
reg_set_one_bitFunction · 0.70
reg_clr_one_bitFunction · 0.70

Tested by

no test coverage detected