Giter VIP home page Giter VIP logo

Comments (11)

whqsz avatar whqsz commented on July 21, 2024

对比两个库唯一区别是外部调用的声明这个地方
//extern"C"{
#include "Arduino.h"
//}
#include "Wire.h"

from arduino-for-keil.

FASTSHIFT avatar FASTSHIFT commented on July 21, 2024

@whqsz 新的extEEPROM库已上传,而且增加了示例

0A8{4 CF$%BM74 HA2C)ITM
去除 extEEPROM.h 的 "extern"C"{}" 即可

from arduino-for-keil.

whqsz avatar whqsz commented on July 21, 2024

感谢你的回复,问题已经解决。
目前对DigitalFilter.h调用上还是弄不明白,最好提交一份demo参考,让我们新手少走弯路。
谢谢!

from arduino-for-keil.

FASTSHIFT avatar FASTSHIFT commented on July 21, 2024

好的,我稍后会更新例程

from arduino-for-keil.

FASTSHIFT avatar FASTSHIFT commented on July 21, 2024

@whqsz 数字滤波器例程已更新

from arduino-for-keil.

whqsz avatar whqsz commented on July 21, 2024

遇到一个问题,当单片机不外接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.

FASTSHIFT avatar FASTSHIFT commented on July 21, 2024

使用内部时钟源属于特殊需求,通用性不强,所以我没有在项目里封装,用标准库就可以了

from arduino-for-keil.

FASTSHIFT avatar FASTSHIFT commented on July 21, 2024

在配置完时钟源后,调用Delay_Init(),让Systick自适应

from arduino-for-keil.

whqsz avatar whqsz commented on July 21, 2024

这两次更新 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.

FASTSHIFT avatar FASTSHIFT commented on July 21, 2024

@whqsz 加我Q吧

from arduino-for-keil.

FASTSHIFT avatar FASTSHIFT commented on July 21, 2024

是不是在中断里调用delay了

from arduino-for-keil.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.