mirror of
https://github.com/ArteryTek/AT32F403A_407_Firmware_Library.git
synced 2026-05-21 09:22:19 +00:00
update version to v2.0.6
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f403a_407_clock.h
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief header file of clock program
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f403a_407_conf.h
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief at32f403a_407 config header file
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f403a_407_int.h
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief header file of main interrupt service routines.
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file usb_conf.h
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief usb config header file
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file readme.txt
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief readme
|
||||
**************************************************************************
|
||||
*/
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f403a_407_clock.c
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief system clock config program
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f403a_407_int.c
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief main interrupt service routines.
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file main.c
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief main program
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f403a_407_clock.h
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief header file of clock program
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f403a_407_conf.h
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief at32f403a_407 config header file
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f403a_407_int.h
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief header file of main interrupt service routines.
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file readme.txt
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief readme
|
||||
**************************************************************************
|
||||
*/
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f403a_407_clock.c
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief system clock config program
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f403a_407_int.c
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief main interrupt service routines.
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file main.c
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief main program
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
@@ -26,7 +26,6 @@
|
||||
|
||||
#include "at32f403a_407_board.h"
|
||||
#include "at32f403a_407_clock.h"
|
||||
#include <stdio.h>
|
||||
|
||||
/** @addtogroup AT32F407_periph_examples
|
||||
* @{
|
||||
@@ -40,90 +39,10 @@
|
||||
__IO uint32_t adc1_ordinary_valuetab[5][3];
|
||||
__IO uint32_t dma1_trans_complete_flag = 0;
|
||||
|
||||
static void usart1_config(uint32_t baudrate);
|
||||
static void gpio_config(void);
|
||||
static void dma_config(void);
|
||||
static void adc_config(void);
|
||||
|
||||
/* suport printf function, use microlib is unnecessary */
|
||||
|
||||
#if (__ARMCC_VERSION > 6000000)
|
||||
__asm (".global __use_no_semihosting\n\t");
|
||||
void _sys_exit(int x)
|
||||
{
|
||||
x = x;
|
||||
}
|
||||
/* __use_no_semihosting was requested, but _ttywrch was */
|
||||
void _ttywrch(int ch)
|
||||
{
|
||||
ch = ch;
|
||||
}
|
||||
FILE __stdout;
|
||||
#else
|
||||
#ifdef __CC_ARM
|
||||
#pragma import(__use_no_semihosting)
|
||||
struct __FILE
|
||||
{
|
||||
int handle;
|
||||
};
|
||||
FILE __stdout;
|
||||
void _sys_exit(int x)
|
||||
{
|
||||
x = x;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined ( __GNUC__ ) && !defined (__clang__)
|
||||
/* with gcc/raisonance, small printf (option ld linker->libraries->small printf set to 'yes') calls
|
||||
|
||||
__io_putchar() */
|
||||
#define PUTCHAR_PROTOTYPE int __io_putchar(int ch)
|
||||
#else
|
||||
#define PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f)
|
||||
#endif /* __gnuc__ */
|
||||
|
||||
/**
|
||||
* @brief retargets the c library printf function to the usart.
|
||||
* @param none
|
||||
* @retval none
|
||||
*/
|
||||
PUTCHAR_PROTOTYPE
|
||||
{
|
||||
while(usart_flag_get(USART1, USART_TDBE_FLAG) == RESET);
|
||||
usart_data_transmit(USART1, ch);
|
||||
return ch;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief usart1 configuration.
|
||||
* @param none
|
||||
* @retval none
|
||||
*/
|
||||
static void usart1_config(uint32_t baudrate)
|
||||
{
|
||||
gpio_init_type gpio_init_struct;
|
||||
|
||||
/* enable the uart1 and gpio clock */
|
||||
crm_periph_clock_enable(CRM_USART1_PERIPH_CLOCK, TRUE);
|
||||
crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
|
||||
|
||||
gpio_default_para_init(&gpio_init_struct);
|
||||
|
||||
/* configure the uart1 tx pin */
|
||||
gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
|
||||
gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
|
||||
gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
|
||||
gpio_init_struct.gpio_pins = GPIO_PINS_9;
|
||||
gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
|
||||
gpio_init(GPIOA, &gpio_init_struct);
|
||||
|
||||
/* configure uart param */
|
||||
usart_init(USART1, baudrate, USART_DATA_8BITS, USART_STOP_1_BIT);
|
||||
usart_transmitter_enable(USART1, TRUE);
|
||||
usart_enable(USART1, TRUE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief gpio configuration.
|
||||
* @param none
|
||||
@@ -231,7 +150,7 @@ int main(void)
|
||||
at32_led_off(LED2);
|
||||
at32_led_off(LED3);
|
||||
at32_led_off(LED4);
|
||||
usart1_config(115200);
|
||||
uart_print_init(115200);
|
||||
gpio_config();
|
||||
dma_config();
|
||||
adc_config();
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f403a_407_clock.h
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief header file of clock program
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f403a_407_conf.h
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief at32f403a_407 config header file
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f403a_407_int.h
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief header file of main interrupt service routines.
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -327,8 +327,8 @@
|
||||
<uC99>0</uC99>
|
||||
<uGnu>0</uGnu>
|
||||
<useXO>0</useXO>
|
||||
<v6Lang>1</v6Lang>
|
||||
<v6LangP>1</v6LangP>
|
||||
<v6Lang>3</v6Lang>
|
||||
<v6LangP>3</v6LangP>
|
||||
<vShortEn>1</vShortEn>
|
||||
<vShortWch>1</vShortWch>
|
||||
<v6Lto>0</v6Lto>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file readme.txt
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief readme
|
||||
**************************************************************************
|
||||
*/
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f403a_407_clock.c
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief system clock config program
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f403a_407_int.c
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief main interrupt service routines.
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file main.c
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief main program
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
@@ -26,8 +26,6 @@
|
||||
|
||||
#include "at32f403a_407_board.h"
|
||||
#include "at32f403a_407_clock.h"
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
/** @addtogroup AT32F407_periph_examples
|
||||
* @{
|
||||
@@ -39,89 +37,9 @@
|
||||
|
||||
__IO uint16_t adc1_ordinary_value = 0;
|
||||
|
||||
static void usart1_config(uint32_t baudrate);
|
||||
static void dma_config(void);
|
||||
static void adc_config(void);
|
||||
|
||||
/* suport printf function, usemicrolib is unnecessary */
|
||||
|
||||
#if (__ARMCC_VERSION > 6000000)
|
||||
__asm (".global __use_no_semihosting\n\t");
|
||||
void _sys_exit(int x)
|
||||
{
|
||||
x = x;
|
||||
}
|
||||
/* __use_no_semihosting was requested, but _ttywrch was */
|
||||
void _ttywrch(int ch)
|
||||
{
|
||||
ch = ch;
|
||||
}
|
||||
FILE __stdout;
|
||||
#else
|
||||
#ifdef __CC_ARM
|
||||
#pragma import(__use_no_semihosting)
|
||||
struct __FILE
|
||||
{
|
||||
int handle;
|
||||
};
|
||||
FILE __stdout;
|
||||
void _sys_exit(int x)
|
||||
{
|
||||
x = x;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined ( __GNUC__ ) && !defined (__clang__)
|
||||
/* with gcc/raisonance, small printf (option ld linker->libraries->small printf set to 'yes') calls
|
||||
|
||||
__io_putchar() */
|
||||
#define PUTCHAR_PROTOTYPE int __io_putchar(int ch)
|
||||
#else
|
||||
#define PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f)
|
||||
#endif /* __gnuc__ */
|
||||
|
||||
/**
|
||||
* @brief retargets the c library printf function to the usart.
|
||||
* @param none
|
||||
* @retval none
|
||||
*/
|
||||
PUTCHAR_PROTOTYPE
|
||||
{
|
||||
while(usart_flag_get(USART1, USART_TDBE_FLAG) == RESET);
|
||||
usart_data_transmit(USART1, ch);
|
||||
return ch;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief usart1 configuration.
|
||||
* @param none
|
||||
* @retval none
|
||||
*/
|
||||
static void usart1_config(uint32_t baudrate)
|
||||
{
|
||||
gpio_init_type gpio_init_struct;
|
||||
|
||||
/* enable the uart1 and gpio clock */
|
||||
crm_periph_clock_enable(CRM_USART1_PERIPH_CLOCK, TRUE);
|
||||
crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
|
||||
|
||||
gpio_default_para_init(&gpio_init_struct);
|
||||
|
||||
/* configure the uart1 tx pin */
|
||||
gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
|
||||
gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
|
||||
gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
|
||||
gpio_init_struct.gpio_pins = GPIO_PINS_9;
|
||||
gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
|
||||
gpio_init(GPIOA, &gpio_init_struct);
|
||||
|
||||
/* configure uart param */
|
||||
usart_init(USART1, baudrate, USART_DATA_8BITS, USART_STOP_1_BIT);
|
||||
usart_transmitter_enable(USART1, TRUE);
|
||||
usart_enable(USART1, TRUE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief dma configuration.
|
||||
* @param none
|
||||
@@ -193,7 +111,7 @@ int main(void)
|
||||
at32_led_off(LED2);
|
||||
at32_led_off(LED3);
|
||||
at32_led_off(LED4);
|
||||
usart1_config(115200);
|
||||
uart_print_init(115200);
|
||||
dma_config();
|
||||
adc_config();
|
||||
printf("adc1_vref_check \r\n");
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f403a_407_clock.h
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief header file of clock program
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f403a_407_conf.h
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief at32f403a_407 config header file
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f403a_407_int.h
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief header file of main interrupt service routines.
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -327,8 +327,8 @@
|
||||
<uC99>0</uC99>
|
||||
<uGnu>0</uGnu>
|
||||
<useXO>0</useXO>
|
||||
<v6Lang>1</v6Lang>
|
||||
<v6LangP>1</v6LangP>
|
||||
<v6Lang>3</v6Lang>
|
||||
<v6LangP>3</v6LangP>
|
||||
<vShortEn>1</vShortEn>
|
||||
<vShortWch>1</vShortWch>
|
||||
<v6Lto>0</v6Lto>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file readme.txt
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief readme
|
||||
**************************************************************************
|
||||
*/
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f403a_407_clock.c
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief system clock config program
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f403a_407_int.c
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief main interrupt service routines.
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file main.c
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief main program
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
@@ -26,7 +26,6 @@
|
||||
|
||||
#include "at32f403a_407_board.h"
|
||||
#include "at32f403a_407_clock.h"
|
||||
#include <stdio.h>
|
||||
|
||||
/** @addtogroup AT32F407_periph_examples
|
||||
* @{
|
||||
@@ -42,91 +41,11 @@ __IO uint16_t adc1_preempt_valuetab[3][3] = {0};
|
||||
__IO uint16_t dma_trans_complete_flag = 0;
|
||||
__IO uint16_t preempt_trigger_count = 0;
|
||||
|
||||
static void usart1_config(uint32_t baudrate);
|
||||
static void gpio_config(void);
|
||||
static void exint_config(void);
|
||||
static void dma_config(void);
|
||||
static void adc_config(void);
|
||||
|
||||
/* suport printf function, usemicrolib is unnecessary */
|
||||
|
||||
#if (__ARMCC_VERSION > 6000000)
|
||||
__asm (".global __use_no_semihosting\n\t");
|
||||
void _sys_exit(int x)
|
||||
{
|
||||
x = x;
|
||||
}
|
||||
/* __use_no_semihosting was requested, but _ttywrch was */
|
||||
void _ttywrch(int ch)
|
||||
{
|
||||
ch = ch;
|
||||
}
|
||||
FILE __stdout;
|
||||
#else
|
||||
#ifdef __CC_ARM
|
||||
#pragma import(__use_no_semihosting)
|
||||
struct __FILE
|
||||
{
|
||||
int handle;
|
||||
};
|
||||
FILE __stdout;
|
||||
void _sys_exit(int x)
|
||||
{
|
||||
x = x;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined ( __GNUC__ ) && !defined (__clang__)
|
||||
/* with gcc/raisonance, small printf (option ld linker->libraries->small printf set to 'yes') calls
|
||||
|
||||
__io_putchar() */
|
||||
#define PUTCHAR_PROTOTYPE int __io_putchar(int ch)
|
||||
#else
|
||||
#define PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f)
|
||||
#endif /* __gnuc__ */
|
||||
|
||||
/**
|
||||
* @brief retargets the c library printf function to the usart.
|
||||
* @param none
|
||||
* @retval none
|
||||
*/
|
||||
PUTCHAR_PROTOTYPE
|
||||
{
|
||||
while(usart_flag_get(USART1, USART_TDBE_FLAG) == RESET);
|
||||
usart_data_transmit(USART1, ch);
|
||||
return ch;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief usart1 configuration.
|
||||
* @param none
|
||||
* @retval none
|
||||
*/
|
||||
static void usart1_config(uint32_t baudrate)
|
||||
{
|
||||
gpio_init_type gpio_init_struct;
|
||||
|
||||
/* enable the uart1 and gpio clock */
|
||||
crm_periph_clock_enable(CRM_USART1_PERIPH_CLOCK, TRUE);
|
||||
crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
|
||||
|
||||
gpio_default_para_init(&gpio_init_struct);
|
||||
|
||||
/* configure the uart1 tx pin */
|
||||
gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
|
||||
gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
|
||||
gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
|
||||
gpio_init_struct.gpio_pins = GPIO_PINS_9;
|
||||
gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
|
||||
gpio_init(GPIOA, &gpio_init_struct);
|
||||
|
||||
/* configure uart param */
|
||||
usart_init(USART1, baudrate, USART_DATA_8BITS, USART_STOP_1_BIT);
|
||||
usart_transmitter_enable(USART1, TRUE);
|
||||
usart_enable(USART1, TRUE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief gpio configuration.
|
||||
* @param none
|
||||
@@ -272,7 +191,7 @@ int main(void)
|
||||
at32_led_off(LED2);
|
||||
at32_led_off(LED3);
|
||||
at32_led_off(LED4);
|
||||
usart1_config(115200);
|
||||
uart_print_init(115200);
|
||||
gpio_config();
|
||||
exint_config();
|
||||
dma_config();
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f403a_407_clock.h
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief header file of clock program
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f403a_407_conf.h
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief at32f403a_407 config header file
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f403a_407_int.h
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief header file of main interrupt service routines.
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -327,8 +327,8 @@
|
||||
<uC99>0</uC99>
|
||||
<uGnu>0</uGnu>
|
||||
<useXO>0</useXO>
|
||||
<v6Lang>1</v6Lang>
|
||||
<v6LangP>1</v6LangP>
|
||||
<v6Lang>3</v6Lang>
|
||||
<v6LangP>3</v6LangP>
|
||||
<vShortEn>1</vShortEn>
|
||||
<vShortWch>1</vShortWch>
|
||||
<v6Lto>0</v6Lto>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file readme.txt
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief readme
|
||||
**************************************************************************
|
||||
*/
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f403a_407_clock.c
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief system clock config program
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f403a_407_int.c
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief main interrupt service routines.
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file main.c
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief main program
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
@@ -26,8 +26,6 @@
|
||||
|
||||
#include "at32f403a_407_board.h"
|
||||
#include "at32f403a_407_clock.h"
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
/** @addtogroup AT32F407_periph_examples
|
||||
* @{
|
||||
@@ -44,89 +42,9 @@
|
||||
|
||||
__IO uint16_t adc1_ordinary_value = 0;
|
||||
|
||||
static void usart1_config(uint32_t baudrate);
|
||||
static void dma_config(void);
|
||||
static void adc_config(void);
|
||||
|
||||
/* suport printf function, usemicrolib is unnecessary */
|
||||
|
||||
#if (__ARMCC_VERSION > 6000000)
|
||||
__asm (".global __use_no_semihosting\n\t");
|
||||
void _sys_exit(int x)
|
||||
{
|
||||
x = x;
|
||||
}
|
||||
/* __use_no_semihosting was requested, but _ttywrch was */
|
||||
void _ttywrch(int ch)
|
||||
{
|
||||
ch = ch;
|
||||
}
|
||||
FILE __stdout;
|
||||
#else
|
||||
#ifdef __CC_ARM
|
||||
#pragma import(__use_no_semihosting)
|
||||
struct __FILE
|
||||
{
|
||||
int handle;
|
||||
};
|
||||
FILE __stdout;
|
||||
void _sys_exit(int x)
|
||||
{
|
||||
x = x;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined ( __GNUC__ ) && !defined (__clang__)
|
||||
/* with gcc/raisonance, small printf (option ld linker->libraries->small printf set to 'yes') calls
|
||||
|
||||
__io_putchar() */
|
||||
#define PUTCHAR_PROTOTYPE int __io_putchar(int ch)
|
||||
#else
|
||||
#define PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f)
|
||||
#endif /* __gnuc__ */
|
||||
|
||||
/**
|
||||
* @brief retargets the c library printf function to the usart.
|
||||
* @param none
|
||||
* @retval none
|
||||
*/
|
||||
PUTCHAR_PROTOTYPE
|
||||
{
|
||||
while(usart_flag_get(USART1, USART_TDBE_FLAG) == RESET);
|
||||
usart_data_transmit(USART1, ch);
|
||||
return ch;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief usart1 configuration.
|
||||
* @param none
|
||||
* @retval none
|
||||
*/
|
||||
static void usart1_config(uint32_t baudrate)
|
||||
{
|
||||
gpio_init_type gpio_init_struct;
|
||||
|
||||
/* enable the uart1 and gpio clock */
|
||||
crm_periph_clock_enable(CRM_USART1_PERIPH_CLOCK, TRUE);
|
||||
crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
|
||||
|
||||
gpio_default_para_init(&gpio_init_struct);
|
||||
|
||||
/* configure the uart1 tx pin */
|
||||
gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
|
||||
gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
|
||||
gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
|
||||
gpio_init_struct.gpio_pins = GPIO_PINS_9;
|
||||
gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
|
||||
gpio_init(GPIOA, &gpio_init_struct);
|
||||
|
||||
/* configure uart param */
|
||||
usart_init(USART1, baudrate, USART_DATA_8BITS, USART_STOP_1_BIT);
|
||||
usart_transmitter_enable(USART1, TRUE);
|
||||
usart_enable(USART1, TRUE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief dma configuration.
|
||||
* @param none
|
||||
@@ -198,7 +116,7 @@ int main(void)
|
||||
at32_led_off(LED2);
|
||||
at32_led_off(LED3);
|
||||
at32_led_off(LED4);
|
||||
usart1_config(115200);
|
||||
uart_print_init(115200);
|
||||
dma_config();
|
||||
adc_config();
|
||||
printf("internal_temperature_sensor \r\n");
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f403a_407_clock.h
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief header file of clock program
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f403a_407_conf.h
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief at32f403a_407 config header file
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f403a_407_int.h
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief header file of main interrupt service routines.
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -327,8 +327,8 @@
|
||||
<uC99>0</uC99>
|
||||
<uGnu>0</uGnu>
|
||||
<useXO>0</useXO>
|
||||
<v6Lang>1</v6Lang>
|
||||
<v6LangP>1</v6LangP>
|
||||
<v6Lang>3</v6Lang>
|
||||
<v6LangP>3</v6LangP>
|
||||
<vShortEn>1</vShortEn>
|
||||
<vShortWch>1</vShortWch>
|
||||
<v6Lto>0</v6Lto>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file readme.txt
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief readme
|
||||
**************************************************************************
|
||||
*/
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f403a_407_clock.c
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief system clock config program
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f403a_407_int.c
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief main interrupt service routines.
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file main.c
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief main program
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
@@ -26,9 +26,6 @@
|
||||
|
||||
#include "at32f403a_407_board.h"
|
||||
#include "at32f403a_407_clock.h"
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
|
||||
/** @addtogroup AT32F407_periph_examples
|
||||
* @{
|
||||
@@ -41,90 +38,10 @@
|
||||
__IO uint16_t adc1_ordinary_valuetab[10][3] = {0};
|
||||
__IO uint16_t dma_trans_complete_flag = 0;
|
||||
|
||||
static void usart1_config(uint32_t baudrate);
|
||||
static void gpio_config(void);
|
||||
static void dma_config(void);
|
||||
static void adc_config(void);
|
||||
|
||||
/* suport printf function, usemicrolib is unnecessary */
|
||||
|
||||
#if (__ARMCC_VERSION > 6000000)
|
||||
__asm (".global __use_no_semihosting\n\t");
|
||||
void _sys_exit(int x)
|
||||
{
|
||||
x = x;
|
||||
}
|
||||
/* __use_no_semihosting was requested, but _ttywrch was */
|
||||
void _ttywrch(int ch)
|
||||
{
|
||||
ch = ch;
|
||||
}
|
||||
FILE __stdout;
|
||||
#else
|
||||
#ifdef __CC_ARM
|
||||
#pragma import(__use_no_semihosting)
|
||||
struct __FILE
|
||||
{
|
||||
int handle;
|
||||
};
|
||||
FILE __stdout;
|
||||
void _sys_exit(int x)
|
||||
{
|
||||
x = x;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined ( __GNUC__ ) && !defined (__clang__)
|
||||
/* with gcc/raisonance, small printf (option ld linker->libraries->small printf set to 'yes') calls
|
||||
|
||||
__io_putchar() */
|
||||
#define PUTCHAR_PROTOTYPE int __io_putchar(int ch)
|
||||
#else
|
||||
#define PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f)
|
||||
#endif /* __gnuc__ */
|
||||
|
||||
/**
|
||||
* @brief retargets the c library printf function to the usart.
|
||||
* @param none
|
||||
* @retval none
|
||||
*/
|
||||
PUTCHAR_PROTOTYPE
|
||||
{
|
||||
while(usart_flag_get(USART1, USART_TDBE_FLAG) == RESET);
|
||||
usart_data_transmit(USART1, ch);
|
||||
return ch;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief usart1 configuration.
|
||||
* @param none
|
||||
* @retval none
|
||||
*/
|
||||
static void usart1_config(uint32_t baudrate)
|
||||
{
|
||||
gpio_init_type gpio_init_struct;
|
||||
|
||||
/* enable the uart1 and gpio clock */
|
||||
crm_periph_clock_enable(CRM_USART1_PERIPH_CLOCK, TRUE);
|
||||
crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
|
||||
|
||||
gpio_default_para_init(&gpio_init_struct);
|
||||
|
||||
/* configure the uart1 tx pin */
|
||||
gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
|
||||
gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
|
||||
gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
|
||||
gpio_init_struct.gpio_pins = GPIO_PINS_9;
|
||||
gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
|
||||
gpio_init(GPIOA, &gpio_init_struct);
|
||||
|
||||
/* configure uart param */
|
||||
usart_init(USART1, baudrate, USART_DATA_8BITS, USART_STOP_1_BIT);
|
||||
usart_transmitter_enable(USART1, TRUE);
|
||||
usart_enable(USART1, TRUE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief gpio configuration.
|
||||
* @param none
|
||||
@@ -215,7 +132,7 @@ int main(void)
|
||||
at32_led_off(LED2);
|
||||
at32_led_off(LED3);
|
||||
at32_led_off(LED4);
|
||||
usart1_config(115200);
|
||||
uart_print_init(115200);
|
||||
gpio_config();
|
||||
dma_config();
|
||||
adc_config();
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f403a_407_clock.h
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief header file of clock program
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f403a_407_conf.h
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief at32f403a_407 config header file
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f403a_407_int.h
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief header file of main interrupt service routines.
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -327,8 +327,8 @@
|
||||
<uC99>0</uC99>
|
||||
<uGnu>0</uGnu>
|
||||
<useXO>0</useXO>
|
||||
<v6Lang>1</v6Lang>
|
||||
<v6LangP>1</v6LangP>
|
||||
<v6Lang>3</v6Lang>
|
||||
<v6LangP>3</v6LangP>
|
||||
<vShortEn>1</vShortEn>
|
||||
<vShortWch>1</vShortWch>
|
||||
<v6Lto>0</v6Lto>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file readme.txt
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief readme
|
||||
**************************************************************************
|
||||
*/
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f403a_407_clock.c
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief system clock config program
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f403a_407_int.c
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief main interrupt service routines.
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file main.c
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief main program
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
@@ -26,9 +26,6 @@
|
||||
|
||||
#include "at32f403a_407_board.h"
|
||||
#include "at32f403a_407_clock.h"
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
|
||||
/** @addtogroup AT32F407_periph_examples
|
||||
* @{
|
||||
@@ -44,91 +41,11 @@ __IO uint16_t adc1_preempt_valuetab[5][3] = {0};
|
||||
__IO uint16_t dma_trans_complete_flag = 0;
|
||||
__IO uint16_t preempt_conversion_count = 0;
|
||||
|
||||
static void usart1_config(uint32_t baudrate);
|
||||
static void gpio_config(void);
|
||||
static void dma_config(void);
|
||||
static void tmr1_config(void);
|
||||
static void adc_config(void);
|
||||
|
||||
/* suport printf function, usemicrolib is unnecessary */
|
||||
|
||||
#if (__ARMCC_VERSION > 6000000)
|
||||
__asm (".global __use_no_semihosting\n\t");
|
||||
void _sys_exit(int x)
|
||||
{
|
||||
x = x;
|
||||
}
|
||||
/* __use_no_semihosting was requested, but _ttywrch was */
|
||||
void _ttywrch(int ch)
|
||||
{
|
||||
ch = ch;
|
||||
}
|
||||
FILE __stdout;
|
||||
#else
|
||||
#ifdef __CC_ARM
|
||||
#pragma import(__use_no_semihosting)
|
||||
struct __FILE
|
||||
{
|
||||
int handle;
|
||||
};
|
||||
FILE __stdout;
|
||||
void _sys_exit(int x)
|
||||
{
|
||||
x = x;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined ( __GNUC__ ) && !defined (__clang__)
|
||||
/* with gcc/raisonance, small printf (option ld linker->libraries->small printf set to 'yes') calls
|
||||
|
||||
__io_putchar() */
|
||||
#define PUTCHAR_PROTOTYPE int __io_putchar(int ch)
|
||||
#else
|
||||
#define PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f)
|
||||
#endif /* __gnuc__ */
|
||||
|
||||
/**
|
||||
* @brief retargets the c library printf function to the usart.
|
||||
* @param none
|
||||
* @retval none
|
||||
*/
|
||||
PUTCHAR_PROTOTYPE
|
||||
{
|
||||
while(usart_flag_get(USART1, USART_TDBE_FLAG) == RESET);
|
||||
usart_data_transmit(USART1, ch);
|
||||
return ch;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief usart1 configuration.
|
||||
* @param none
|
||||
* @retval none
|
||||
*/
|
||||
static void usart1_config(uint32_t baudrate)
|
||||
{
|
||||
gpio_init_type gpio_init_struct;
|
||||
|
||||
/* enable the uart1 and gpio clock */
|
||||
crm_periph_clock_enable(CRM_USART1_PERIPH_CLOCK, TRUE);
|
||||
crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
|
||||
|
||||
gpio_default_para_init(&gpio_init_struct);
|
||||
|
||||
/* configure the uart1 tx pin */
|
||||
gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
|
||||
gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
|
||||
gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
|
||||
gpio_init_struct.gpio_pins = GPIO_PINS_9;
|
||||
gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
|
||||
gpio_init(GPIOA, &gpio_init_struct);
|
||||
|
||||
/* configure uart param */
|
||||
usart_init(USART1, baudrate, USART_DATA_8BITS, USART_STOP_1_BIT);
|
||||
usart_transmitter_enable(USART1, TRUE);
|
||||
usart_enable(USART1, TRUE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief gpio configuration.
|
||||
* @param none
|
||||
@@ -203,8 +120,8 @@ static void tmr1_config(void)
|
||||
|
||||
crm_periph_clock_enable(CRM_TMR1_PERIPH_CLOCK, TRUE);
|
||||
|
||||
/* (systemclock / 24000) / 1000 = 10Hz(100ms) */
|
||||
tmr_base_init(TMR1, 1000, 24000);
|
||||
/* (systemclock/(systemclock/10000))/1000 = 10Hz(100ms) */
|
||||
tmr_base_init(TMR1, 999, (crm_clocks_freq_struct.sclk_freq/10000 - 1));
|
||||
tmr_cnt_dir_set(TMR1, TMR_COUNT_UP);
|
||||
tmr_clock_source_div_set(TMR1, TMR_CLOCK_DIV1);
|
||||
|
||||
@@ -275,7 +192,7 @@ int main(void)
|
||||
at32_led_off(LED2);
|
||||
at32_led_off(LED3);
|
||||
at32_led_off(LED4);
|
||||
usart1_config(115200);
|
||||
uart_print_init(115200);
|
||||
gpio_config();
|
||||
tmr1_config();
|
||||
dma_config();
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f403a_407_clock.h
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief header file of clock program
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f403a_407_conf.h
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief at32f403a_407 config header file
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f403a_407_int.h
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief header file of main interrupt service routines.
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -327,8 +327,8 @@
|
||||
<uC99>0</uC99>
|
||||
<uGnu>0</uGnu>
|
||||
<useXO>0</useXO>
|
||||
<v6Lang>1</v6Lang>
|
||||
<v6LangP>1</v6LangP>
|
||||
<v6Lang>3</v6Lang>
|
||||
<v6LangP>3</v6LangP>
|
||||
<vShortEn>1</vShortEn>
|
||||
<vShortWch>1</vShortWch>
|
||||
<v6Lto>0</v6Lto>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file readme.txt
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief readme
|
||||
**************************************************************************
|
||||
*/
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f403a_407_clock.c
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief system clock config program
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f403a_407_int.c
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief main interrupt service routines.
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file main.c
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief main program
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
@@ -26,7 +26,6 @@
|
||||
|
||||
#include "at32f403a_407_board.h"
|
||||
#include "at32f403a_407_clock.h"
|
||||
#include <stdio.h>
|
||||
|
||||
/** @addtogroup AT32F407_periph_examples
|
||||
* @{
|
||||
@@ -41,91 +40,11 @@ __IO uint16_t adc3_ordinary_valuetab[5][3];
|
||||
__IO uint32_t dma1_trans_complete_flag = 0;
|
||||
__IO uint32_t dma2_trans_complete_flag = 0;
|
||||
|
||||
static void usart1_config(uint32_t baudrate);
|
||||
static void gpio_config(void);
|
||||
static void dma_config(void);
|
||||
static void tmr1_config(void);
|
||||
static void adc_config(void);
|
||||
|
||||
/* suport printf function, usemicrolib is unnecessary */
|
||||
|
||||
#if (__ARMCC_VERSION > 6000000)
|
||||
__asm (".global __use_no_semihosting\n\t");
|
||||
void _sys_exit(int x)
|
||||
{
|
||||
x = x;
|
||||
}
|
||||
/* __use_no_semihosting was requested, but _ttywrch was */
|
||||
void _ttywrch(int ch)
|
||||
{
|
||||
ch = ch;
|
||||
}
|
||||
FILE __stdout;
|
||||
#else
|
||||
#ifdef __CC_ARM
|
||||
#pragma import(__use_no_semihosting)
|
||||
struct __FILE
|
||||
{
|
||||
int handle;
|
||||
};
|
||||
FILE __stdout;
|
||||
void _sys_exit(int x)
|
||||
{
|
||||
x = x;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined ( __GNUC__ ) && !defined (__clang__)
|
||||
/* with gcc/raisonance, small printf (option ld linker->libraries->small printf set to 'yes') calls
|
||||
|
||||
__io_putchar() */
|
||||
#define PUTCHAR_PROTOTYPE int __io_putchar(int ch)
|
||||
#else
|
||||
#define PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f)
|
||||
#endif /* __gnuc__ */
|
||||
|
||||
/**
|
||||
* @brief retargets the c library printf function to the usart.
|
||||
* @param none
|
||||
* @retval none
|
||||
*/
|
||||
PUTCHAR_PROTOTYPE
|
||||
{
|
||||
while(usart_flag_get(USART1, USART_TDBE_FLAG) == RESET);
|
||||
usart_data_transmit(USART1, ch);
|
||||
return ch;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief usart1 configuration.
|
||||
* @param none
|
||||
* @retval none
|
||||
*/
|
||||
static void usart1_config(uint32_t baudrate)
|
||||
{
|
||||
gpio_init_type gpio_init_struct;
|
||||
|
||||
/* enable the uart1 and gpio clock */
|
||||
crm_periph_clock_enable(CRM_USART1_PERIPH_CLOCK, TRUE);
|
||||
crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
|
||||
|
||||
gpio_default_para_init(&gpio_init_struct);
|
||||
|
||||
/* configure the uart1 tx pin */
|
||||
gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
|
||||
gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
|
||||
gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
|
||||
gpio_init_struct.gpio_pins = GPIO_PINS_9;
|
||||
gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
|
||||
gpio_init(GPIOA, &gpio_init_struct);
|
||||
|
||||
/* configure uart param */
|
||||
usart_init(USART1, baudrate, USART_DATA_8BITS, USART_STOP_1_BIT);
|
||||
usart_transmitter_enable(USART1, TRUE);
|
||||
usart_enable(USART1, TRUE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief gpio configuration.
|
||||
* @param none
|
||||
@@ -205,8 +124,8 @@ static void tmr1_config(void)
|
||||
|
||||
crm_periph_clock_enable(CRM_TMR1_PERIPH_CLOCK, TRUE);
|
||||
|
||||
/* (systemclock / 24000) / 1000 = 10Hz(100ms) */
|
||||
tmr_base_init(TMR1, 1000, 24000);
|
||||
/* (systemclock/(systemclock/10000))/1000 = 10Hz(100ms) */
|
||||
tmr_base_init(TMR1, 999, (crm_clocks_freq_struct.sclk_freq/10000 - 1));
|
||||
tmr_cnt_dir_set(TMR1, TMR_COUNT_UP);
|
||||
tmr_clock_source_div_set(TMR1, TMR_CLOCK_DIV1);
|
||||
tmr_primary_mode_select(TMR1, TMR_PRIMARY_SEL_OVERFLOW);
|
||||
@@ -284,7 +203,7 @@ int main(void)
|
||||
at32_led_off(LED2);
|
||||
at32_led_off(LED3);
|
||||
at32_led_off(LED4);
|
||||
usart1_config(115200);
|
||||
uart_print_init(115200);
|
||||
gpio_config();
|
||||
tmr1_config();
|
||||
dma_config();
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f403a_407_clock.h
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief header file of clock program
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f403a_407_conf.h
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief at32f403a_407 config header file
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f403a_407_int.h
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief header file of main interrupt service routines.
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -327,8 +327,8 @@
|
||||
<uC99>0</uC99>
|
||||
<uGnu>0</uGnu>
|
||||
<useXO>0</useXO>
|
||||
<v6Lang>1</v6Lang>
|
||||
<v6LangP>1</v6LangP>
|
||||
<v6Lang>3</v6Lang>
|
||||
<v6LangP>3</v6LangP>
|
||||
<vShortEn>1</vShortEn>
|
||||
<vShortWch>1</vShortWch>
|
||||
<v6Lto>0</v6Lto>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file readme.txt
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief readme
|
||||
**************************************************************************
|
||||
*/
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f403a_407_clock.c
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief system clock config program
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f403a_407_int.c
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief main interrupt service routines.
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file main.c
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief main program
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
@@ -26,8 +26,6 @@
|
||||
|
||||
#include "at32f403a_407_board.h"
|
||||
#include "at32f403a_407_clock.h"
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
/** @addtogroup AT32F407_periph_examples
|
||||
* @{
|
||||
@@ -40,90 +38,10 @@
|
||||
__IO uint16_t adc1_ordinary_valuetab[3] = {0};
|
||||
__IO uint16_t vmor_flag_index = 0;
|
||||
|
||||
static void usart1_config(uint32_t baudrate);
|
||||
static void gpio_config(void);
|
||||
static void dma_config(void);
|
||||
static void adc_config(void);
|
||||
|
||||
/* suport printf function, usemicrolib is unnecessary */
|
||||
|
||||
#if (__ARMCC_VERSION > 6000000)
|
||||
__asm (".global __use_no_semihosting\n\t");
|
||||
void _sys_exit(int x)
|
||||
{
|
||||
x = x;
|
||||
}
|
||||
/* __use_no_semihosting was requested, but _ttywrch was */
|
||||
void _ttywrch(int ch)
|
||||
{
|
||||
ch = ch;
|
||||
}
|
||||
FILE __stdout;
|
||||
#else
|
||||
#ifdef __CC_ARM
|
||||
#pragma import(__use_no_semihosting)
|
||||
struct __FILE
|
||||
{
|
||||
int handle;
|
||||
};
|
||||
FILE __stdout;
|
||||
void _sys_exit(int x)
|
||||
{
|
||||
x = x;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined ( __GNUC__ ) && !defined (__clang__)
|
||||
/* with gcc/raisonance, small printf (option ld linker->libraries->small printf set to 'yes') calls
|
||||
|
||||
__io_putchar() */
|
||||
#define PUTCHAR_PROTOTYPE int __io_putchar(int ch)
|
||||
#else
|
||||
#define PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f)
|
||||
#endif /* __gnuc__ */
|
||||
|
||||
/**
|
||||
* @brief retargets the c library printf function to the usart.
|
||||
* @param none
|
||||
* @retval none
|
||||
*/
|
||||
PUTCHAR_PROTOTYPE
|
||||
{
|
||||
while(usart_flag_get(USART1, USART_TDBE_FLAG) == RESET);
|
||||
usart_data_transmit(USART1, ch);
|
||||
return ch;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief usart1 configuration.
|
||||
* @param none
|
||||
* @retval none
|
||||
*/
|
||||
static void usart1_config(uint32_t baudrate)
|
||||
{
|
||||
gpio_init_type gpio_init_struct;
|
||||
|
||||
/* enable the uart1 and gpio clock */
|
||||
crm_periph_clock_enable(CRM_USART1_PERIPH_CLOCK, TRUE);
|
||||
crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
|
||||
|
||||
gpio_default_para_init(&gpio_init_struct);
|
||||
|
||||
/* configure the uart1 tx pin */
|
||||
gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
|
||||
gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
|
||||
gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
|
||||
gpio_init_struct.gpio_pins = GPIO_PINS_9;
|
||||
gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
|
||||
gpio_init(GPIOA, &gpio_init_struct);
|
||||
|
||||
/* configure uart param */
|
||||
usart_init(USART1, baudrate, USART_DATA_8BITS, USART_STOP_1_BIT);
|
||||
usart_transmitter_enable(USART1, TRUE);
|
||||
usart_enable(USART1, TRUE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief gpio configuration.
|
||||
* @param none
|
||||
@@ -217,7 +135,7 @@ int main(void)
|
||||
at32_led_off(LED2);
|
||||
at32_led_off(LED3);
|
||||
at32_led_off(LED4);
|
||||
usart1_config(115200);
|
||||
uart_print_init(115200);
|
||||
gpio_config();
|
||||
dma_config();
|
||||
adc_config();
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f403a_407_clock.h
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief header file of clock program
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f403a_407_conf.h
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief at32f403a_407 config header file
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f403a_407_int.h
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief header file of main interrupt service routines.
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file readme.txt
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief readme
|
||||
**************************************************************************
|
||||
*/
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f403a_407_clock.c
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief system clock config program
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f403a_407_int.c
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief main interrupt service routines.
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file main.c
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief main program
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
@@ -26,7 +26,6 @@
|
||||
|
||||
#include "at32f403a_407_board.h"
|
||||
#include "at32f403a_407_clock.h"
|
||||
#include "stdio.h"
|
||||
|
||||
/** @addtogroup AT32F407_periph_examples
|
||||
* @{
|
||||
@@ -93,83 +92,6 @@ uint8_t bpr_reg_check(void)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief initialize print usart
|
||||
* @param baudrate: uart baudrate
|
||||
* @retval none
|
||||
*/
|
||||
void uart_init(uint32_t baudrate)
|
||||
{
|
||||
gpio_init_type gpio_init_struct;
|
||||
|
||||
/* enable the uart1 and gpio clock */
|
||||
crm_periph_clock_enable(CRM_USART1_PERIPH_CLOCK, TRUE);
|
||||
crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
|
||||
|
||||
gpio_default_para_init(&gpio_init_struct);
|
||||
|
||||
/* configure the uart1 tx pin */
|
||||
gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
|
||||
gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
|
||||
gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
|
||||
gpio_init_struct.gpio_pins = GPIO_PINS_9;
|
||||
gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
|
||||
gpio_init(GPIOA, &gpio_init_struct);
|
||||
|
||||
/* configure uart param */
|
||||
usart_init(USART1, baudrate, USART_DATA_8BITS, USART_STOP_1_BIT);
|
||||
usart_transmitter_enable(USART1, TRUE);
|
||||
usart_enable(USART1, TRUE);
|
||||
}
|
||||
|
||||
/* suport printf function, usemicrolib is unnecessary */
|
||||
#if (__ARMCC_VERSION > 6000000)
|
||||
__asm (".global __use_no_semihosting\n\t");
|
||||
void _sys_exit(int x)
|
||||
{
|
||||
x = x;
|
||||
}
|
||||
/* __use_no_semihosting was requested, but _ttywrch was */
|
||||
void _ttywrch(int ch)
|
||||
{
|
||||
ch = ch;
|
||||
}
|
||||
FILE __stdout;
|
||||
#else
|
||||
#ifdef __CC_ARM
|
||||
#pragma import(__use_no_semihosting)
|
||||
struct __FILE
|
||||
{
|
||||
int handle;
|
||||
};
|
||||
FILE __stdout;
|
||||
void _sys_exit(int x)
|
||||
{
|
||||
x = x;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined ( __GNUC__ ) && !defined (__clang__)
|
||||
#define PUTCHAR_PROTOTYPE int __io_putchar(int ch)
|
||||
#else
|
||||
#define PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief retargets the c library printf function to the usart.
|
||||
* @param none
|
||||
* @retval none
|
||||
*/
|
||||
PUTCHAR_PROTOTYPE
|
||||
{
|
||||
while(usart_flag_get(USART1, USART_TDBE_FLAG) == RESET);
|
||||
|
||||
usart_data_transmit(USART1, ch);
|
||||
|
||||
return ch;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief main function.
|
||||
* @param none
|
||||
@@ -179,7 +101,7 @@ int main(void)
|
||||
{
|
||||
system_clock_config();
|
||||
|
||||
uart_init(115200);
|
||||
uart_print_init(115200);
|
||||
|
||||
/* enable pwc and bpr clock */
|
||||
crm_periph_clock_enable(CRM_PWC_PERIPH_CLOCK, TRUE);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f403a_407_clock.h
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief header file of clock program
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f403a_407_conf.h
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief at32f403a_407 config header file
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f403a_407_int.h
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief header file of main interrupt service routines.
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file readme.txt
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief readme
|
||||
**************************************************************************
|
||||
*/
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f403a_407_clock.c
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief system clock config program
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f403a_407_int.c
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief main interrupt service routines.
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file main.c
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief main program
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f403a_407_clock.h
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief header file of clock program
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f403a_407_conf.h
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief at32f403a_407 config header file
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f403a_407_int.h
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief header file of main interrupt service routines.
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -270,6 +270,18 @@
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\..\..\libraries\drivers\src\at32f403a_407_usart.c</PathWithFileName>
|
||||
<FilenameWithoutPath>at32f403a_407_usart.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>3</GroupNumber>
|
||||
<FileNumber>8</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\..\..\libraries\drivers\src\at32f403a_407_can.c</PathWithFileName>
|
||||
<FilenameWithoutPath>at32f403a_407_can.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
@@ -277,7 +289,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>3</GroupNumber>
|
||||
<FileNumber>8</FileNumber>
|
||||
<FileNumber>9</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@@ -297,7 +309,7 @@
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>4</GroupNumber>
|
||||
<FileNumber>9</FileNumber>
|
||||
<FileNumber>10</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@@ -309,7 +321,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>4</GroupNumber>
|
||||
<FileNumber>10</FileNumber>
|
||||
<FileNumber>11</FileNumber>
|
||||
<FileType>2</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@@ -329,7 +341,7 @@
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>5</GroupNumber>
|
||||
<FileNumber>11</FileNumber>
|
||||
<FileNumber>12</FileNumber>
|
||||
<FileType>5</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
|
||||
@@ -422,6 +422,11 @@
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\libraries\drivers\src\at32f403a_407_crm.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>at32f403a_407_usart.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\libraries\drivers\src\at32f403a_407_usart.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>at32f403a_407_can.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file readme.txt
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief readme
|
||||
**************************************************************************
|
||||
*/
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f403a_407_clock.c
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief system clock config program
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f403a_407_int.c
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief main interrupt service routines.
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file main.c
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief main program
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f403a_407_clock.h
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief header file of clock program
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f403a_407_conf.h
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief at32f403a_407 config header file
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f403a_407_int.h
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief header file of main interrupt service routines.
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -270,6 +270,18 @@
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\..\..\libraries\drivers\src\at32f403a_407_usart.c</PathWithFileName>
|
||||
<FilenameWithoutPath>at32f403a_407_usart.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>3</GroupNumber>
|
||||
<FileNumber>8</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\..\..\libraries\drivers\src\at32f403a_407_can.c</PathWithFileName>
|
||||
<FilenameWithoutPath>at32f403a_407_can.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
@@ -277,7 +289,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>3</GroupNumber>
|
||||
<FileNumber>8</FileNumber>
|
||||
<FileNumber>9</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@@ -297,7 +309,7 @@
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>4</GroupNumber>
|
||||
<FileNumber>9</FileNumber>
|
||||
<FileNumber>10</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@@ -309,7 +321,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>4</GroupNumber>
|
||||
<FileNumber>10</FileNumber>
|
||||
<FileNumber>11</FileNumber>
|
||||
<FileType>2</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@@ -329,7 +341,7 @@
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>5</GroupNumber>
|
||||
<FileNumber>11</FileNumber>
|
||||
<FileNumber>12</FileNumber>
|
||||
<FileType>5</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
|
||||
@@ -422,6 +422,11 @@
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\libraries\drivers\src\at32f403a_407_crm.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>at32f403a_407_usart.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\libraries\drivers\src\at32f403a_407_usart.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>at32f403a_407_can.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file readme.txt
|
||||
* @version v2.0.4
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.6
|
||||
* @date 2021-12-31
|
||||
* @brief readme
|
||||
**************************************************************************
|
||||
*/
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user