国产精品天干天干,亚洲毛片在线,日韩gay小鲜肉啪啪18禁,女同Gay自慰喷水

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

AT32學習筆記-GPIO.md

2022-11-27 09:14 作者:繁花cloud  | 我要投稿

GPIO

初始化

```c

// 創(chuàng)建GPIO INIT參數(shù)結(jié)構(gòu)體

gpio_init_type gpio_init_struct;


// 開啟GPIO外設時鐘

crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);


/* 設置結(jié)構(gòu)體默認的值 */

gpio_default_para_init(&gpio_init_struct);


/* 配置IO口 */

// 驅(qū)動強度,選強

gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;

// GPIO輸出模式 GPIO_OUTPUT_PUSH_PULL 推挽輸出 GPIO_OUTPUT_OPEN_DRAIN 開漏輸出

gpio_init_struct.gpio_out_type? = GPIO_OUTPUT_PUSH_PULL;

// GPIO模式 GPIO_MODE_INPUT 輸入 GPIO_MODE_OUTPUT 輸出 GPIO_MODE_MUX IOMUX,至片上外設

// GPIO_MODE_ANALOG 模擬輸入/輸出

gpio_init_struct.gpio_mode = GPIO_MODE_OUTPUT;

// GPIO引腳 GPIO_PINS_0-15 GPIO_PINS_ALL,支持|操作,例如 GPIO_PINS_0 | GPIO_PINS_1

gpio_init_struct.gpio_pins = GPIO_PINS_1;

// 內(nèi)部上拉,一般用于輸入的時候

gpio_init_struct.gpio_pull = GPIO_PULL_NONE;

// 初始化

gpio_init(GPIOA, &gpio_init_struct);

```

設置高低電平

置1

```c

/**

? * @brief? set the selected data port bits.

? * @param? gpio_x: to select the gpio peripheral.

? *? ? ? ? ?this parameter can be one of the following values:

? *? ? ? ? ?GPIOA, GPIOB, GPIOC, GPIOD, GPIOF.

? * @param? pins: gpio pin number

? *? ? ? ? ?parameter can be any combination of gpio_pin_x, gpio_pin_x as following values:

? *? ? ? ? ?- GPIO_PINS_0

? *? ? ? ? ?- GPIO_PINS_1

? *? ? ? ? ?- GPIO_PINS_2

? *? ? ? ? ?- GPIO_PINS_3

? *? ? ? ? ?- GPIO_PINS_4

? *? ? ? ? ?- GPIO_PINS_5

? *? ? ? ? ?- GPIO_PINS_6

? *? ? ? ? ?- GPIO_PINS_7

? *? ? ? ? ?- GPIO_PINS_8

? *? ? ? ? ?- GPIO_PINS_9

? *? ? ? ? ?- GPIO_PINS_10

? *? ? ? ? ?- GPIO_PINS_11

? *? ? ? ? ?- GPIO_PINS_12

? *? ? ? ? ?- GPIO_PINS_13

? *? ? ? ? ?- GPIO_PINS_14

? *? ? ? ? ?- GPIO_PINS_15

? *? ? ? ? ?- GPIO_PINS_ALL

? * @retval none

? */

void gpio_bits_set(gpio_type *gpio_x, uint16_t pins);

```

置0

```c

/**

? * @brief? clear the selected data port bits.

? * @param? gpio_x: to select the gpio peripheral.

? *? ? ? ? ?this parameter can be one of the following values:

? *? ? ? ? ?GPIOA, GPIOB, GPIOC, GPIOD, GPIOF.

? * @param? pins: gpio pin number

? *? ? ? ? ?parameter can be any combination of gpio_pin_x, gpio_pin_x as following values:

? *? ? ? ? ?- GPIO_PINS_0

? *? ? ? ? ?- GPIO_PINS_1

? *? ? ? ? ?- GPIO_PINS_2

? *? ? ? ? ?- GPIO_PINS_3

? *? ? ? ? ?- GPIO_PINS_4

? *? ? ? ? ?- GPIO_PINS_5

? *? ? ? ? ?- GPIO_PINS_6

? *? ? ? ? ?- GPIO_PINS_7

? *? ? ? ? ?- GPIO_PINS_8

? *? ? ? ? ?- GPIO_PINS_9

? *? ? ? ? ?- GPIO_PINS_10

? *? ? ? ? ?- GPIO_PINS_11

? *? ? ? ? ?- GPIO_PINS_12

? *? ? ? ? ?- GPIO_PINS_13

? *? ? ? ? ?- GPIO_PINS_14

? *? ? ? ? ?- GPIO_PINS_15

? *? ? ? ? ?- GPIO_PINS_ALL

? * @retval none

? */

void gpio_bits_reset(gpio_type *gpio_x, uint16_t pins);

```

