120 lines
4.6 KiB
C
120 lines
4.6 KiB
C
/* add user code begin Header */
|
|
/**
|
|
**************************************************************************
|
|
* @file wk_gpio.c
|
|
* @brief work bench config program
|
|
**************************************************************************
|
|
* Copyright notice & Disclaimer
|
|
*
|
|
* The software Board Support Package (BSP) that is made available to
|
|
* download from Artery official website is the copyrighted work of Artery.
|
|
* Artery authorizes customers to use, copy, and distribute the BSP
|
|
* software and its related documentation for the purpose of design and
|
|
* development in conjunction with Artery microcontrollers. Use of the
|
|
* software is governed by this copyright notice and the following disclaimer.
|
|
*
|
|
* THIS SOFTWARE IS PROVIDED ON "AS IS" BASIS WITHOUT WARRANTIES,
|
|
* GUARANTEES OR REPRESENTATIONS OF ANY KIND. ARTERY EXPRESSLY DISCLAIMS,
|
|
* TO THE FULLEST EXTENT PERMITTED BY LAW, ALL EXPRESS, IMPLIED OR
|
|
* STATUTORY OR OTHER WARRANTIES, GUARANTEES OR REPRESENTATIONS,
|
|
* INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
|
|
* FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
|
|
*
|
|
**************************************************************************
|
|
*/
|
|
/* add user code end Header */
|
|
|
|
/* Includes ------------------------------------------------------------------*/
|
|
#include "includes.h"
|
|
|
|
/* add user code begin 0 */
|
|
|
|
/* add user code end 0 */
|
|
|
|
/**
|
|
* @brief init gpio_input/gpio_output/gpio_analog/eventout function.
|
|
* @param none
|
|
* @retval none
|
|
*/
|
|
void wk_gpio_config(void)
|
|
{
|
|
/* add user code begin gpio_config 0 */
|
|
|
|
/* add user code end gpio_config 0 */
|
|
|
|
gpio_init_type gpio_init_struct;
|
|
gpio_default_para_init(&gpio_init_struct);
|
|
|
|
/* add user code begin gpio_config 1 */
|
|
|
|
/* add user code end gpio_config 1 */
|
|
|
|
/* gpio input config */
|
|
gpio_init_struct.gpio_mode = GPIO_MODE_INPUT;
|
|
gpio_init_struct.gpio_pins = GPIO_PINS_9 | GPIO_PINS_15;
|
|
gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
|
|
gpio_init(GPIOA, &gpio_init_struct);
|
|
|
|
gpio_init_struct.gpio_mode = GPIO_MODE_INPUT;
|
|
gpio_init_struct.gpio_pins = GPIO_PINS_12;
|
|
gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
|
|
gpio_init(GPIOC, &gpio_init_struct);
|
|
|
|
gpio_init_struct.gpio_mode = GPIO_MODE_INPUT;
|
|
gpio_init_struct.gpio_pins = GPIO_PINS_2;
|
|
gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
|
|
gpio_init(GPIOD, &gpio_init_struct);
|
|
|
|
/* gpio output config */
|
|
gpio_bits_reset(GPIOC, GPIO_PINS_13 | GPIO_PINS_15 | GPIO_PINS_1 | GPIO_PINS_3 | GPIO_PINS_4 |
|
|
GPIO_PINS_6 | GPIO_PINS_7 | GPIO_PINS_8 | GPIO_PINS_9);
|
|
gpio_bits_reset(GPIOA, GPIO_PINS_4 | GPIO_PINS_8 | GPIO_PINS_10);
|
|
gpio_bits_reset(GPIOB, GPIO_PINS_0 | GPIO_PINS_1 | GPIO_PINS_2 | GPIO_PINS_11 | GPIO_PINS_3 |
|
|
GPIO_PINS_4 | GPIO_PINS_5 | GPIO_PINS_8 | GPIO_PINS_9);
|
|
|
|
gpio_bits_set(GPIOB, GPIO_PINS_8 | GPIO_PINS_2 | GPIO_PINS_1);
|
|
|
|
|
|
gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_MODERATE;
|
|
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_13 | GPIO_PINS_15 | GPIO_PINS_1 | GPIO_PINS_3 | GPIO_PINS_4 |
|
|
GPIO_PINS_6 | GPIO_PINS_7 | GPIO_PINS_8 | GPIO_PINS_9;
|
|
gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
|
|
gpio_init(GPIOC, &gpio_init_struct);
|
|
|
|
gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_MODERATE;
|
|
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_4 | GPIO_PINS_8 | GPIO_PINS_10;
|
|
gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
|
|
gpio_init(GPIOA, &gpio_init_struct);
|
|
|
|
gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_MODERATE;
|
|
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_0 | GPIO_PINS_1 | GPIO_PINS_2 | GPIO_PINS_11 | GPIO_PINS_3 |
|
|
GPIO_PINS_4 | GPIO_PINS_5 | GPIO_PINS_8 | GPIO_PINS_9;
|
|
gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
|
|
gpio_init(GPIOB, &gpio_init_struct);
|
|
|
|
/* gpio analog config */
|
|
gpio_init_struct.gpio_mode = GPIO_MODE_ANALOG;
|
|
gpio_init_struct.gpio_pins = GPIO_PINS_14 | GPIO_PINS_0 | GPIO_PINS_2 | GPIO_PINS_5;
|
|
gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
|
|
gpio_init(GPIOC, &gpio_init_struct);
|
|
|
|
gpio_init_struct.gpio_mode = GPIO_MODE_ANALOG;
|
|
gpio_init_struct.gpio_pins = GPIO_PINS_10;
|
|
gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
|
|
gpio_init(GPIOB, &gpio_init_struct);
|
|
|
|
/* add user code begin gpio_config 2 */
|
|
|
|
/* add user code end gpio_config 2 */
|
|
}
|
|
|
|
/* add user code begin 1 */
|
|
|
|
/* add user code end 1 */
|