first commit

This commit is contained in:
YXZhu
2022-08-06 13:35:32 +08:00
commit 2240710d39
1025 changed files with 472118 additions and 0 deletions
@@ -0,0 +1,22 @@
#ifndef __BOARD_H
#define __BOARD_H
#ifdef __cplusplus
extern "C"
{
#endif
#include "gd32f10x.h"
void board_usart0_init(void);
void board_led_init(void);
void board_led_on(void);
void board_led_off(void);
void board_led_toggle(void);
void board_button_init(void);
uint8_t board_button_state_get(void);
#ifdef __cplusplus
}
#endif
#endif
@@ -0,0 +1,63 @@
/*!
\file gd32f10x_it.h
\brief the header file of the ISR
\version 2014-12-26, V1.0.0, firmware for GD32F10x
\version 2017-06-20, V2.0.0, firmware for GD32F10x
\version 2018-07-31, V2.1.0, firmware for GD32F10x
\version 2020-09-30, V2.2.0, firmware for GD32F10x
*/
/*
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.
*/
#ifndef GD32F10X_IT_H
#define GD32F10X_IT_H
#include "gd32f10x.h"
/* function declarations */
/* this function handles NMI exception */
void NMI_Handler(void);
/* this function handles HardFault exception */
void HardFault_Handler(void);
/* this function handles MemManage exception */
void MemManage_Handler(void);
/* this function handles BusFault exception */
void BusFault_Handler(void);
/* this function handles UsageFault exception */
void UsageFault_Handler(void);
/* this function handles SVC exception */
void SVC_Handler(void);
/* this function handles DebugMon exception */
void DebugMon_Handler(void);
/* this function handles PendSV exception */
void PendSV_Handler(void);
/* this function handles SysTick exception */
void SysTick_Handler(void);
#endif /* GD32F10X_IT_H */
@@ -0,0 +1,65 @@
/*!
\file gd32f10x_libopt.h
\brief library optional for gd32f10x
\version 2014-12-26, V1.0.0, firmware for GD32F10x
\version 2017-06-20, V2.0.0, firmware for GD32F10x
\version 2018-07-31, V2.1.0, firmware for GD32F10x
\version 2020-09-30, V2.2.0, firmware for GD32F10x
*/
/*
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.
*/
#ifndef GD32F10X_LIBOPT_H
#define GD32F10X_LIBOPT_H
#include "gd32f10x_fmc.h"
#include "gd32f10x_pmu.h"
#include "gd32f10x_bkp.h"
#include "gd32f10x_rcu.h"
#include "gd32f10x_exti.h"
#include "gd32f10x_gpio.h"
#include "gd32f10x_crc.h"
#include "gd32f10x_dma.h"
#include "gd32f10x_dbg.h"
#include "gd32f10x_adc.h"
#include "gd32f10x_dac.h"
#include "gd32f10x_fwdgt.h"
#include "gd32f10x_wwdgt.h"
#include "gd32f10x_rtc.h"
#include "gd32f10x_timer.h"
#include "gd32f10x_usart.h"
#include "gd32f10x_i2c.h"
#include "gd32f10x_spi.h"
#include "gd32f10x_sdio.h"
#include "gd32f10x_exmc.h"
#include "gd32f10x_can.h"
#include "gd32f10x_enet.h"
#include "gd32f10x_misc.h"
#endif /* GD32F10X_LIBOPT_H */
@@ -0,0 +1,13 @@
#ifndef __MAIN_H
#define __MAIN_H
#ifdef __cplusplus
extern "C"
{
#endif
#ifdef __cplusplus
}
#endif
#endif /* MAIN_H */
@@ -0,0 +1,38 @@
#ifndef __SYS_TICK_H
#define __SYS_TICK_H
#ifdef __cplusplus
extern "C"
{
#endif
#include <stdint.h>
#define SysTick_Freq (1000U) // Hz
#define SysTick_Tick (1000U / SysTick_Freq)
/* configure systick */
void systick_config(void);
/* delay a time in milliseconds */
void delay(uint32_t count);
/* delay a time in milliseconds with low power */
void delay_lp(uint32_t count);
/* delay decrement */
void delay_decrement(void);
/* get system tick */
uint32_t systick_get_tick(void);
/* suspend system tick */
void systick_DisableIRQ(void);
/* resume system tick */
void systick_EnableIRQ(void);
void systick_Disable(void);
void systick_Enable(void);
void systick_deinit(void);
#ifdef __cplusplus
}
#endif
#endif /* SYS_TICK_H */