Comments (11)
对比两个库唯一区别是外部调用的声明这个地方
//extern"C"{
#include "Arduino.h"
//}
#include "Wire.h"
from arduino-for-keil.
@whqsz 新的extEEPROM库已上传,而且增加了示例
去除 extEEPROM.h 的 "extern"C"{}" 即可
from arduino-for-keil.
感谢你的回复,问题已经解决。
目前对DigitalFilter.h调用上还是弄不明白,最好提交一份demo参考,让我们新手少走弯路。
谢谢!
from arduino-for-keil.
好的,我稍后会更新例程
from arduino-for-keil.
@whqsz 数字滤波器例程已更新
from arduino-for-keil.
遇到一个问题,当单片机不外接8M晶振系统默认运行速度很慢,项目核心库中暂时没找到启用内部64M频率的函数,但我只找到这个函数来设置内部晶振。我希望能尽量使用本项目自身封装函数。感谢!
void SetSysClockTo64Mhz(void) //启用内部晶振工作频率64M
{
__IO uint32_t StartUpCounter = 0, HSEStatus = 0;
RCC_DeInit();
/* SYSCLK, HCLK, PCLK2 and PCLK1 configuration ---------------------------/
/ Enable HSI */
RCC->CR |= ((uint32_t)RCC_CR_HSION);
/* Wait till HSI is ready and if Time out is reached exit */
do
{
HSEStatus = RCC->CR & RCC_CR_HSIRDY;
StartUpCounter++;
} while((HSEStatus == 0) && (StartUpCounter != HSE_STARTUP_TIMEOUT));
if ((RCC->CR & RCC_CR_HSIRDY) != RESET)
{
HSEStatus = (uint32_t)0x01;
}
else
{
HSEStatus = (uint32_t)0x00;
}
if (HSEStatus == (uint32_t)0x01)
{
/* Enable Prefetch Buffer /
FLASH->ACR |= FLASH_ACR_PRFTBE;
/ Flash 2 wait state /
FLASH->ACR &= (uint32_t)((uint32_t)~FLASH_ACR_LATENCY);
FLASH->ACR |= (uint32_t)FLASH_ACR_LATENCY_2;
/ HCLK = SYSCLK /
RCC->CFGR |= (uint32_t)RCC_CFGR_HPRE_DIV1;
/ PCLK2 = HCLK /
RCC->CFGR |= (uint32_t)RCC_CFGR_PPRE2_DIV1;
/ PCLK1 = HCLK /
RCC->CFGR |= (uint32_t)RCC_CFGR_PPRE1_DIV2;
/ PLL configuration: PLLCLK = HSI/2 * 16 = 64 MHz /
RCC->CFGR &= (uint32_t)((uint32_t)~(RCC_CFGR_PLLSRC | RCC_CFGR_PLLXTPRE |
RCC_CFGR_PLLMULL));
RCC->CFGR |= (uint32_t)(RCC_CFGR_PLLSRC_HSI_Div2| RCC_CFGR_PLLMULL16);
/ Enable PLL /
RCC->CR |= RCC_CR_PLLON;
/ Wait till PLL is ready /
while((RCC->CR & RCC_CR_PLLRDY) == 0)
{
}
/ Select PLL as system clock source */
RCC->CFGR &= (uint32_t)((uint32_t)~(RCC_CFGR_SW));
RCC->CFGR |= (uint32_t)RCC_CFGR_SW_PLL;
/* Wait till PLL is used as system clock source */
while ((RCC->CFGR & (uint32_t)RCC_CFGR_SWS) != (uint32_t)0x08)
{
}
}
else
{ /* If HSE fails to start-up, the application will have wrong clock
configuration. User can add here some code to deal with this error */
}
}
from arduino-for-keil.
使用内部时钟源属于特殊需求,通用性不强,所以我没有在项目里封装,用标准库就可以了
from arduino-for-keil.
在配置完时钟源后,调用Delay_Init(),让Systick自适应
from arduino-for-keil.
这两次更新 timer.c
只要在main中加上定时器中断 程序运行卡在setup过不去 进程追踪停止while(System_ms < Stop_TimePoint);这行
/**
- @brief 毫秒级延时
- @param ms: 要延时的毫秒数
- @RetVal 无
*/
void delay_ms(uint32_t ms)
{
uint32_t Stop_TimePoint = System_ms + ms;
while(System_ms < Stop_TimePoint); 停在这里
}
项目只用到Wire库
#include "FileGroup.h"
...
...
int main(void)
{
SetSysClockTo64Mhz();
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
GPIO_JTAG_Disable();
//SysClock_Init(F_CPU_64MHz);
Delay_Init();
//ADCx_Init(ADC1);0
TimerSet(TIM2, 1000, Onems); //1毫秒定时器 这里
TIM_Cmd(TIM2, ENABLE); 这里
setup();
for (;;)loop();
}
from arduino-for-keil.
@whqsz 加我Q吧
from arduino-for-keil.
是不是在中断里调用delay了
from arduino-for-keil.
Related Issues (20)
- [user contribution] Libraries - Tested HOT 3
- sd卡读写问题 HOT 3
- 移植STM32F107出错 HOT 2
- Low Power Mode [Help nedeed] HOT 2
- 请教一下,如何移植到正点原子的F407或F429开发板里去? HOT 4
- 移植库文件报错 HOT 2
- Some ERROR in Print.h..
- STM32SD 移植失败,补了很多路径也不行 HOT 1
- STM32用此包导致芯片锁死 HOT 2
- BMP280
- Keil5不能引用Arduino库中的Class HOT 2
- 编译无法使用C++11 arduino的很多库在头文件中就给成员赋值了 导致出错 这个问题怎么解决 HOT 8
- 调试IIC时,初始化出不来, HOT 1
- 使用F401RC仿真运行,为什么不停的复位? HOT 2
- 按照教程移植,但是导入库失败 HOT 4
- 移植到其他平台问题 HOT 2
- 我在其他地方找不到答案, 为什么不是只编译修改过的文件 HOT 1
- STM32F103RC移植报错 HOT 9
- stm32f103IIC读取mpu9250失败 HOT 1
- 对FastLED库的支持!
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from arduino-for-keil.