update version to v2.0.4

This commit is contained in:
Artery-MCU
2022-04-11 19:27:58 +08:00
parent d2285506f0
commit eab9bf65de
1451 changed files with 221506 additions and 13129 deletions

View File

@@ -1,17 +1,17 @@
/**
**************************************************************************
* @file at32f413_clock.h
* @version v2.0.3
* @date 2022-02-11
* @version v2.0.4
* @date 2022-04-02
* @brief header file of clock program
**************************************************************************
* Copyright notice & Disclaimer
*
* The software Board Support Package (BSP) that is made available to
* download from Artery official website is the copyrighted work of Artery.
* Artery authorizes customers to use, copy, and distribute the BSP
* software and its related documentation for the purpose of design and
* development in conjunction with Artery microcontrollers. Use of the
* The software Board Support Package (BSP) that is made available to
* download from Artery official website is the copyrighted work of Artery.
* Artery authorizes customers to use, copy, and distribute the BSP
* software and its related documentation for the purpose of design and
* development in conjunction with Artery microcontrollers. Use of the
* software is governed by this copyright notice and the following disclaimer.
*
* THIS SOFTWARE IS PROVIDED ON "AS IS" BASIS WITHOUT WARRANTIES,

View File

@@ -1,17 +1,17 @@
/**
**************************************************************************
* @file at32f413_conf.h
* @version v2.0.3
* @date 2022-02-11
* @version v2.0.4
* @date 2022-04-02
* @brief at32f413 config header file
**************************************************************************
* Copyright notice & Disclaimer
*
* The software Board Support Package (BSP) that is made available to
* download from Artery official website is the copyrighted work of Artery.
* Artery authorizes customers to use, copy, and distribute the BSP
* software and its related documentation for the purpose of design and
* development in conjunction with Artery microcontrollers. Use of the
* The software Board Support Package (BSP) that is made available to
* download from Artery official website is the copyrighted work of Artery.
* Artery authorizes customers to use, copy, and distribute the BSP
* software and its related documentation for the purpose of design and
* development in conjunction with Artery microcontrollers. Use of the
* software is governed by this copyright notice and the following disclaimer.
*
* THIS SOFTWARE IS PROVIDED ON "AS IS" BASIS WITHOUT WARRANTIES,
@@ -150,7 +150,7 @@ extern "C" {
/**
* @}
*/
#ifdef __cplusplus
}
#endif

View File

@@ -1,17 +1,17 @@
/**
**************************************************************************
* @file at32f413_int.h
* @version v2.0.3
* @date 2022-02-11
* @version v2.0.4
* @date 2022-04-02
* @brief header file of main interrupt service routines.
**************************************************************************
* Copyright notice & Disclaimer
*
* The software Board Support Package (BSP) that is made available to
* download from Artery official website is the copyrighted work of Artery.
* Artery authorizes customers to use, copy, and distribute the BSP
* software and its related documentation for the purpose of design and
* development in conjunction with Artery microcontrollers. Use of the
* The software Board Support Package (BSP) that is made available to
* download from Artery official website is the copyrighted work of Artery.
* Artery authorizes customers to use, copy, and distribute the BSP
* software and its related documentation for the purpose of design and
* development in conjunction with Artery microcontrollers. Use of the
* software is governed by this copyright notice and the following disclaimer.
*
* THIS SOFTWARE IS PROVIDED ON "AS IS" BASIS WITHOUT WARRANTIES,

View File

@@ -1,8 +1,8 @@
/**
**************************************************************************
* @file readme.txt
* @version v2.0.3
* @date 2022-02-11
* @version v2.0.4
* @date 2022-04-02
* @brief readme
**************************************************************************
*/

View File

