用习惯了stm32的库,现在用芯唐M0库,有些别扭,不知nxp M0的库如何?
先用库函数配置了时钟:
UNLOCKREG();//解锁寄存器
SYSCLK->PWRCON.XTL12M_EN = 1;//使能外部12M晶振
/* Waiting for 12M Xtal stalble */
SysTimerDelay(5000);
/* Configure PLL clock */
DrvSYS_Open(12000, 50000); //配置倍频时钟
/* Get PLL clock frequency */
u32data = DrvSYS_GetPLLClock(); //读取倍频时钟
再初始化节拍定时器作为时基
void SysTimerInit(uint32_t us){
SysTick->LOAD = us * 50;
SysTick->VAL = (0x00);
SysTick->CTRL = (1 << SYSTICK_CLKSOURCE) | (1<<SYSTICK_ENABLE) | (1<<SYSTICK_TICKINT);
}
M0的库为何函数不全,还要自己写一部分。 |