設置,傳入0 1

```c

/**

? * @brief? set or clear the selected data port bit.

? * @param? gpio_x: to select the gpio peripheral.

? *? ? ? ? ?this parameter can be one of the following values:

? *? ? ? ? ?GPIOA, GPIOB, GPIOC, GPIOD, GPIOF.

? * @param? pins: gpio pin number

? *? ? ? ? ?parameter can be any combination of gpio_pin_x, gpio_pin_x as following values:

? *? ? ? ? ?- GPIO_PINS_0

? *? ? ? ? ?- GPIO_PINS_1

? *? ? ? ? ?- GPIO_PINS_2

? *? ? ? ? ?- GPIO_PINS_3

? *? ? ? ? ?- GPIO_PINS_4

? *? ? ? ? ?- GPIO_PINS_5

? *? ? ? ? ?- GPIO_PINS_6

? *? ? ? ? ?- GPIO_PINS_7

? *? ? ? ? ?- GPIO_PINS_8

? *? ? ? ? ?- GPIO_PINS_9

? *? ? ? ? ?- GPIO_PINS_10

? *? ? ? ? ?- GPIO_PINS_11

? *? ? ? ? ?- GPIO_PINS_12

? *? ? ? ? ?- GPIO_PINS_13

? *? ? ? ? ?- GPIO_PINS_14

? *? ? ? ? ?- GPIO_PINS_15

? *? ? ? ? ?- GPIO_PINS_ALL

? * @param? bit_state: specifies the value to be written to the selected bit (TRUE or FALSE).

? * @retval none

? */

void gpio_bits_write(gpio_type *gpio_x, uint16_t pins, confirm_state bit_state);

```

位段操作

同時對某一個GPIO做操作,port_value按照位傳入

```c

/**

? * @brief? write data to the specified gpio data port.

? * @param? gpio_x: to select the gpio peripheral.

? *? ? ? ? ?this parameter can be one of the following values:

? *? ? ? ? ?GPIOA, GPIOB, GPIOC, GPIOD, GPIOF.

? * @param? port_value: specifies the value to be written to the port output data register.

? * @retval none

? */

void gpio_port_write(gpio_type *gpio_x, uint16_t port_value);

```

## 重置GPIO寄存器

初始化的時候,如果有需求可以重置??

```c

/**

? * @brief? reset the gpio register

? * @param? gpio_x: to select the gpio peripheral.

? *? ? ? ? ?this parameter can be one of the following values:

? *? ? ? ? ?GPIOA, GPIOB, GPIOC, GPIOD, GPIOF.

? * @retval none

? */

void gpio_reset(gpio_type *gpio_x);

```


點燈

```c

gpio_init_type gpio_init_struct;


/* enable the led clock */

crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);


/* set default parameter */

gpio_default_para_init(&gpio_init_struct);


/* configure the led gpio */

gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;

gpio_init_struct.gpio_out_type? = GPIO_OUTPUT_PUSH_PULL;

gpio_init_struct.gpio_mode = GPIO_MODE_OUTPUT;

gpio_init_struct.gpio_pins = GPIO_PINS_1;

gpio_init_struct.gpio_pull = GPIO_PULL_NONE;

gpio_init(GPIOA, &gpio_init_struct);


i = !i;

if(i){

? ? gpio_bits_set(GPIOA, GPIO_PINS_1);

}else{

? ? gpio_bits_reset(GPIOA, GPIO_PINS_1);

}

```


AT32學習筆記-GPIO.md的評論 (共 條)

分享到微博請遵守國家法律
瑞安市| 博罗县| 横山县| 洪江市| 班玛县| 高安市| 武城县| 台中县| 保德县| 邵阳市| 宁德市| 淳安县| 抚宁县| 读书| 营山县| 永顺县| 颍上县| 盘山县| 紫云| 伊通| 治多县| 西城区| 翁源县| 阿巴嘎旗| 鄂托克前旗| 建阳市| 石景山区| 桑植县| 连山| 酒泉市| 桐梓县| 桦川县| 余庆县| 辽宁省| 张家界市| 天门市| 探索| 珲春市| 临高县| 拜城县| 鹿泉市|