/*! \brief set GPIO mode \param[in] gpio_periph: GPIOx(x = A,B,C,D,F) only one parameter can be selected which is shown as below: \arg GPIOx(x = A,B,C,D,F) \param[in] mode: gpio pin mode only one parameter can be selected which is shown as below: \arg GPIO_MODE_INPUT: input mode \arg GPIO_MODE_OUTPUT: output mode \arg GPIO_MODE_AF: alternate function mode \arg GPIO_MODE_ANALOG: analog mode \param[in] pull_up_down: gpio pin with pull-up or pull-down resistor only one parameter can be selected which is shown as below: \arg GPIO_PUPD_NONE: floating mode, no pull-up and pull-down resistors \arg GPIO_PUPD_PULLUP: with pull-up resistor \arg GPIO_PUPD_PULLDOWN:with pull-down resistor \param[in] pin: GPIO pin one or more parameters can be selected which are shown as below: \arg GPIO_PIN_x(x=0..15), GPIO_PIN_ALL \param[out] none \retval none */ voidgpio_mode_set(uint32_t gpio_periph, uint32_t mode, uint32_t pull_up_down, uint32_t pin) { uint16_t i; uint32_t ctl, pupd;
/*! \brief this function handles NMI exception \param[in] none \param[out] none \retval none */ voidNMI_Handler(void) { }
/*! \brief this function handles HardFault exception \param[in] none \param[out] none \retval none */ voidHardFault_Handler(void) { /* if Hard Fault exception occurs, go to infinite loop */ while(1){ } }
/*! \brief this function handles MemManage exception \param[in] none \param[out] none \retval none */ voidMemManage_Handler(void) { /* if Memory Manage exception occurs, go to infinite loop */ while(1){ } }
/*! \brief this function handles BusFault exception \param[in] none \param[out] none \retval none */ voidBusFault_Handler(void) { /* if Bus Fault exception occurs, go to infinite loop */ while(1){ } }
/*! \brief this function handles UsageFault exception \param[in] none \param[out] none \retval none */ voidUsageFault_Handler(void) { /* if Usage Fault exception occurs, go to infinite loop */ while(1){ } }
/*! \brief this function handles SVC exception \param[in] none \param[out] none \retval none */ voidSVC_Handler(void) { }
/*! \brief this function handles DebugMon exception \param[in] none \param[out] none \retval none */ voidDebugMon_Handler(void) { }
/*! \brief this function handles PendSV exception \param[in] none \param[out] none \retval none */ voidPendSV_Handler(void) { }
/*! \brief this function handles SysTick exception \param[in] none \param[out] none \retval none */ voidSysTick_Handler(void) { led_spark(); /* 处理 LED 程序 */ delay_decrement(); }
/*! \file gd32f1x0r_eval.h \brief definitions for GD32f1x0_EVAL's leds, keys and COM ports hardware resources \version 2014-12-26, V1.0.0, platform GD32F1x0(x=3,5) \version 2016-01-15, V2.0.0, platform GD32F1x0(x=3,5,7,9) \version 2016-04-30, V3.0.0, firmware update for GD32F1x0(x=3,5,7,9) \version 2017-06-19, V3.1.0, firmware update for GD32F1x0(x=3,5,7,9) \version 2019-11-20, V3.2.0, firmware update for GD32F1x0(x=3,5,7,9) \version 2020-09-21, V3.3.0, firmware update for GD32F1x0(x=3,5,7,9) */
/* Copyright (c) 2020, GigaDevice Semiconductor Inc. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
/* GD32170_190 eval low layer COM */ #define COMn 2
/* definition for COM 1, connected to USART0 */ #define EVAL_COM1 USART0 #define EVAL_COM1_CLK RCU_USART0 /* definition for COM 2, connected to USART1 */ #define EVAL_COM2 USART1 #define EVAL_COM2_CLK RCU_USART1
#else #error"Please define GD32F130_150 or GD32F170_190" #endif
/* function declarations */ /* configures led GPIO */ voidgd_eval_led_init(led_typedef_enum lednum); /* turn on selected led */ voidgd_eval_led_on(led_typedef_enum lednum); /* turn off selected led */ voidgd_eval_led_off(led_typedef_enum lednum); /* toggle the selected led */ voidgd_eval_led_toggle(led_typedef_enum lednum); /* configure key */ voidgd_eval_key_init(key_typedef_enum keynum, keymode_typedef_enum key_mode); /* return the selected button state */ uint8_tgd_eval_key_state_get(key_typedef_enum keynum); /* configure COM port */ voidgd_eval_com_init(uint32_t COM);