@@ -1,17 +1,17 @@
/**
**************************************************************************
* @file at32f413_clock.c
* @version v2.0.3
* @date 2022-02-11
* @version v2.0.4
* @date 2022-04-02
* @brief system clock config program
**************************************************************************
* Copyright notice & Disclaimer
*
* The software Board Support Package (BSP) that is made available to
* download from Artery official website is the copyrighted work of Artery.
* Artery authorizes customers to use, copy, and distribute the BSP
* software and its related documentation for the purpose of design and
* development in conjunction with Artery microcontrollers. Use of the
* The software Board Support Package (BSP) that is made available to
* download from Artery official website is the copyrighted work of Artery.
* Artery authorizes customers to use, copy, and distribute the BSP
* software and its related documentation for the purpose of design and
* development in conjunction with Artery microcontrollers. Use of the
* software is governed by this copyright notice and the following disclaimer.
*
* THIS SOFTWARE IS PROVIDED ON "AS IS" BASIS WITHOUT WARRANTIES,
@@ -26,7 +26,7 @@
/* includes ------------------------------------------------------------------*/
#include "at32f413_clock.h"
/**
* @brief system clock config program
* @note the system clock is configured as follow:

View File

@@ -1,17 +1,17 @@
/**
**************************************************************************
* @file at32f413_int.c
* @version v2.0.3
* @date 2022-02-11
* @version v2.0.4
* @date 2022-04-02
* @brief main interrupt service routines.
**************************************************************************
* Copyright notice & Disclaimer
*
* The software Board Support Package (BSP) that is made available to
* download from Artery official website is the copyrighted work of Artery.
* Artery authorizes customers to use, copy, and distribute the BSP
* software and its related documentation for the purpose of design and
* development in conjunction with Artery microcontrollers. Use of the
* The software Board Support Package (BSP) that is made available to
* download from Artery official website is the copyrighted work of Artery.
* Artery authorizes customers to use, copy, and distribute the BSP
* software and its related documentation for the purpose of design and
* development in conjunction with Artery microcontrollers. Use of the
* software is governed by this copyright notice and the following disclaimer.
*
* THIS SOFTWARE IS PROVIDED ON "AS IS" BASIS WITHOUT WARRANTIES,
@@ -30,7 +30,7 @@
/** @addtogroup AT32F413_periph_examples
* @{
*/
/** @addtogroup 413_USART_synchronous
* @{
*/
@@ -134,8 +134,8 @@ void SysTick_Handler(void)
/**
* @}
*/
*/
/**
* @}
*/
*/

View File

