update version to v2.0.4

This commit is contained in:
Artery-MCU
2022-04-11 19:32:28 +08:00
parent 07d7347ba4
commit ccd0f1e108
1470 changed files with 213761 additions and 13939 deletions

View File

@@ -1,17 +1,17 @@
/**
**************************************************************************
* @file at32f415_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 at32f415_conf.h
* @version v2.0.3
* @date 2022-02-11
* @version v2.0.4
* @date 2022-04-02
* @brief at32f415 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,

View File

@@ -1,17 +1,17 @@
/**
**************************************************************************
* @file at32f415_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 at32f415_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,
@@ -48,8 +48,8 @@
void system_clock_config(void)
{
/* config flash psr register */
flash_psr_set(FLASH_WAIT_CYCLE_4);
flash_psr_set(FLASH_WAIT_CYCLE_4);
/* reset crm */
crm_reset();

View File

@@ -1,17 +1,17 @@
/**
**************************************************************************
* @file at32f415_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,11 +30,11 @@
/** @addtogroup AT32F415_periph_examples
* @{
*/
/** @addtogroup 415_ERTC_bpr_domain
* @{
*/
/**
* @brief this function handles nmi exception.
* @param none

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 AT32F415_periph_examples
* @{
*/
/** @addtogroup 415_ERTC_bpr_domain ERTC_bpr_domain
* @{
*/
@@ -39,8 +39,8 @@
ertc_dt_type bpr_addr_tab[ERTC_BPR_DT_NUMBER] =
{
ERTC_DT1, ERTC_DT2, ERTC_DT3, ERTC_DT4, ERTC_DT5,
ERTC_DT6, ERTC_DT7, ERTC_DT8, ERTC_DT9, ERTC_DT10,
ERTC_DT1, ERTC_DT2, ERTC_DT3, ERTC_DT4, ERTC_DT5,
ERTC_DT6, ERTC_DT7, ERTC_DT8, ERTC_DT9, ERTC_DT10,
ERTC_DT11, ERTC_DT12, ERTC_DT13, ERTC_DT14, ERTC_DT15,
ERTC_DT16, ERTC_DT17, ERTC_DT18, ERTC_DT19, ERTC_DT20
};
@@ -56,20 +56,20 @@ uint32_t bpr_reg_check(void);
*/
int main(void)
{
uint32_t temp = 0;
ertc_time_type time;
/* initial system clock */
system_clock_config();
/* initial the nvic priority group */
uint32_t temp = 0;
ertc_time_type time;
/* initial system clock */
system_clock_config();
/* initial the nvic priority group */
nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
/* initialize uart */
uart_print_init(115200);
printf("\r\nertc bpr domain example\r\n\r\n");
/* enable the pwc clock interface */
crm_periph_clock_enable(CRM_PWC_PERIPH_CLOCK, TRUE);
@@ -80,9 +80,9 @@ int main(void)
if(bpr_reg_check() == FALSE)
{
printf("bpr reg => reset\r\n\r\n");
/* ertc configuration */
ertc_config();
ertc_config();
/* write to ertc bpr data registers */
bpr_reg_write();
@@ -90,23 +90,23 @@ int main(void)
else
{
printf("bpr reg => none reset\r\n\r\n");
/* wait for ertc registers update */
ertc_wait_update();
}
while(1)
{
/* get the current time */
ertc_calendar_get(&time);
if(temp != time.sec)
{
temp = time.sec;
/* display date format : year-month-day */
printf("%02d-%02d-%02d ",time.year, time.month, time.day);
printf("%02d-%02d-%02d ",time.year, time.month, time.day);
/* display time format : hour:min:sec */
printf("%02d:%02d:%02d\r\n",time.hour, time.min, time.sec);
}
@@ -122,7 +122,7 @@ void ertc_config(void)
{
/* allow access to ertc */
pwc_battery_powered_domain_access(TRUE);
/* reset ertc domain */
crm_battery_powered_domain_reset(TRUE);
crm_battery_powered_domain_reset(FALSE);
@@ -150,15 +150,15 @@ void ertc_config(void)
/* configure the ertc divider */
/* ertc second(1hz) = ertc_clk / (div_a + 1) * (div_b + 1) */
ertc_divider_set(127, 255);
/* configure the ertc hour mode */
ertc_hour_mode_set(ERTC_HOUR_MODE_24);
/* set date: 2021-05-01 */
ertc_date_set(21, 5, 1, 5);
/* set time: 12:00:00 */
ertc_time_set(12, 0, 0, ERTC_AM);
ertc_time_set(12, 0, 0, ERTC_AM);
}
/**

View File

@@ -1,17 +1,17 @@
/**
**************************************************************************
* @file at32f415_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 at32f415_conf.h
* @version v2.0.3
* @date 2022-02-11
* @version v2.0.4
* @date 2022-04-02
* @brief at32f415 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,

View File

@@ -1,17 +1,17 @@
/**
**************************************************************************
* @file at32f415_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 at32f415_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,
@@ -48,8 +48,8 @@
void system_clock_config(void)
{
/* config flash psr register */
flash_psr_set(FLASH_WAIT_CYCLE_4);
flash_psr_set(FLASH_WAIT_CYCLE_4);
/* reset crm */
crm_reset();

View File

@@ -1,17 +1,17 @@
/**
**************************************************************************
* @file at32f415_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,
@@ -31,11 +31,11 @@
/** @addtogroup AT32F415_periph_examples
* @{
*/
/** @addtogroup 415_ERTC_calendar
* @{
*/
extern void ertc_alarm_show(void);
/**
@@ -146,15 +146,15 @@ void ERTCAlarm_IRQHandler(void)
{
/* display the alarm */
ertc_alarm_show();
at32_led_on(LED2);
/* clear alarm flag */
ertc_flag_clear(ERTC_ALAF_FLAG);
/* clear exint flag */
exint_flag_clear(EXINT_LINE_17);
}
}
}
/**

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,14 +30,14 @@
/** @addtogroup AT32F415_periph_examples
* @{
*/
/** @addtogroup 415_ERTC_calendar ERTC_calendar
* @{
*/
/* select the ertc clock source */
#define ERTC_CLOCK_SOURCE_LEXT /* select lext as the ertc clock */
//#define ERTC_CLOCK_SOURCE_LICK /* select lick as the ertc clock */
//#define ERTC_CLOCK_SOURCE_LICK /* select lick as the ertc clock */
__IO uint16_t ertc_clk_div_a = 0;
__IO uint16_t ertc_clk_div_b = 0;
@@ -56,13 +56,13 @@ int main(void)
exint_init_type exint_init_struct;
ertc_time_type time;
uint32_t temp = 0;
/* initial system clock */
system_clock_config();
/* initial the nvic priority group */
/* initial system clock */
system_clock_config();
/* initial the nvic priority group */
nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
/* at board initial */
at32_board_init();
@@ -73,21 +73,21 @@ int main(void)
crm_periph_clock_enable(CRM_PWC_PERIPH_CLOCK, TRUE);
/* allow access to ertc */
pwc_battery_powered_domain_access(TRUE);
pwc_battery_powered_domain_access(TRUE);
if (ertc_bpr_data_read(ERTC_DT1) != 0x1234)
{
/* printf ertc status */
printf("ertc has not been initialized\r\n\r\n");
printf("ertc has not been initialized\r\n\r\n");
/* ertc configuration */
ertc_config();
}
else
{
/* printf ertc status */
printf("ertc has been initialized\r\n\r\n");
printf("ertc has been initialized\r\n\r\n");
/* wait for ertc registers update */
ertc_wait_update();
@@ -102,8 +102,8 @@ int main(void)
ertc_time_show();
ertc_alarm_show();
printf("\r\n");
printf("\r\n");
/* ertc alarm interrupt configuration */
exint_default_para_init(&exint_init_struct);
exint_init_struct.line_enable = TRUE;
@@ -111,7 +111,7 @@ int main(void)
exint_init_struct.line_select = EXINT_LINE_17;
exint_init_struct.line_polarity = EXINT_TRIGGER_RISING_EDGE;
exint_init(&exint_init_struct);
/* enable the ertc interrupt */
nvic_irq_enable(ERTCAlarm_IRQn, 0, 1);
@@ -119,17 +119,17 @@ int main(void)
{
/* get the current time */
ertc_calendar_get(&time);
if(temp != time.sec)
{
temp = time.sec;
/* wait for the alarm interrupt print the information */
delay_us(40);
/* display date format : year-month-day */
printf("%02d-%02d-%02d ",time.year, time.month, time.day);
printf("%02d-%02d-%02d ",time.year, time.month, time.day);
/* display time format : hour:min:sec */
printf("%02d:%02d:%02d\r\n",time.hour, time.min, time.sec);
}
@@ -145,14 +145,14 @@ void ertc_config(void)
{
/* enable the pwc clock interface */
crm_periph_clock_enable(CRM_PWC_PERIPH_CLOCK, TRUE);
/* allow access to ertc */
pwc_battery_powered_domain_access(TRUE);
/* reset ertc domain */
crm_battery_powered_domain_reset(TRUE);
crm_battery_powered_domain_reset(FALSE);
#if defined (ERTC_CLOCK_SOURCE_LICK)
/* enable the lick osc */
crm_clock_source_enable(CRM_CLOCK_SOURCE_LICK, TRUE);
@@ -164,7 +164,7 @@ void ertc_config(void)
/* select the ertc clock source */
crm_ertc_clock_select(CRM_ERTC_CLOCK_LICK);
/* ertc second(1hz) = ertc_clk(lick) / (ertc_clk_div_a + 1) * (ertc_clk_div_b + 1) */
ertc_clk_div_b = 255;
ertc_clk_div_a = 127;
@@ -193,32 +193,32 @@ void ertc_config(void)
/* wait for ertc registers update */
ertc_wait_update();
/* configure the ertc divider */
ertc_divider_set(ertc_clk_div_a, ertc_clk_div_b);
/* configure the ertc hour mode */
ertc_hour_mode_set(ERTC_HOUR_MODE_24);
/* set date: 2021-05-01 */
ertc_date_set(21, 5, 1, 5);
/* set time: 12:00:00 */
ertc_time_set(12, 0, 0, ERTC_AM);
ertc_time_set(12, 0, 0, ERTC_AM);
/* set the alarm 12:00:10 */
ertc_alarm_mask_set(ERTC_ALA, ERTC_ALARM_MASK_DATE_WEEK);
ertc_alarm_week_date_select(ERTC_ALA, ERTC_SLECT_DATE);
ertc_alarm_set(ERTC_ALA, 1, 12, 0, 10, ERTC_AM);
/* enable ertc alarm a interrupt */
ertc_interrupt_enable(ERTC_ALA_INT, TRUE);
/* enable the alarm */
ertc_alarm_enable(ERTC_ALA, TRUE);
ertc_flag_clear(ERTC_ALAF_FLAG);
/* indicator for the ertc configuration */
ertc_bpr_data_write(ERTC_DT1, 0x1234);
}
@@ -231,13 +231,13 @@ void ertc_config(void)
void ertc_time_show(void)
{
ertc_time_type time;
/* get the current time */
ertc_calendar_get(&time);
/* display date format : year-month-day */
printf("Time: %02d-%02d-%02d ",time.year, time.month, time.day);
printf("Time: %02d-%02d-%02d ",time.year, time.month, time.day);
/* display time format : hour:min:sec */
printf("%02d:%02d:%02d\r\n",time.hour, time.min, time.sec);
}
@@ -250,10 +250,10 @@ void ertc_time_show(void)
void ertc_alarm_show(void)
{
ertc_alarm_value_type alarm;
/* get the current alarm */
ertc_alarm_get(ERTC_ALA, &alarm);
/* display alarm format : hour:min:sec */
printf("Alarm: %02d:%02d:%02d\r\n",alarm.hour, alarm.min, alarm.sec);
}

View File

@@ -1,17 +1,17 @@
/**
**************************************************************************
* @file at32f415_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 at32f415_conf.h
* @version v2.0.3
* @date 2022-02-11
* @version v2.0.4
* @date 2022-04-02
* @brief at32f415 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,

View File

@@ -1,17 +1,17 @@
/**
**************************************************************************
* @file at32f415_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 at32f415_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,
@@ -48,8 +48,8 @@
void system_clock_config(void)
{
/* config flash psr register */
flash_psr_set(FLASH_WAIT_CYCLE_4);
flash_psr_set(FLASH_WAIT_CYCLE_4);
/* reset crm */
crm_reset();

View File

@@ -1,17 +1,17 @@
/**
**************************************************************************
* @file at32f415_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,
@@ -32,11 +32,11 @@
/** @addtogroup AT32F415_periph_examples
* @{
*/
/** @addtogroup 415_ERTC_lick_calibration
* @{
*/
extern __IO uint32_t period_value;
extern __IO uint32_t capture_number;
uint16_t tmp_c4[2] = {0, 0};
@@ -149,7 +149,7 @@ void TMR5_GLOBAL_IRQHandler(void)
{
/* get the input capture value */
tmp_c4[capture_number++] = tmr_channel_value_get(TMR5, TMR_SELECT_CHANNEL_4);
/* clear c4 interrupt pending bit */
tmr_flag_clear(TMR5, TMR_C4_FLAG);

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,13 +30,13 @@
/** @addtogroup AT32F415_periph_examples
* @{
*/
/** @addtogroup 415_ERTC_lick_calibration ERTC_lick_calibration
* @{
*/
__IO uint32_t lick_freq = 0;
__IO uint32_t capture_number = 0;
__IO uint32_t capture_number = 0;
__IO uint32_t period_value = 0;
void ertc_config(void);
@@ -51,25 +51,25 @@ int main(void)
{
ertc_time_type time;
uint32_t temp = 0;
/* initial system clock */
system_clock_config();
/* initial the nvic priority group */
/* initial system clock */
system_clock_config();
/* initial the nvic priority group */
nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
/* at board initial */
at32_board_init();
/* initialize uart */
uart_print_init(115200);
/* ertc configuration */
ertc_config();
/* get the lick frequency: tmr5 is used to measure the lick frequency */
lick_freq = lick_frequency_get();
/* configure the ertc divider */
/* ertc second(1hz) = ertc_clk(lick) / (div_a + 1) * (div_b + 1) */
ertc_divider_set(127, (lick_freq / 128) - 1);
@@ -78,19 +78,19 @@ int main(void)
printf("div_a = %d\r\n", 127);
printf("div_b = %d\r\n", (lick_freq / 128) - 1);
printf("\r\n");
while(1)
{
/* get the current time */
ertc_calendar_get(&time);
if(temp != time.sec)
{
temp = time.sec;
/* display date format : year-month-day */
printf("%02d-%02d-%02d ",time.year, time.month, time.day);
printf("%02d-%02d-%02d ",time.year, time.month, time.day);
/* display time format : hour:min:sec */
printf("%02d:%02d:%02d\r\n",time.hour, time.min, time.sec);
}
@@ -109,46 +109,46 @@ void ertc_config(void)
/* allow access to ertc */
pwc_battery_powered_domain_access(TRUE);
/* reset ertc domain */
crm_battery_powered_domain_reset(TRUE);
crm_battery_powered_domain_reset(FALSE);
/* enable the lick osc */
crm_clock_source_enable(CRM_CLOCK_SOURCE_LICK, TRUE);
/* wait till lick is ready */
/* wait till lick is ready */
while(crm_flag_get(CRM_LICK_STABLE_FLAG) == RESET)
{
}
/* select the ertc clock source */
crm_ertc_clock_select(CRM_ERTC_CLOCK_LICK);
/* enable the ertc clock */
crm_ertc_clock_enable(TRUE);
/* deinitializes the ertc registers */
ertc_reset();
/* deinitializes the ertc registers */
ertc_reset();
/* wait for ertc apb registers update */
ertc_wait_update();
/* configure the ertc divider */
ertc_divider_set(0x7F, 0xFF);
/* configure the ertc hour mode */
ertc_hour_mode_set(ERTC_HOUR_MODE_24);
ertc_hour_mode_set(ERTC_HOUR_MODE_24);
/* set date: 2021-05-01 */
ertc_date_set(21, 5, 1, 5);
/* set time: 12:00:00 */
ertc_time_set(12, 0, 0, ERTC_AM);
ertc_time_set(12, 0, 0, ERTC_AM);
}
/**
* @brief configures tmr5 to measure the lick oscillator frequency.
* @brief configures tmr5 to measure the lick oscillator frequency.
* @param none
* @retval lick frequency
*/
@@ -160,14 +160,14 @@ uint32_t lick_frequency_get(void)
/* enable tmr5 apb1 clocks */
crm_periph_clock_enable(CRM_TMR5_PERIPH_CLOCK, TRUE);
crm_periph_clock_enable(CRM_IOMUX_PERIPH_CLOCK, TRUE);
/* connect internally the tmr5_ch4 to the lick clock output */
gpio_pin_remap_config(TMR5CH4_MUX, TRUE);
gpio_pin_remap_config(TMR5CH4_MUX, TRUE);
/* configure tmr5 divider */
tmr_div_value_set(TMR5, 0);
tmr_event_sw_trigger(TMR5, TMR_OVERFLOW_SWTRIG);
/* tmr5 channel4 input capture mode configuration */
tmr_input_config_struct.input_channel_select = TMR_SELECT_CHANNEL_4;
tmr_input_config_struct.input_mapped_select = TMR_CC_CHANNEL_MAPPED_DIRECT;
@@ -175,7 +175,7 @@ uint32_t lick_frequency_get(void)
tmr_input_config_struct.input_filter_value = 0;
tmr_input_channel_init(TMR5, &tmr_input_config_struct, TMR_CHANNEL_INPUT_DIV_1);
tmr_input_channel_divider_set(TMR5, TMR_SELECT_CHANNEL_4, TMR_CHANNEL_INPUT_DIV_8);
/* enable tmr5 interrupt channel */
nvic_irq_enable(TMR5_GLOBAL_IRQn, 0, 0);
@@ -184,13 +184,13 @@ uint32_t lick_frequency_get(void)
/* reset the flags */
TMR5->swevt = 0;
/* enable the cc4 interrupt request */
/* enable the cc4 interrupt request */
tmr_interrupt_enable(TMR5, TMR_C4_INT, TRUE);
/* wait the tmr5 measuring operation to be completed */
while(capture_number != 2);
/* deinitialize the tmr5 peripheral */
tmr_reset(TMR5);
@@ -201,7 +201,7 @@ uint32_t lick_frequency_get(void)
if ((CRM->cfg_bit.apb1div) > 0)
{
/* pclk1 divider different from 1 => timclk = 2 * pclk1 */
return (((2 * crm_clock_freq.apb1_freq) / period_value) * 8) ;
return (((2 * crm_clock_freq.apb1_freq) / period_value) * 8) ;
}
else
{

View File

@@ -1,17 +1,17 @@
/**
**************************************************************************
* @file at32f415_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 at32f415_conf.h
* @version v2.0.3
* @date 2022-02-11
* @version v2.0.4
* @date 2022-04-02
* @brief at32f415 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,

View File

@@ -1,17 +1,17 @@
/**
**************************************************************************
* @file at32f415_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 at32f415_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,
@@ -48,8 +48,8 @@
void system_clock_config(void)
{
/* config flash psr register */
flash_psr_set(FLASH_WAIT_CYCLE_4);
flash_psr_set(FLASH_WAIT_CYCLE_4);
/* reset crm */
crm_reset();

View File

@@ -1,17 +1,17 @@
/**
**************************************************************************
* @file at32f415_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,
@@ -32,11 +32,11 @@
/** @addtogroup AT32F415_periph_examples
* @{
*/
/** @addtogroup 415_ERTC_tamper
* @{
*/
extern uint32_t is_bpr_reg_reset(void);
/**
@@ -144,7 +144,7 @@ void SysTick_Handler(void)
void TAMP_STAMP_IRQHandler(void)
{
if(ertc_flag_get(ERTC_TP1F_FLAG) != RESET)
{
{
/* check if ertc backup data registers are cleared */
if(is_bpr_reg_reset() == 0)
{
@@ -154,12 +154,12 @@ void TAMP_STAMP_IRQHandler(void)
{
printf("tamper: bpr data registers are not reset\r\n");
}
/* clear tamper 1 pin event pending flag */
ertc_flag_clear(ERTC_TP1F_FLAG);
/* clear exint flag */
exint_flag_clear(EXINT_LINE_21);
exint_flag_clear(EXINT_LINE_21);
}
}

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,12 +30,12 @@
/** @addtogroup AT32F415_periph_examples
* @{
*/
/** @addtogroup 415_ERTC_tamper ERTC_tamper
* @{
*/
#define ERTC_BPR_DT_NUMBER 20
#define ERTC_BPR_DT_NUMBER 20
ertc_dt_type bpr_addr_tab[ERTC_BPR_DT_NUMBER] =
{
@@ -58,37 +58,37 @@ void ertc_tamper_config(void);
*/
int main(void)
{
/* initial system clock */
system_clock_config();
/* initial the nvic priority group */
/* initial system clock */
system_clock_config();
/* initial the nvic priority group */
nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
/* at board initial */
at32_board_init();
/* initialize uart */
uart_print_init(115200);
/* ertc configuration */
ertc_config();
/* ertc tamper configuration */
ertc_tamper_config();
/* write to ertc bpr data registers */
bpr_reg_write();
/* check if the written data are correct */
if(bpr_reg_check() == TRUE)
{
printf("init: bpr data registers are not reset\r\n");
printf("init: bpr data registers are not reset\r\n");
}
else
{
printf("init: bpr data registers are cleared\r\n");
}
while(1)
{
}
@@ -121,28 +121,28 @@ void ertc_config(void)
/* select the ertc clock source */
crm_ertc_clock_select(CRM_ERTC_CLOCK_LEXT);
/* enable the ertc clock */
crm_ertc_clock_enable(TRUE);
/* deinitializes the ertc registers */
ertc_reset();
/* deinitializes the ertc registers */
ertc_reset();
/* wait for ertc apb registers update */
ertc_wait_update();
/* configure the ertc divider */
/* ertc second(1hz) = ertc_clk / (div_a + 1) * (div_b + 1) */
ertc_divider_set(127, 255);
/* configure the ertc hour mode */
ertc_hour_mode_set(ERTC_HOUR_MODE_24);
ertc_hour_mode_set(ERTC_HOUR_MODE_24);
/* set date: 2021-05-01 */
ertc_date_set(21, 5, 1, 5);
/* set time: 12:00:00 */
ertc_time_set(12, 0, 0, ERTC_AM);
ertc_time_set(12, 0, 0, ERTC_AM);
}
/**

View File

@@ -1,17 +1,17 @@
/**
**************************************************************************
* @file at32f415_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 at32f415_conf.h
* @version v2.0.3
* @date 2022-02-11
* @version v2.0.4
* @date 2022-04-02
* @brief at32f415 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,

View File

@@ -1,17 +1,17 @@
/**
**************************************************************************
* @file at32f415_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 at32f415_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,
@@ -48,8 +48,8 @@
void system_clock_config(void)
{
/* config flash psr register */
flash_psr_set(FLASH_WAIT_CYCLE_4);
flash_psr_set(FLASH_WAIT_CYCLE_4);
/* reset crm */
crm_reset();

View File

@@ -1,17 +1,17 @@
/**
**************************************************************************
* @file at32f415_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,
@@ -32,11 +32,11 @@
/** @addtogroup AT32F415_periph_examples
* @{
*/
/** @addtogroup 415_ERTC_time_stamp
* @{
*/
extern void ertc_time_show(void);
extern void ertc_timestamp_show(void);
@@ -143,20 +143,20 @@ void SysTick_Handler(void)
* @retval none
*/
void TAMP_STAMP_IRQHandler(void)
{
{
if(ertc_flag_get(ERTC_TSF_FLAG))
{
/* display the timestamp */
ertc_timestamp_show();
/* display the date / time */
ertc_time_show();
/* clear exint flag */
exint_flag_clear(EXINT_LINE_21);
/* clear timestamp flag */
ertc_flag_clear(ERTC_TSF_FLAG);
ertc_flag_clear(ERTC_TSF_FLAG);
}
}

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 AT32F415_periph_examples
* @{
*/
/** @addtogroup 415_ERTC_time_stamp ERTC_time_stamp
* @{
*/
@@ -47,30 +47,30 @@ void ertc_timestamp_config(void);
*/
int main(void)
{
/* initial system clock */
system_clock_config();
/* initial the nvic priority group */
/* initial system clock */
system_clock_config();
/* initial the nvic priority group */
nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
/* at board initial */
at32_board_init();
/* initialize uart */
uart_print_init(115200);
/* ertc configuration */
ertc_config();
/* configure the timestamp register */
ertc_timestamp_config();
/* display the date and time */
/* display the date and time */
ertc_time_show();
while(1)
{
}
}
@@ -107,22 +107,22 @@ void ertc_config(void)
/* deinitializes the ertc registers */
ertc_reset();
/* wait for ertc apb registers update */
ertc_wait_update();
/* configure the ertc divider */
/* ertc second(1hz) = ertc_clk / (div_a + 1) * (div_b + 1) */
ertc_divider_set(127, 255);
/* configure the ertc hour mode */
ertc_hour_mode_set(ERTC_HOUR_MODE_24);
/* set date: 2021-05-01 */
ertc_date_set(21, 5, 1, 5);
/* set time: 12:00:00 */
ertc_time_set(12, 0, 0, ERTC_AM);
ertc_time_set(12, 0, 0, ERTC_AM);
}
/**
@@ -133,24 +133,24 @@ void ertc_config(void)
void ertc_timestamp_config(void)
{
exint_init_type exint_init_struct;
/* configure nvic */
nvic_irq_enable(TAMP_STAMP_IRQn, 0, 0);
/* configure exint */
/* configure exint */
exint_default_para_init(&exint_init_struct);
exint_init_struct.line_enable = TRUE;
exint_init_struct.line_mode = EXINT_LINE_INTERRUPUT;
exint_init_struct.line_select = EXINT_LINE_21;
exint_init_struct.line_polarity = EXINT_TRIGGER_RISING_EDGE;
exint_init(&exint_init_struct);
/* enable the timestamp */
ertc_timestamp_valid_edge_set(ERTC_TIMESTAMP_EDGE_FALLING);
ertc_timestamp_enable(TRUE);
/* enable the timestamp int */
ertc_interrupt_enable(ERTC_TS_INT, TRUE);
/* enable the timestamp int */
ertc_interrupt_enable(ERTC_TS_INT, TRUE);
}
/**
@@ -161,16 +161,16 @@ void ertc_timestamp_config(void)
void ertc_time_show(void)
{
ertc_time_type time;
/* get the current time */
ertc_calendar_get(&time);
/* display the curent time */
printf("current time: ");
/* display the curent time */
printf("current time: ");
/* display date format : year-month-day */
printf("%02d-%02d-%02d ",time.year, time.month, time.day);
printf("%02d-%02d-%02d ",time.year, time.month, time.day);
/* display time format : hour:min:sec */
printf("%02d:%02d:%02d\r\n\r\n",time.hour, time.min, time.sec);
}
@@ -183,18 +183,18 @@ void ertc_time_show(void)
void ertc_timestamp_show(void)
{
ertc_time_type time;
/* get the current timestamp */
ertc_timestamp_get(&time);
/* display the current timestamp */
printf("timestamp: ");
/* display date format : month-day */
printf(" %02d-%02d ", time.month, time.day);
printf(" %02d-%02d ", time.month, time.day);
/* display time format : hour:min:sec */
printf("%02d:%02d:%02d\r\n", time.hour, time.min, time.sec);
printf("%02d:%02d:%02d\r\n", time.hour, time.min, time.sec);
}
/**

View File

@@ -1,17 +1,17 @@
/**
**************************************************************************
* @file at32f415_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 at32f415_conf.h
* @version v2.0.3
* @date 2022-02-11
* @version v2.0.4
* @date 2022-04-02
* @brief at32f415 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,

View File

@@ -1,17 +1,17 @@
/**
**************************************************************************
* @file at32f415_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 at32f415_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,
@@ -48,8 +48,8 @@
void system_clock_config(void)
{
/* config flash psr register */
flash_psr_set(FLASH_WAIT_CYCLE_4);
flash_psr_set(FLASH_WAIT_CYCLE_4);
/* reset crm */
crm_reset();

View File

@@ -1,17 +1,17 @@
/**
**************************************************************************
* @file at32f415_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,
@@ -32,11 +32,11 @@
/** @addtogroup AT32F415_periph_examples
* @{
*/
/** @addtogroup 415_ERTC_wakeup_timer
* @{
*/
extern void ertc_wakeup_show(void);
/**
@@ -146,15 +146,15 @@ void ERTC_WKUP_IRQHandler(void)
if(ertc_flag_get(ERTC_WATF_FLAG) != RESET)
{
printf("wakeup\r\n");
at32_led_on(LED2);
/* clear wakeup timer flag */
ertc_flag_clear(ERTC_WATF_FLAG);
/* clear exint flag */
exint_flag_clear(EXINT_LINE_22);
}
}
}
/**

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 AT32F415_periph_examples
* @{
*/
/** @addtogroup 415_ERTC_wakeup_timer ERTC_wakeup_timer
* @{
*/
@@ -47,13 +47,13 @@ int main(void)
{
ertc_time_type time;
uint32_t temp = 0;
/* initial system clock */
system_clock_config();
/* initial the nvic priority group */
/* initial system clock */
system_clock_config();
/* initial the nvic priority group */
nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
/* at board initial */
at32_board_init();
@@ -62,22 +62,22 @@ int main(void)
/* ertc configuration */
ertc_config();
/* ertc wakeup timer configuration */
wakeup_timer_config();
while(1)
{
/* get the current time */
ertc_calendar_get(&time);
if(temp != time.sec)
{
temp = time.sec;
/* display date format : year-month-day */
printf("%02d-%02d-%02d ",time.year, time.month, time.day);
printf("%02d-%02d-%02d ",time.year, time.month, time.day);
/* display time format : hour:min:sec */
printf("%02d:%02d:%02d\r\n",time.hour, time.min, time.sec);
}
@@ -93,14 +93,14 @@ void ertc_config(void)
{
/* enable the pwc clock interface */
crm_periph_clock_enable(CRM_PWC_PERIPH_CLOCK, TRUE);
/* allow access to ertc */
pwc_battery_powered_domain_access(TRUE);
/* reset ertc domain */
crm_battery_powered_domain_reset(TRUE);
crm_battery_powered_domain_reset(FALSE);
/* enable the lext osc */
crm_clock_source_enable(CRM_CLOCK_SOURCE_LEXT, TRUE);
@@ -120,19 +120,19 @@ void ertc_config(void)
/* wait for ertc apb registers update */
ertc_wait_update();
/* configure the ertc divider */
/* ertc second(1hz) = ertc_clk / (div_a + 1) * (div_b + 1) */
ertc_divider_set(127, 255);
/* configure the ertc hour mode */
ertc_hour_mode_set(ERTC_HOUR_MODE_24);
/* set date: 2021-05-01 */
ertc_date_set(21, 5, 1, 5);
/* set time: 12:00:00 */
ertc_time_set(12, 0, 0, ERTC_AM);
ertc_time_set(12, 0, 0, ERTC_AM);
}
@@ -144,7 +144,7 @@ void ertc_config(void)
void wakeup_timer_config(void)
{
exint_init_type exint_init_struct;
/* select the wakeup timer clock source */
ertc_wakeup_clock_set(ERTC_WAT_CLK_CK_A_16BITS);
@@ -153,10 +153,10 @@ void wakeup_timer_config(void)
/* enable ertc wakeup timer interrupt */
ertc_interrupt_enable(ERTC_WAT_INT, TRUE);
/* enable the wakeup timer */
ertc_wakeup_enable(TRUE);
/* ertc wakeup timer interrupt configuration */
/* exint configuration */
exint_default_para_init(&exint_init_struct);
@@ -165,7 +165,7 @@ void wakeup_timer_config(void)
exint_init_struct.line_select = EXINT_LINE_22;
exint_init_struct.line_polarity = EXINT_TRIGGER_RISING_EDGE;
exint_init(&exint_init_struct);
/* enable the ertc interrupt */
nvic_irq_enable(ERTC_WKUP_IRQn, 0, 1);
}