06fdc108b4
* first commit, keil test pass * feat : n32g452xx direct structure base at32 1. 重新整理目录结构 * feat : 基于AT32,将各驱动移植整改待验证 1. 部分驱动已经整改,但未验证 2. 根据AT32整改目录结构 * feat : add README document 1. 完善配置文件 2. 添加说明文档 * feat : 验证添加的驱动 1. UART 1-3 验证通过 2. ADC 1-2 CH 6-9 验证通过 3. TIM 6-7 验证通过 * feat : complete readme document * feat : format code 1. ref https://github.com/mysterywolf/formatting * feat : 完成PWM驱动移植与自测 1. 添加PWM测试代码 2. 修正PWM驱动周期与脉冲错误问题 * feat : 删除多余代码与多余的文件,修正注释与函数命名 * feat : fix tim channel comment * feat : 完成DEMO测试例子 1. 完成MAIN函数中的LED测试例子 2. 完善README文档 3. 更新添加许可文件 * feat : 根据BSP提交自查完善固件 1. 添加.ignore_format.yml文件 2. 修正main.c的注释 * feat : add last line in .ignore_format.yml * feat : delet file_path in .ignore_format.yml * fix: gPIO/ADC driver 1. add ADC temperature&vref channel. 2.add GPIO IPD/OD configration * fix: 解决告警 1. 解决告警(rt_drv_pwm.c: warning: implicit declaration of function 'atoi') * feat: add scons --dist function * fix: 解决MDK5无法编译问题 * perf: delete invalid code Co-authored-by: linyuanbo_breo_server <linyuanbo@breo.com.cn>
66 lines
1.2 KiB
C
66 lines
1.2 KiB
C
/*
|
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*
|
|
* Change Logs:
|
|
* Date Author Notes
|
|
* 2021-08-20 breo.com first version
|
|
*/
|
|
|
|
#include "drv_common.h"
|
|
#include "board.h"
|
|
|
|
#ifdef RT_USING_SERIAL
|
|
#ifdef RT_USING_SERIAL_V2
|
|
#include "drv_usart_v2.h"
|
|
#else
|
|
#include "drv_usart.h"
|
|
#endif
|
|
#endif
|
|
|
|
#ifdef RT_USING_FINSH
|
|
#include <finsh.h>
|
|
static void reboot(uint8_t argc, char **argv)
|
|
{
|
|
rt_hw_cpu_reset();
|
|
}
|
|
MSH_CMD_EXPORT(reboot, Reboot System);
|
|
#endif /* RT_USING_FINSH */
|
|
|
|
/**
|
|
* This function will delay for some us.
|
|
*
|
|
* @param us the delay time of us
|
|
*/
|
|
void rt_hw_us_delay(rt_uint32_t us)
|
|
{
|
|
rt_uint32_t ticks;
|
|
rt_uint32_t told, tnow, tcnt = 0;
|
|
rt_uint32_t reload = SysTick->LOAD;
|
|
|
|
ticks = us * reload / (1000000 / RT_TICK_PER_SECOND);
|
|
told = SysTick->VAL;
|
|
while (1)
|
|
{
|
|
tnow = SysTick->VAL;
|
|
if (tnow != told)
|
|
{
|
|
if (tnow < told)
|
|
{
|
|
tcnt += told - tnow;
|
|
}
|
|
else
|
|
{
|
|
tcnt += reload - tnow + told;
|
|
}
|
|
told = tnow;
|
|
if (tcnt >= ticks)
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|