@@ -1,17 +1,17 @@
/**
**************************************************************************
* @file main.c
* @version v2.0.3
* @date 2022-02-11
* @version v2.0.4
* @date 2022-04-02
* @brief main program
**************************************************************************
* Copyright notice & Disclaimer
*
* The software Board Support Package (BSP) that is made available to
* download from Artery official website is the copyrighted work of Artery.
* Artery authorizes customers to use, copy, and distribute the BSP
* software and its related documentation for the purpose of design and
* development in conjunction with Artery microcontrollers. Use of the
* The software Board Support Package (BSP) that is made available to
* download from Artery official website is the copyrighted work of Artery.
* Artery authorizes customers to use, copy, and distribute the BSP
* software and its related documentation for the purpose of design and
* development in conjunction with Artery microcontrollers. Use of the
* software is governed by this copyright notice and the following disclaimer.
*
* THIS SOFTWARE IS PROVIDED ON "AS IS" BASIS WITHOUT WARRANTIES,
@@ -30,7 +30,7 @@
/** @addtogroup AT32F413_periph_examples
* @{
*/
/** @addtogroup 413_USART_synchronous USART_synchronous
* @{
*/
@@ -46,13 +46,13 @@ uint8_t usart2_rx_buffer[SPI2_TX_BUFFER_SIZE];
uint8_t spi2_rx_buffer[USART2_TX_BUFFER_SIZE];
uint8_t usart2_tx_counter = 0x00;
uint8_t spi2_tx_counter = 0x00;
uint8_t usart2_rx_counter = 0x00;
uint8_t usart2_rx_counter = 0x00;
uint8_t spi2_rx_counter = 0x00;
uint8_t usart2_tx_buffer_size = USART2_TX_BUFFER_SIZE;
uint8_t spi2_tx_buffer_size = SPI2_TX_BUFFER_SIZE;
/**
* @brief config usart and spi
* @brief config usart and spi
* @param none
* @retval none
*/
@@ -60,17 +60,17 @@ void usart_spi_configuration(void)
{
gpio_init_type gpio_init_struct;
spi_init_type spi_init_struct;
/* enable the usart2 and gpio clock */
crm_periph_clock_enable(CRM_USART2_PERIPH_CLOCK, TRUE);
crm_periph_clock_enable(CRM_USART2_PERIPH_CLOCK, TRUE);
crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
/* enable the spi2 and gpio clock */
crm_periph_clock_enable(CRM_SPI2_PERIPH_CLOCK, TRUE);
crm_periph_clock_enable(CRM_GPIOB_PERIPH_CLOCK, TRUE);
/* enable the spi2 and gpio clock */
crm_periph_clock_enable(CRM_SPI2_PERIPH_CLOCK, TRUE);
crm_periph_clock_enable(CRM_GPIOB_PERIPH_CLOCK, TRUE);
gpio_default_para_init(&gpio_init_struct);
/* configure the usart2 tx and ck pin */
gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
@@ -78,7 +78,7 @@ void usart_spi_configuration(void)
gpio_init_struct.gpio_pins = GPIO_PINS_2 | GPIO_PINS_4;
gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
gpio_init(GPIOA, &gpio_init_struct);
/* configure the usart2 rx pin */
gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
@@ -86,7 +86,7 @@ void usart_spi_configuration(void)
gpio_init_struct.gpio_pins = GPIO_PINS_3;
gpio_init_struct.gpio_pull = GPIO_PULL_UP;
gpio_init(GPIOA, &gpio_init_struct);
/* configure the spi2 mosi and ck pin */
gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
@@ -94,15 +94,15 @@ void usart_spi_configuration(void)
gpio_init_struct.gpio_pins = GPIO_PINS_15 | GPIO_PINS_13;
gpio_init_struct.gpio_pull = GPIO_PULL_UP;
gpio_init(GPIOB, &gpio_init_struct);
/* configure the spi2 miso 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_14;
gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
gpio_init(GPIOB, &gpio_init_struct);
gpio_init(GPIOB, &gpio_init_struct);
/* configure usart2 param */
usart_init(USART2, 115200, USART_DATA_8BITS, USART_STOP_1_BIT);
usart_clock_config(USART2, USART_CLOCK_POLARITY_HIGH, USART_CLOCK_PHASE_2EDGE, USART_CLOCK_LAST_BIT_OUTPUT);
@@ -110,7 +110,7 @@ void usart_spi_configuration(void)
usart_transmitter_enable(USART2, TRUE);
usart_receiver_enable(USART2, TRUE);
usart_enable(USART2, TRUE);
/* configure spi2 param */
spi_default_para_init(&spi_init_struct);
spi_init_struct.transmission_mode = SPI_TRANSMIT_FULL_DUPLEX;
@@ -122,7 +122,7 @@ void usart_spi_configuration(void)
spi_init_struct.cs_mode_selection = SPI_CS_SOFTWARE_MODE;
spi_init(SPI2, &spi_init_struct);
spi_enable(SPI2, TRUE);
}
}
/**
* @brief compares two buffers.
@@ -155,48 +155,48 @@ int main(void)
system_clock_config();
at32_board_init();
usart_spi_configuration();
/* wait until end of transmission from usart2 to spi2 */
while(spi2_rx_counter < usart2_tx_buffer_size)
{
/* usart transmit data */
while(usart_flag_get(USART2, USART_TDBE_FLAG) == RESET);
usart_data_transmit(USART2, usart2_tx_buffer[usart2_tx_counter++]);
/* wait until spi receive data */
while(spi_i2s_flag_get(SPI2, SPI_I2S_RDBF_FLAG) == RESET);
spi2_rx_buffer[spi2_rx_counter++] = spi_i2s_data_receive(SPI2);
/* wait until usart receive data, and clear dummy byte in data register */
while(usart_flag_get(USART2, USART_RDBF_FLAG) == RESET);
usart_data_receive(USART2);
}
/* wait until end of transmission from spi2 to usart2 */
while(usart2_rx_counter < spi2_tx_buffer_size)
{
/* spi put transmit data in data register */
while(spi_i2s_flag_get(SPI2, SPI_I2S_TDBE_FLAG) == RESET);
spi_i2s_data_transmit(SPI2, spi2_tx_buffer[spi2_tx_counter++]);
/* usart transmit a dummy byte to generate clock to slave */
while(usart_flag_get(USART2, USART_TDBE_FLAG) == RESET);
usart_data_transmit(USART2, DYMMY_BYTE);
/* wait until usart receive data */
while(usart_flag_get(USART2, USART_RDBF_FLAG) == RESET);
usart2_rx_buffer[usart2_rx_counter++] = usart_data_receive(USART2);
}
while(1)
{
/* compare data buffer */
{
/* compare data buffer */
if(buffer_compare(usart2_tx_buffer, spi2_rx_buffer, USART2_TX_BUFFER_SIZE) && \
buffer_compare(spi2_tx_buffer, usart2_rx_buffer, SPI2_TX_BUFFER_SIZE))
{
at32_led_toggle(LED2);
at32_led_toggle(LED3);
at32_led_toggle(LED4);
at32_led_toggle(LED4);
delay_sec(1);
}
}
@@ -204,8 +204,8 @@ int main(void)
/**
* @}
*/
*/
/**
* @}
*/
*/