mirror of
https://github.com/ArteryTek/AT32F415_Firmware_Library.git
synced 2026-05-21 09:22:11 +00:00
update version to v2.0.4
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
|
||||
**************************************************************************
|
||||
*/
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user