Initial commit

This commit is contained in:
EmanuelFeru
2020-02-07 14:57:44 +01:00
commit 836e321549
551 changed files with 113644 additions and 0 deletions

View File

@@ -0,0 +1,115 @@
/*!
\file gd32f1x0_it.c
\brief interrupt service routines
*/
/*
Copyright (C) 2017 GigaDevice
2014-12-26, V1.0.0, platform GD32F1x0(x=3,5)
2016-01-15, V2.0.0, platform GD32F1x0(x=3,5,7,9)
2016-04-30, V3.0.0, firmware update for GD32F1x0(x=3,5,7,9)
2017-06-19, V3.1.0, firmware update for GD32F1x0(x=3,5,7,9)
*/
#include "gd32f1x0_it.h"
#include "systick.h"
/*!
\brief this function handles NMI exception
\param[in] none
\param[out] none
\retval none
*/
void NMI_Handler(void)
{
}
/*!
\brief this function handles HardFault exception
\param[in] none
\param[out] none
\retval none
*/
void HardFault_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
*/
void MemManage_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
*/
void BusFault_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
*/
void UsageFault_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
*/
void SVC_Handler(void)
{
}
/*!
\brief this function handles DebugMon exception
\param[in] none
\param[out] none
\retval none
*/
void DebugMon_Handler(void)
{
}
/*!
\brief this function handles PendSV exception
\param[in] none
\param[out] none
\retval none
*/
void PendSV_Handler(void)
{
}
/*!
\brief this function handles SysTick exception
\param[in] none
\param[out] none
\retval none
*/
void SysTick_Handler(void)
{
delay_decrement();
}

View File

@@ -0,0 +1,40 @@
/*!
\file gd32f1x0_it.h
\brief the header file of the ISR
*/
/*
Copyright (C) 2017 GigaDevice
2014-12-26, V1.0.0, platform GD32F1x0(x=3,5)
2016-01-15, V2.0.0, platform GD32F1x0(x=3,5,7,9)
2016-04-30, V3.0.0, firmware update for GD32F1x0(x=3,5,7,9)
2017-06-19, V3.1.0, firmware update for GD32F1x0(x=3,5,7,9)
*/
#ifndef GD32F1X0_IT_H
#define GD32F1X0_IT_H
#include "gd32f1x0.h"
/* function declarations */
/* NMI handle function */
void NMI_Handler(void);
/* HardFault handle function */
void HardFault_Handler(void);
/* MemManage handle function */
void MemManage_Handler(void);
/* BusFault handle function */
void BusFault_Handler(void);
/* UsageFault handle function */
void UsageFault_Handler(void);
/* SVC handle function */
void SVC_Handler(void);
/* DebugMon handle function */
void DebugMon_Handler(void);
/* PendSV handle function */
void PendSV_Handler(void);
/* SysTick handle function */
void SysTick_Handler(void);
#endif /* GD32F1X0_IT_H */

View File

@@ -0,0 +1,47 @@
/*!
\file gd32f1x0_libopt.h
\brief library optional for gd32f1x0
*/
/*
Copyright (C) 2017 GigaDevice
2014-12-26, V1.0.0, platform GD32F1x0(x=3,5)
2016-01-15, V2.0.0, platform GD32F1x0(x=3,5,7,9)
2016-04-30, V3.0.0, firmware update for GD32F1x0(x=3,5,7,9)
2017-06-19, V3.1.0, firmware update for GD32F1x0(x=3,5,7,9)
*/
#ifndef GD32F1X0_LIBOPT_H
#define GD32F1X0_LIBOPT_H
#include "gd32f1x0_adc.h"
#include "gd32f1x0_cec.h"
#include "gd32f1x0_crc.h"
#include "gd32f1x0_cmp.h"
#include "gd32f1x0_dac.h"
#include "gd32f1x0_dbg.h"
#include "gd32f1x0_dma.h"
#include "gd32f1x0_exti.h"
#include "gd32f1x0_fmc.h"
#include "gd32f1x0_gpio.h"
#include "gd32f1x0_syscfg.h"
#include "gd32f1x0_i2c.h"
#include "gd32f1x0_fwdgt.h"
#include "gd32f1x0_pmu.h"
#include "gd32f1x0_rcu.h"
#include "gd32f1x0_rtc.h"
#include "gd32f1x0_spi.h"
#include "gd32f1x0_timer.h"
#include "gd32f1x0_usart.h"
#include "gd32f1x0_wwdgt.h"
#include "gd32f1x0_misc.h"
#include "gd32f1x0_tsi.h"
#ifdef GD32F170_190
#include "gd32f1x0_slcd.h"
#include "gd32f1x0_opa.h"
#include "gd32f1x0_ivref.h"
#include "gd32f1x0_can.h"
#endif /* GD32F170_190 */
#endif /* GD32F1X0_LIBOPT_H */

