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,
@@ -32,12 +32,12 @@
/** @addtogroup AT32F415_periph_examples
* @{
*/
/** @addtogroup 415_PWC_deepsleep_ertc_alarm
* @{
*/
/**
* @brief this function handles nmi exception.
* @param none
@@ -146,10 +146,10 @@ void ERTCAlarm_IRQHandler(void)
{
/* clear ertc alarm flag */
ertc_flag_clear(ERTC_ALAF_FLAG);
/* clear exint line flag */
exint_flag_clear(EXINT_LINE_17);
/* toggle led */
at32_led_toggle(LED4);
}
@@ -157,8 +157,8 @@ void ERTCAlarm_IRQHandler(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,
@@ -32,11 +32,11 @@
/** @addtogroup AT32F415_periph_examples
* @{
*/
/** @addtogroup 415_PWC_deepsleep_ertc_alarm PWC_deepsleep_ertc_alarm
* @{
*/
/**
* @brief ertc configuration.
* @param none
@@ -50,7 +50,7 @@ void ertc_config(void)
/* 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);
@@ -68,19 +68,19 @@ void ertc_config(void)
/* wait for ertc apb registers synchronisation */
ertc_wait_update();
/* configure the ertc data register and ertc prescaler
/* configure the ertc data register and ertc prescaler
ck_spre(1hz) = ertcclk(lext) /(ertc_clk_div_a + 1)*(ertc_clk_div_b + 1)*/
ertc_divider_set(127, 255);
/* configure the hour format is 24-hour format*/
ertc_hour_mode_set(ERTC_HOUR_MODE_24);
/* set the date: friday june 11th 2021 */
ertc_date_set(21, 6, 11, 5);
/* set the time to 06h 20mn 00s am */
ertc_time_set(6, 20, 0, ERTC_AM);
ertc_time_set(6, 20, 0, ERTC_AM);
}
/**
@@ -98,18 +98,18 @@ void ertc_alarm_config(void)
exint_init_struct.line_mode = EXINT_LINE_INTERRUPUT;
exint_init_struct.line_polarity = EXINT_TRIGGER_RISING_EDGE;
exint_init(&exint_init_struct);
/* set the alarm 05h:20min:10s */
ertc_alarm_mask_set(ERTC_ALA, ERTC_ALARM_MASK_DATE_WEEK | ERTC_ALARM_MASK_HOUR | ERTC_ALARM_MASK_MIN);
ertc_alarm_week_date_select(ERTC_ALA, ERTC_SLECT_DATE);
ertc_alarm_set(ERTC_ALA, 31, 6, 20, 5, ERTC_AM);
/* enable the ertc interrupt */
nvic_irq_enable(ERTCAlarm_IRQn, 0, 0);
/* enable ertc alarm a interrupt */
ertc_interrupt_enable(ERTC_ALA_INT, TRUE);
/* enable the alarm */
ertc_alarm_enable(ERTC_ALA, TRUE);
}
@@ -122,12 +122,12 @@ void ertc_alarm_config(void)
void ertc_alarm_value_set(uint32_t alam_index)
{
ertc_time_type ertc_time_struct;
/* disable the alarm */
ertc_alarm_enable(ERTC_ALA, FALSE);
ertc_calendar_get(&ertc_time_struct);
ertc_alarm_set(ERTC_ALA, ertc_time_struct.day, ertc_time_struct.hour, ertc_time_struct.min, (ertc_time_struct.sec + alam_index)% 60, ertc_time_struct.ampm);
/* disable the alarm */
ertc_alarm_enable(ERTC_ALA, TRUE);
}
@@ -141,25 +141,25 @@ void system_clock_recover(void)
{
/* enable external high-speed crystal oscillator - hext */
crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
/* wait till hext is ready */
while(crm_hext_stable_wait() == ERROR);
/* enable pll */
crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
/* wait till pll is ready */
while(crm_flag_get(CRM_PLL_STABLE_FLAG) == RESET);
/* enable auto step mode */
crm_auto_step_mode_enable(TRUE);
/* select pll as system clock source */
crm_sysclk_switch(CRM_SCLK_PLL);
/* wait till pll is used as system clock source */
while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL);
/* disable auto step mode */
crm_auto_step_mode_enable(FALSE);
}
@@ -173,71 +173,71 @@ int main(void)
{
__IO uint32_t delay_index = 0;
__IO uint32_t systick_index = 0;
/* congfig the system clock */
system_clock_config();
system_clock_config();
/* init at start board */
at32_board_init();
/* config priority group */
at32_board_init();
/* config priority group */
nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
/* turn on the led light */
/* turn on the led light */
at32_led_on(LED2);
at32_led_on(LED3);
at32_led_on(LED4);
/* enable pwc and bpr clock */
crm_periph_clock_enable(CRM_PWC_PERIPH_CLOCK, TRUE);
/* config ertc */
ertc_config();
/* set the wakeup time: 06h:20min:5s */
ertc_alarm_config();
while(1)
{
at32_led_off(LED2);
/* save systick register configuration */
systick_index = SysTick->CTRL;
systick_index &= ~((uint32_t)0xFFFFFFFE);
/* disable systick */
SysTick->CTRL &= (uint32_t)0xFFFFFFFE;
ertc_alarm_value_set(1);
/* congfig the voltage regulator mode */
pwc_voltage_regulate_set(PWC_REGULATOR_LOW_POWER);
/* enter deep sleep mode */
pwc_deep_sleep_mode_enter(PWC_DEEP_SLEEP_ENTER_WFI);
/* restore systick register configuration */
SysTick->CTRL |= systick_index;
at32_led_on(LED2);
/* wait clock stable */
/* wait clock stable */
for(delay_index = 0; delay_index < 600; delay_index++)
{
__NOP();
}
/* wake up from deep sleep mode, congfig the system clock */
system_clock_recover();
delay_ms(500);
}
}
/**
* @}
*/
*/
/**
* @}
*/
*/

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,12 +32,12 @@
/** @addtogroup AT32F415_periph_examples
* @{
*/
/** @addtogroup 415_PWC_deepsleep_ertc_tamper
* @{
*/
/**
* @brief this function handles nmi exception.
* @param none
@@ -146,10 +146,10 @@ void TAMP_STAMP_IRQHandler(void)
{
/* clear ertc alarm flag */
ertc_flag_clear(ERTC_TP1F_FLAG);
/* clear exint line flag */
exint_flag_clear(EXINT_LINE_21);
/* toggle led */
at32_led_toggle(LED4);
}
@@ -157,8 +157,8 @@ void TAMP_STAMP_IRQHandler(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,
@@ -32,11 +32,11 @@
/** @addtogroup AT32F415_periph_examples
* @{
*/
/** @addtogroup 415_PWC_deepsleep_ertc_tamper PWC_deepsleep_ertc_tamper
* @{
*/
/**
* @brief ertc configuration.
* @param none
@@ -50,7 +50,7 @@ void ertc_config(void)
/* 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);
@@ -82,7 +82,7 @@ void ertc_tamper_config(void)
exint_init_struct.line_mode = EXINT_LINE_INTERRUPUT;
exint_init_struct.line_polarity = EXINT_TRIGGER_RISING_EDGE;
exint_init(&exint_init_struct);
/* enable tamper irqchannel */
nvic_irq_enable(TAMP_STAMP_IRQn, 0, 0);
@@ -111,25 +111,25 @@ void system_clock_recover(void)
{
/* enable external high-speed crystal oscillator - hext */
crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
/* wait till hext is ready */
while(crm_hext_stable_wait() == ERROR);
/* enable pll */
crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
/* wait till pll is ready */
while(crm_flag_get(CRM_PLL_STABLE_FLAG) == RESET);
/* enable auto step mode */
crm_auto_step_mode_enable(TRUE);
/* select pll as system clock source */
crm_sysclk_switch(CRM_SCLK_PLL);
/* wait till pll is used as system clock source */
while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL);
/* disable auto step mode */
crm_auto_step_mode_enable(FALSE);
}
@@ -143,69 +143,69 @@ int main(void)
{
__IO uint32_t delay_index = 0;
__IO uint32_t systick_index = 0;
/* congfig the system clock */
system_clock_config();
system_clock_config();
/* init at start board */
at32_board_init();
/* config priority group */
at32_board_init();
/* config priority group */
nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
/* turn on the led light */
/* turn on the led light */
at32_led_on(LED2);
at32_led_on(LED3);
at32_led_on(LED4);
/* enable pwc and bpr clock */
crm_periph_clock_enable(CRM_PWC_PERIPH_CLOCK, TRUE);
/* config ertc */
ertc_config();
/* set the wakeup time: 06h:20min:5s */
ertc_tamper_config();
while(1)
{
at32_led_off(LED2);
/* save systick register configuration */
systick_index = SysTick->CTRL;
systick_index &= ~((uint32_t)0xFFFFFFFE);
/* disable systick */
SysTick->CTRL &= (uint32_t)0xFFFFFFFE;
/* congfig the voltage regulator mode */
pwc_voltage_regulate_set(PWC_REGULATOR_LOW_POWER);
/* enter deep sleep mode */
pwc_deep_sleep_mode_enter(PWC_DEEP_SLEEP_ENTER_WFI);
/* restore systick register configuration */
SysTick->CTRL |= systick_index;
at32_led_on(LED2);
/* wait clock stable */
/* wait clock stable */
for(delay_index = 0; delay_index < 600; delay_index++)
{
__NOP();
}
/* wake up from deep sleep mode, congfig the system clock */
system_clock_recover();
delay_ms(500);
}
}
/**
* @}
*/
*/
/**
* @}
*/
*/

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,12 +32,12 @@
/** @addtogroup AT32F415_periph_examples
* @{
*/
/** @addtogroup 415_PWC_power_voltage_monitor
* @{
*/
/**
* @brief this function handles nmi exception.
* @param none
@@ -146,7 +146,7 @@ void PVM_IRQHandler(void)
{
/* clear exint line flag */
exint_flag_clear(EXINT_LINE_16);
/* toggle led */
at32_led_toggle(LED2);
at32_led_toggle(LED3);
@@ -156,9 +156,9 @@ void PVM_IRQHandler(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,
@@ -31,12 +31,12 @@
/** @addtogroup AT32F415_periph_examples
* @{
*/
/** @addtogroup 415_PWC_power_voltage_monitor PWC_power_voltage_monitor
* @{
*/
/**
* @brief power voltage monitor exint configuration.
* @param none
@@ -45,7 +45,7 @@
void pvm_exint_config(void)
{
exint_init_type exint_init_struct;
/* config the exint line of the power voltage monitor */
exint_init_struct.line_select = EXINT_LINE_16;
exint_init_struct.line_enable = TRUE;
@@ -62,45 +62,45 @@ void pvm_exint_config(void)
int main(void)
{
__IO uint32_t index = 0;
/* congfig the system clock */
system_clock_config();
system_clock_config();
/* init at start board */
at32_board_init();
/* config priority group */
at32_board_init();
/* config priority group */
nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
/* turn on the led light */
at32_led_on(LED2);
at32_led_on(LED3);
at32_led_on(LED4);
/* enable pwc clock */
crm_periph_clock_enable(CRM_PWC_PERIPH_CLOCK, TRUE);
/* set the threshold voltage to 2.9v */
pwc_pvm_level_select(PWC_PVM_VOLTAGE_2V9);
/* enable power voltage monitor */
pwc_power_voltage_monitor_enable(TRUE);
/* config the exint line of the power voltage monitor */
pvm_exint_config();
/* when power voltage monitor enable,exint line16 flag will be set */
while(exint_flag_get(EXINT_LINE_16) == RESET);
/* clear the unexpected exint line flag */
exint_flag_clear(EXINT_LINE_16);
/* clear the unexpected nvic pending flag */
NVIC_ClearPendingIRQ(PVM_IRQn);
/* enable power voltage monitor interrupt */
nvic_irq_enable(PVM_IRQn, 0, 0);
while(1)
{
}
@@ -108,8 +108,8 @@ int main(void)
/**
* @}
*/
*/
/**
* @}
*/
*/

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,12 +31,12 @@
/** @addtogroup AT32F415_periph_examples
* @{
*/
/** @addtogroup 415_PWC_sleep_tmr2
* @{
*/
/**
* @brief this function handles nmi exception.
* @param none
@@ -145,7 +145,7 @@ void TMR2_GLOBAL_IRQHandler(void)
{
/* clear timer 2 ovf flag */
tmr_flag_clear(TMR2, TMR_OVF_FLAG);
/* toggle led */
at32_led_toggle(LED4);
}
@@ -153,9 +153,9 @@ void TMR2_GLOBAL_IRQHandler(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,
@@ -31,12 +31,12 @@
/** @addtogroup AT32F415_periph_examples
* @{
*/
/** @addtogroup 415_PWC_sleep_tmr2 PWC_sleep_tmr2
* @{
*/
/**
* @brief tmr2 configuration.
* @param none
@@ -45,29 +45,29 @@
void tmr2_config(void)
{
crm_clocks_freq_type crm_clocks_freq_struct = {0};
/* enable tmr 2 clock */
crm_periph_clock_enable(CRM_TMR2_PERIPH_CLOCK, TRUE);
/* get system clock */
crm_clocks_freq_get(&crm_clocks_freq_struct);
/* (systemclock/(systemclock/10000))/10000 = 1Hz(1s) */
tmr_base_init(TMR2, 9999, (crm_clocks_freq_struct.sclk_freq/10000 - 1));
/* config the counting direction */
/* config the counting direction */
tmr_cnt_dir_set(TMR2, TMR_COUNT_UP);
/* config the clock divider value */
/* config the clock divider value */
tmr_clock_source_div_set(TMR2, TMR_CLOCK_DIV1);
/* enable tmr 2 interrupt */
/* enable tmr 2 interrupt */
tmr_interrupt_enable(TMR2, TMR_OVF_INT, TRUE);
/* config tmr 2 nvic */
/* config tmr 2 nvic */
nvic_irq_enable(TMR2_GLOBAL_IRQn, 0, 0);
/* enable tmr 2 */
/* enable tmr 2 */
tmr_counter_enable(TMR2, TRUE);
}
@@ -80,41 +80,41 @@ int main(void)
{
__IO uint32_t index = 0;
__IO uint32_t systick_index = 0;
/* congfig the system clock */
system_clock_config();
system_clock_config();
/* init at start board */
at32_board_init();
/* config priority group */
at32_board_init();
/* config priority group */
nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
/* turn on the led light */
/* turn on the led light */
at32_led_on(LED2);
at32_led_on(LED3);
at32_led_on(LED4);
/* enable pwc clock */
crm_periph_clock_enable(CRM_PWC_PERIPH_CLOCK, TRUE);
/* config tmr 2 */
tmr2_config();
while(1)
{
at32_led_off(LED2);
/* save systick register configuration */
systick_index = SysTick->CTRL;
systick_index &= ~((uint32_t)0xFFFFFFFE);
/* disable systick */
SysTick->CTRL &= (uint32_t)0xFFFFFFFE;
/* enter sleep mode */
pwc_sleep_mode_enter(PWC_SLEEP_ENTER_WFI);
/* restore systick register configuration */
SysTick->CTRL |= systick_index;
@@ -126,8 +126,8 @@ int main(void)
/**
* @}
*/
*/
/**
* @}
*/
*/

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,12 +32,12 @@
/** @addtogroup AT32F415_periph_examples
* @{
*/
/** @addtogroup 415_PWC_sleep_usart1
* @{
*/
uint16_t usart1_index = 0;
/**
* @brief this function handles nmi exception.
@@ -147,7 +147,7 @@ void USART1_IRQHandler(void)
{
/* clear rdbf flag */
usart1_index = usart_data_receive(USART1);
/* toggle led */
at32_led_toggle(LED4);
}
@@ -156,8 +156,8 @@ void USART1_IRQHandler(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 AT32F415_periph_examples
* @{
*/
/** @addtogroup 415_PWC_sleep_usart1 PWC_sleep_usart1
* @{
*/
@@ -55,19 +55,19 @@ void usart1_config(uint32_t baudrate)
gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
gpio_init_struct.gpio_pins = GPIO_PINS_9;
gpio_init_struct.gpio_pins = GPIO_PINS_9;
gpio_init(GPIOA, &gpio_init_struct);
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_INPUT;
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_INPUT;
gpio_init_struct.gpio_pull = GPIO_PULL_UP;
gpio_init_struct.gpio_pins = GPIO_PINS_10;
gpio_init(GPIOA, &gpio_init_struct);
/* configure uart param */
nvic_irq_enable(USART1_IRQn, 0, 0);
usart_init(USART1, baudrate, USART_DATA_8BITS, USART_STOP_1_BIT);
usart_parity_selection_config(USART1, USART_PARITY_NONE);
usart_transmitter_enable(USART1, TRUE);
@@ -138,8 +138,8 @@ int main(void)
/**
* @}
*/
*/
/**
* @}
*/
*/

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,12 +32,12 @@
/** @addtogroup AT32F415_periph_examples
* @{
*/
/** @addtogroup 415_PWC_standby_ertc_alarm
* @{
*/
/**
* @brief this function handles nmi exception.
* @param none
@@ -137,9 +137,9 @@ 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,
@@ -32,12 +32,12 @@
/** @addtogroup AT32F415_periph_examples
* @{
*/
/** @addtogroup 415_PWC_standby_ertc_alarm PWC_standby_ertc_alarm
* @{
*/
/**
* @brief ertc configuration.
* @param none
@@ -51,7 +51,7 @@ void ertc_config(void)
/* 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);
@@ -69,19 +69,19 @@ void ertc_config(void)
/* wait for ertc apb registers synchronisation */
ertc_wait_update();
/* configure the ertc data register and ertc prescaler
/* configure the ertc data register and ertc prescaler
ck_spre(1hz) = ertcclk(lext) /(ertc_clk_div_a + 1)*(ertc_clk_div_b + 1)*/
ertc_divider_set(127, 255);
/* configure the hour format is 24-hour format*/
ertc_hour_mode_set(ERTC_HOUR_MODE_24);
/* set the date: friday june 11th 2021 */
ertc_date_set(21, 6, 11, 5);
/* set the time to 06h 20mn 00s am */
ertc_time_set(6, 20, 0, ERTC_AM);
ertc_time_set(6, 20, 0, ERTC_AM);
}
/**
@@ -94,7 +94,7 @@ void ertc_alarm_config(void)
/* set the alarm 05h:20min:10s */
ertc_alarm_mask_set(ERTC_ALA, ERTC_ALARM_MASK_DATE_WEEK | ERTC_ALARM_MASK_HOUR | ERTC_ALARM_MASK_MIN);
ertc_alarm_week_date_select(ERTC_ALA, ERTC_SLECT_DATE);
/* enable ertc alarm a interrupt */
ertc_interrupt_enable(ERTC_ALA_INT, TRUE);
}
@@ -107,12 +107,12 @@ void ertc_alarm_config(void)
void ertc_alarm_value_set(uint32_t alam_index)
{
ertc_time_type ertc_time_struct;
/* disable the alarm */
ertc_alarm_enable(ERTC_ALA, FALSE);
ertc_calendar_get(&ertc_time_struct);
ertc_alarm_set(ERTC_ALA, ertc_time_struct.day, ertc_time_struct.hour, ertc_time_struct.min, (ertc_time_struct.sec + alam_index)% 60, ertc_time_struct.ampm);
/* disable the alarm */
ertc_alarm_enable(ERTC_ALA, TRUE);
}
@@ -125,51 +125,51 @@ void ertc_alarm_value_set(uint32_t alam_index)
int main(void)
{
__IO uint32_t index = 0;
/* congfig the system clock */
system_clock_config();
system_clock_config();
/* init at start board */
at32_board_init();
/* config priority group */
at32_board_init();
/* config priority group */
nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
/* turn on the led light */
/* turn on the led light */
at32_led_off(LED2);
at32_led_off(LED3);
at32_led_off(LED4);
/* enable pwc clock */
crm_periph_clock_enable(CRM_PWC_PERIPH_CLOCK, TRUE);
if(pwc_flag_get(PWC_STANDBY_FLAG) != RESET)
{
/* wakeup from standby */
pwc_flag_clear(PWC_STANDBY_FLAG);
at32_led_on(LED2);
}
if(pwc_flag_get(PWC_WAKEUP_FLAG) != RESET)
{
/* wakeup event occurs */
pwc_flag_clear(PWC_WAKEUP_FLAG);
at32_led_on(LED3);
}
/* config ertc */
ertc_config();
at32_led_on(LED4);
ertc_alarm_config();
for(index = 0; index < 0xFFFFFF; index++);
/* set the wakeup time to 3 seconds */
ertc_alarm_value_set(3);
/* enter standby mode */
pwc_standby_mode_enter();
while(1)
{
}
@@ -177,8 +177,8 @@ int main(void)
/**
* @}
*/
*/
/**
* @}
*/
*/

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_PWC_standby_wakeup_pin
* @{
*/
/**
* @brief this function handles nmi exception.
* @param none
@@ -135,9 +135,9 @@ 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,
@@ -31,11 +31,11 @@
/** @addtogroup AT32F415_periph_examples
* @{
*/
/** @addtogroup 415_PWC_standby_wakeup_pin PWC_standby_wakeup_pin
* @{
*/
/**
* @brief main function.
* @param none
@@ -44,44 +44,44 @@
int main(void)
{
__IO uint32_t index = 0;
/* congfig the system clock */
system_clock_config();
system_clock_config();
/* init at start board */
at32_board_init();
/* config priority group */
at32_board_init();
/* config priority group */
nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
/* turn on the led light */
/* turn on the led light */
at32_led_off(LED2);
at32_led_off(LED3);
at32_led_off(LED4);
/* enable pwc clock */
crm_periph_clock_enable(CRM_PWC_PERIPH_CLOCK, TRUE);
if(pwc_flag_get(PWC_STANDBY_FLAG) != RESET)
{
/* wakeup from standby */
pwc_flag_clear(PWC_STANDBY_FLAG);
at32_led_on(LED2);
}
if(pwc_flag_get(PWC_WAKEUP_FLAG) != RESET)
{
/* wakeup event occurs */
pwc_flag_clear(PWC_WAKEUP_FLAG);
at32_led_on(LED3);
}
at32_led_on(LED4);
for(index = 0; index < 0xFFFFFF; index++);
/* enable wakeup pin - pa0 */
pwc_wakeup_pin_enable(PWC_WAKEUP_PIN_1, TRUE);
/* enter standby mode */
pwc_standby_mode_enter();
while(1)
@@ -91,8 +91,8 @@ int main(void)
/**
* @}
*/
*/
/**
* @}
*/
*/