mirror of
https://github.com/ArteryTek/AT32F415_Firmware_Library.git
synced 2026-05-21 01:12:20 +00:00
update version to v2.0.2
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f415_board.c
|
||||
* @version v2.0.0
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.2
|
||||
* @date 2021-12-31
|
||||
* @brief set of firmware functions to manage leds and push-button.
|
||||
* initialize delay function.
|
||||
**************************************************************************
|
||||
@@ -48,6 +48,86 @@ crm_periph_clock_type led_gpio_crm_clk[LED_NUM] = {LED2_GPIO_CRM_CLK, LED3_GPIO_
|
||||
static __IO uint32_t fac_us;
|
||||
static __IO uint32_t fac_ms;
|
||||
|
||||
/* support 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;
|
||||
}
|
||||
/* __use_no_semihosting was requested, but _ttywrch was */
|
||||
void _ttywrch(int ch)
|
||||
{
|
||||
ch = ch;
|
||||
}
|
||||
#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(PRINT_UART, USART_TDBE_FLAG) == RESET);
|
||||
usart_data_transmit(PRINT_UART, ch);
|
||||
return ch;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief initialize uart
|
||||
* @param baudrate: uart baudrate
|
||||
* @retval none
|
||||
*/
|
||||
void uart_print_init(uint32_t baudrate)
|
||||
{
|
||||
gpio_init_type gpio_init_struct;
|
||||
|
||||
/* enable the uart and gpio clock */
|
||||
crm_periph_clock_enable(PRINT_UART_CRM_CLK, TRUE);
|
||||
crm_periph_clock_enable(PRINT_UART_TX_GPIO_CRM_CLK, TRUE);
|
||||
|
||||
gpio_default_para_init(&gpio_init_struct);
|
||||
|
||||
/* configure the uart 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 = PRINT_UART_TX_PIN;
|
||||
gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
|
||||
gpio_init(PRINT_UART_TX_GPIO, &gpio_init_struct);
|
||||
|
||||
/* configure uart param */
|
||||
usart_init(PRINT_UART, baudrate, USART_DATA_8BITS, USART_STOP_1_BIT);
|
||||
usart_transmitter_enable(PRINT_UART, TRUE);
|
||||
usart_enable(PRINT_UART, TRUE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief board initialize interface init led and button
|
||||
* @param none
|
||||
@@ -290,3 +370,4 @@ void delay_sec(uint16_t sec)
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f415_board.h
|
||||
* @version v2.0.0
|
||||
* @date 2021-11-26
|
||||
* @version v2.0.2
|
||||
* @date 2021-12-31
|
||||
* @brief header file for at-start board. set of firmware functions to
|
||||
* manage leds and push-button. initialize delay function.
|
||||
**************************************************************************
|
||||
@@ -32,6 +32,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "stdio.h"
|
||||
#include "at32f415.h"
|
||||
|
||||
/** @addtogroup AT32F415_board
|
||||
@@ -80,6 +81,13 @@ typedef enum
|
||||
#define LED4_GPIO_CRM_CLK CRM_GPIOC_PERIPH_CLOCK
|
||||
#endif
|
||||
|
||||
/**************** define print uart ******************/
|
||||
#define PRINT_UART USART1
|
||||
#define PRINT_UART_CRM_CLK CRM_USART1_PERIPH_CLOCK
|
||||
#define PRINT_UART_TX_PIN GPIO_PINS_9
|
||||
#define PRINT_UART_TX_GPIO GPIOA
|
||||
#define PRINT_UART_TX_GPIO_CRM_CLK CRM_GPIOA_PERIPH_CLOCK
|
||||
|
||||
/******************* define button *******************/
|
||||
typedef enum
|
||||
{
|
||||
@@ -119,6 +127,9 @@ void delay_us(uint32_t nus);
|
||||
void delay_ms(uint16_t nms);
|
||||
void delay_sec(uint16_t sec);
|
||||
|
||||
/* printf uart init function */
|
||||
void uart_print_init(uint32_t baudrate);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user