View File

@@ -0,0 +1,53 @@
/*!
\file main.c
\brief running led
*/
/*
Copyright (C) 2017 GigaDevice
2014-12-26, V1.0.0, platform for GD32F1x0(x=3,5)
2016-01-15, V2.0.0, platform for GD32F1x0(x=3,5,7,9)
2016-04-30, V3.0.0, firmware update for GD32F1x0(x=3,5,7,9)
2017-06-19, V3.1.0, firmware update for GD32F1x0(x=3,5,7,9)
*/
#include "gd32f1x0.h"
#include "gd32f1x0_libopt.h"
#include "gd32f1x0_eval.h"
#include "systick.h"
#include <stdio.h>
/*!
\brief main function
\param[in] none
\param[out] none
\retval none
*/
int main(void)
{
systick_config();
gd_eval_led_init(LED1);
gd_eval_led_init(LED2);
gd_eval_led_init(LED3);
gd_eval_led_init(LED4);
while(1){
/* turn on led1, turn off led4 */
gd_eval_led_on(LED1);
gd_eval_led_off(LED4);
delay_1ms(1000);
/* turn on led2, turn off led1 */
gd_eval_led_on(LED2);
gd_eval_led_off(LED1);
delay_1ms(1000);
/* turn on led3, turn off led2 */
gd_eval_led_on(LED3);
gd_eval_led_off(LED2);
delay_1ms(1000);
/* turn on led4, turn off led3 */
gd_eval_led_on(LED4);
gd_eval_led_off(LED3);
delay_1ms(1000);
}
}

View File

@@ -0,0 +1,23 @@
/*!
\file readme.txt
\brief description of the Running_led example
*/
/*
Copyright (C) 2017 GigaDevice
2014-12-26, V1.0.0, platform for GD32F1x0(x=3,5)
2016-01-15, V2.0.0, platform for GD32F1x0(x=3,5,7,9)
2016-04-30, V3.0.0, firmware update for GD32F1x0(x=3,5,7,9)
2017-06-19, V3.1.0, firmware update for GD32F1x0(x=3,5,7,9)
*/
This example is based on the GD32150R-EVAL/ GD32190R-EVAL board, it provides
a description of Running_led. After system start-up, firstly, LED1 on, then,
LED2 on, four LEDs can light periodically.
On the GD32150R-EVAL board,LED1 connected to PC10. LED2 connected to PC11.
LED3 connected to PC12. LED4 connected to PD2.
On the GD32190R-EVAL board,LED1 connected to PA11. LED2 connected to PA12.
LED3 connected to PB6. LED4 connected to PB7.

View File

@@ -0,0 +1,61 @@
/*!
\file systick.c
\brief the systick configuration file
*/
/*
Copyright (C) 2017 GigaDevice
2014-12-26, V1.0.0, platform GD32F1x0(x=3,5)
2016-01-15, V2.0.0, platform GD32F1x0(x=3,5,7,9)
2016-04-30, V3.0.0, firmware update for GD32F1x0(x=3,5,7,9)
2017-06-19, V3.1.0, firmware update for GD32F1x0(x=3,5,7,9)
*/
#include "gd32f1x0.h"
#include "systick.h"
static uint32_t delay;
/*!
\brief configure systick
\param[in] none
\param[out] none
\retval none
*/
void systick_config(void)
{
/* setup systick timer for 1000Hz interrupts */
if (SysTick_Config(SystemCoreClock / 1000)){
/* capture error */
while (1);
}
/* configure the systick handler priority */
NVIC_SetPriority(SysTick_IRQn, 0x00);
}
/*!
\brief delay a time in milliseconds
\param[in] count: count in milliseconds
\param[out] none
\retval none
*/
void delay_1ms(uint32_t count)
{
delay = count;
while(0 != delay);
}
/*!
\brief delay decrement
\param[in] none
\param[out] none
\retval none
*/
void delay_decrement(void)
{
if (0 != delay){
delay--;
}
}

View File

@@ -0,0 +1,27 @@
/*!
\file systick.h
\brief the header file of systick
*/
/*
Copyright (C) 2017 GigaDevice
2014-12-26, V1.0.0, platform GD32F1x0(x=3,5)
2016-01-15, V2.0.0, platform GD32F1x0(x=3,5,7,9)
2016-04-30, V3.0.0, firmware update for GD32F1x0(x=3,5,7,9)
2017-06-19, V3.1.0, firmware update for GD32F1x0(x=3,5,7,9)
*/
#ifndef SYS_TICK_H
#define SYS_TICK_H
#include <stdint.h>
/* configure systick */
void systick_config(void);
/* delay a time in milliseconds */
void delay_1ms(uint32_t count);
/* delay decrement */
void delay_decrement(void);
#endif /* SYS_TICK_H */