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,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,78 @@
/*!
\file main.c
\brief IREF provides reference current
*/
/*
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 "gd32f1x0_libopt.h"
#include <stdio.h>
void rcu_config(void);
void gpio_config(void);
void iref_config(void);
/*!
\brief main function
\param[in] none
\param[out] none
\retval none
*/
int main(void)
{
rcu_config();
gpio_config();
iref_config();
while(1);
}
/*!
\brief configure RCU function
\param[in] none
\param[out] none
\retval none
*/
void rcu_config(void)
{
/* GPIOB clock enable */
rcu_periph_clock_enable(RCU_GPIOB);
/* IVREF clock enable */
rcu_periph_clock_enable(RCU_OPAIVREF);
}
/*!
\brief configure IREF function
\param[in] none
\param[out] none
\retval none
*/
void iref_config(void)
{
ivref_deinit();
iref_mode_set(IREF_MODE_HIGH_CURRENT);
iref_enable();
/* set iref sink mode */
iref_sink_set(IREF_SOURCE_CURRENT);
iref_precision_trim_value_set(IREF_CUR_PRECISION_TRIM_16);
iref_step_data_config(IREF_CUR_STEP_DATA_23);
}
/*!
\brief configure GPIO function
\param[in] none
\param[out] none
\retval none
*/
void gpio_config(void)
{
gpio_mode_set(GPIOB,GPIO_MODE_ANALOG,GPIO_PUPD_NONE,GPIO_PIN_0);
}

View File

@@ -0,0 +1,16 @@
/*!
\file readme.txt
\brief description of the IREF_provides_reference_current example
*/
/*
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)
*/
This demo is based on the GD32190R-EVAL board, it shows how to use IREF to
generate current on PB0. We can use multimeter on PB0 to get the current value.

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,74 @@
/*!
\file main.c
\brief VREF provides reference voltage
*/
/*
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 "gd32f1x0_libopt.h"
#include <stdio.h>
void rcu_config(void);
void gpio_config(void);
void vref_config(void);
/*!
\brief main function
\param[in] none
\param[out] none
\retval none
*/
int main(void)
{
rcu_config();
gpio_config();
vref_config();
while(1);
}
/*!
\brief configure RCU function
\param[in] none
\param[out] none
\retval none
*/
void rcu_config(void)
{
/* GPIOB clock enable */
rcu_periph_clock_enable(RCU_GPIOB);
/* IVREF clock enable */
rcu_periph_clock_enable(RCU_OPAIVREF);
}
/*!
\brief configure VREF function
\param[in] none
\param[out] none
\retval none
*/
void vref_config(void)
{
ivref_deinit();
vref_mode_set(VREF_DISCONNECT_EXTERNAL_CAP);
vref_precision_trim_value_set(VREF_VOLT_PRECISION_TRIM_15);
vref_enable();
}
/*!
\brief configure GPIO function
\param[in] none
\param[out] none
\retval none
*/
void gpio_config(void)
{
gpio_mode_set(GPIOB,GPIO_MODE_ANALOG,GPIO_PUPD_NONE,GPIO_PIN_1);
}

View File

@@ -0,0 +1,18 @@
/*!
\file readme.txt
\brief description of the VREF_provides_reference_voltage example
*/
/*
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)
*/
This demo is based on the GD32190R-EVAL board, it shows how to use VREF to
generate a voltage on PB1. We can use multimeter or oscilloscope on PB1 to get
the voltage value.